Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

faceExpressions: more fixes to the doc #698

Merged
merged 1 commit into from
Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/faceExpressions/doc.dox
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ set col <color> set the color of the led

set brig <brig> set the brightness of the leds
!! available only for rfe board !!
the brightness is defined by an iteger from 0 to 5, where 0 means led of
the brightness is defined by an integer from 0 to 5, where 0 means led off

set mask (<col_leb> <m_name_leb> <brig_leb>) (<col_reb> <m_name_reb> <brig_reb>) (<col_mou> <m_name_mou> <brig_mou>) set color, bitmask and brightness for each part(leb, reb, mou)
!! available only for rfe board !!
Expand Down
4 changes: 2 additions & 2 deletions app/faceExpressions/scripts/exampleTransition.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
happy() {
echo "set $1 hap" | yarp rpc /icub/face/emotions/in
sleep 0.001
echo "set brig green" | yarp rpc /icub/face/emotions/in
echo "set brig $2" | yarp rpc /icub/face/emotions/in
}

neutral() {
Expand All @@ -25,7 +25,7 @@ surprised() {

}

while true; do
while true; do
# neutral fade out
echo "set mask (blue BM_EB1 4) (blue BM_EB1 4) (blue BM_M0 4)" | yarp rpc /icub/face/emotions/in
sleep 0.5
Expand Down
40 changes: 20 additions & 20 deletions src/core/emotionInterface/emotionInterfaceModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void printHelp (yarp::os::Bottle& reply) {
"\n"+
"set brig <brig> set the brightness of the leds\n"+
"\t!! available only for rfe board !!\n"+
"\tthe brightness is defined by an iteger from 0 to 5, where 0 means led of\n"+
"\tthe brightness is defined by an integer from 0 to 5, where 0 means led off\n"+
"\n"+
"set mask (<col_leb> <m_name_leb> <brig_leb>) (<col_reb> <m_name_reb> <brig_reb>) (<col_mou> <m_name_mou> <brig_mou>) set color, bitmask and brightness for each part(leb, reb, mou)\n"+
"\t!! available only for rfe board !!\n"+
Expand All @@ -82,7 +82,7 @@ EmotionInterfaceModule::EmotionInterfaceModule() : emotionInitReport(this) {
}

bool EmotionInterfaceModule::configure(ResourceFinder& config){

char name[10];
int i;

Expand All @@ -101,7 +101,7 @@ bool EmotionInterfaceModule::configure(ResourceFinder& config){
_mouthmaskemotions = config.check("bitmask_mouth_emotions", Value(0), "Number of predefined bitmask eyebrow expressions").asInt();
_auto = config.check("auto");
_period = config.check("period", Value(10.0), "Period for expression switching in auto mode").asDouble();
if(_highlevelemotions == 0)
if(_highlevelemotions == 0)
{
_emotion_table = nullptr;
}
Expand Down Expand Up @@ -131,7 +131,7 @@ bool EmotionInterfaceModule::configure(ResourceFinder& config){
}
//first field - name of the expression
std::string n1 = bot.get(1).toString();

if(n1.length()!=3) //must have length 3
{
yError("First field of identifier %s has invalid size (must be 3).", name);
Expand Down Expand Up @@ -246,7 +246,7 @@ bool EmotionInterfaceModule::configure(ResourceFinder& config){
}

}

yarp::os::Property rcb_face_conf{ {"device",Value("remote_controlboard")},
{"local", Value(getName("/face/remoteControlBoard"))},
{"remote",Value("/icub/face")},
Expand Down Expand Up @@ -281,7 +281,7 @@ bool EmotionInterfaceModule::configure(ResourceFinder& config){
}

// open ports
_inputPort.open(getName("/in"));
_inputPort.open(getName("/in"));
_outputPort.open(getName("/out"));
_outputPort.setReporter(emotionInitReport);
_initEmotionTrigger=0;
Expand All @@ -296,7 +296,7 @@ bool EmotionInterfaceModule::close(){
_inputPort.close();
if(!_outputPort.isClosed())
_outputPort.close();

if (_emotion_table != nullptr)
{
delete [] _emotion_table;
Expand All @@ -313,7 +313,7 @@ bool EmotionInterfaceModule::close(){
}

bool EmotionInterfaceModule::interruptModule(){

_inputPort.interrupt();
_outputPort.interrupt();
return true;
Expand Down Expand Up @@ -350,7 +350,7 @@ double EmotionInterfaceModule::getPeriod(){
}

bool EmotionInterfaceModule::respond(const Bottle &command,Bottle &reply){

bool ok = false;
bool rec = false; // is the command recognized?

Expand Down Expand Up @@ -441,7 +441,7 @@ bool EmotionInterfaceModule::respond(const Bottle &command,Bottle &reply){

if (!rec)
ok = false;

if (!ok) {
reply.clear();
reply.addVocab(EMOTION_VOCAB_FAILED);
Expand All @@ -450,14 +450,14 @@ bool EmotionInterfaceModule::respond(const Bottle &command,Bottle &reply){
reply.addVocab(EMOTION_VOCAB_OK);

return ok;
}
}

//get the index in _emotions_table of a emotion name
int EmotionInterfaceModule::getIndex(const std::string cmd)
{
if(_highlevelemotions == 0)
return -1;

int i;
for(i = 0; i < _highlevelemotions; i++)
{
Expand All @@ -467,7 +467,7 @@ int EmotionInterfaceModule::getIndex(const std::string cmd)

if( i == _highlevelemotions ) // no match
return -1;

return i;
}

Expand All @@ -487,12 +487,12 @@ bool EmotionInterfaceModule::writePort(const char* cmd)
bool EmotionInterfaceModule::setLeftEyebrow(const std::string cmd)
{
char cmdbuffer[] = {0,0,0,0};
int i;
int i;
i = getIndex(cmd);
if(i < 0)
return false;

if( _emotion_table[i].leb[0] == '*' || _emotion_table[i].leb[1] == '*')
if( _emotion_table[i].leb[0] == '*' || _emotion_table[i].leb[1] == '*')
return true; //leave it in the same state

cmdbuffer[0]= 'L';
Expand All @@ -505,12 +505,12 @@ bool EmotionInterfaceModule::setLeftEyebrow(const std::string cmd)
bool EmotionInterfaceModule::setRightEyebrow(const std::string cmd)
{
char cmdbuffer[] = {0,0,0,0};
int i;
int i;
i = getIndex(cmd);
if(i < 0)
return false;

if( _emotion_table[i].reb[0] == '*' || _emotion_table[i].reb[1] == '*')
if( _emotion_table[i].reb[0] == '*' || _emotion_table[i].reb[1] == '*')
return true; //leave it in the same state

cmdbuffer[0]= 'R';
Expand All @@ -523,12 +523,12 @@ bool EmotionInterfaceModule::setRightEyebrow(const std::string cmd)
bool EmotionInterfaceModule::setMouth(const std::string cmd)
{
char cmdbuffer[] = {0,0,0,0};
int i;
int i;
i = getIndex(cmd);
if(i < 0)
return false;

if( _emotion_table[i].mou[0] == '*' || _emotion_table[i].mou[1] == '*')
if( _emotion_table[i].mou[0] == '*' || _emotion_table[i].mou[1] == '*')
return true; //leave it in the same state

cmdbuffer[0]= 'M';
Expand All @@ -547,7 +547,7 @@ bool EmotionInterfaceModule::setEyelids(const std::string cmd)

auto res{ true };

if( _emotion_table[i].eli[0] == '*' || _emotion_table[i].eli[1] == '*')
if( _emotion_table[i].eli[0] == '*' || _emotion_table[i].eli[1] == '*')
return true; //leave it in the same state
if (_iPos)
{
Expand Down