23 #include <yarp/os/Property.h>
24 #include <yarp/os/LogStream.h>
29 using namespace yarp::os;
32 static void set_flag(
bool& flag,
const string& str) {
33 flag = (str==
"on" || str==
"1" || str==
"ON" || str==
"true" || str==
"TRUE");
35 #define FLAGIFY(flags,name) set_flag(flags.name,name)
38 string parts = getFinder().findFile(
"parts");
40 parts = getFinder().findFile(
"general");
44 options.fromConfigFile(parts.c_str());
49 string actElevation = options.findGroup(
"SETUP").check(
"elevation",Value(1),
"what did the user select?").asString();
50 if ( actElevation.length()<1 ) stopConfig(
"actElevation");
53 string actStartHomePos = options.findGroup(
"SETUP").check(
"startHomePos",Value(1),
"what did the user select?").asString();
54 if (actStartHomePos.length()<1 ) stopConfig(
"actStartHomePos");
55 FLAGIFY(flags, actStartHomePos);
57 string actLegs = options.findGroup(
"PARTS").check(
"legs",Value(1),
"what did the user select?").asString();
58 if (actLegs.length()<1 ) stopConfig(
"actLegs");
61 string actTorso = options.findGroup(
"PARTS").check(
"torso",Value(1),
"what did the user select?").asString();
62 if (actTorso.length()<1 ) stopConfig(
"actTorso");
65 string actLArm = options.findGroup(
"PARTS").check(
"left_arm",Value(1),
"what did the user select?").asString();
66 if (actLArm.length()<1 ) stopConfig(
"actLArm");
69 string actRArm = options.findGroup(
"PARTS").check(
"right_arm",Value(1),
"what did the user select?").asString();
70 if (actRArm.length()<1 ) stopConfig(
"actRArm");
73 string actLHand = options.findGroup(
"PARTS").check(
"left_hand",Value(1),
"what did the user select?").asString();
74 if (actLHand.length()<1 ) stopConfig(
"actLHand");
77 string actRHand = options.findGroup(
"PARTS").check(
"right_hand",Value(1),
"what did the user select?").asString();
78 if (actRHand.length()<1 ) stopConfig(
"actRHand");
81 string actHead = options.findGroup(
"PARTS").check(
"head",Value(1),
"what did the user select?").asString();
82 if (actHead.length()<1 ) stopConfig(
"actHead");
85 string actfixedHip = options.findGroup(
"PARTS").check(
"fixed_hip",Value(1),
"what did the user select?").asString();
86 if (actfixedHip.length()<1 ) stopConfig(
"actfixedHip");
89 string actSelfCol = options.findGroup(
"COLLISIONS").check(
"self_collisions",Value(1),
"what did the user select?").asString();
90 if (actSelfCol.length()<1 ) stopConfig(
"actSelfCol");
93 string actCoversCol = options.findGroup(
"COLLISIONS").check(
"covers_collisions",Value(1),
"what did the user select?").asString();
94 if (actCoversCol.length()<1 ) stopConfig(
"actCoversCol");
97 string actVision = options.findGroup(
"VISION").check(
"cam",Value(1),
"What did the user select?").asString();
98 if (actVision.length()<1 ) stopConfig(
"actVision");
101 string actPressure = options.findGroup(
"SENSORS").check(
"pressure",Value(1),
"What did the user select?").asString();
102 if (actPressure.length()<1 ) stopConfig(
"actPressure");
105 string actSkinEmul = options.findGroup(
"SENSORS").check(
"whole_body_skin_emul",Value(1),
"What did the user select?").asString();
106 if (actSkinEmul.length()<1 ) stopConfig(
"actSkinEmul");
109 string actWorld = options.findGroup(
"RENDER").check(
"objects",Value(1),
"What did the user select?").asString();
110 if (actWorld.length()<1 ) stopConfig(
"actWorld");
113 string actScreen = options.findGroup(
"RENDER").check(
"screen",Value(1),
"What did the user select?").asString();
114 if (actScreen.length()<1 ) stopConfig(
"actScreen");
117 string actHeadCover = options.findGroup(
"RENDER").check(
"head_cover",Value(1),
"What did the user select?").asString();
118 if (actHeadCover.length()<1 ) stopConfig(
"actHeadCover");
121 string actLegsCovers = options.findGroup(
"RENDER").check(
"legs_covers",Value(1),
"What did the user select?").asString();
122 if (actLegsCovers.length()<1 ) stopConfig(
"actLegsCovers");
125 string actLeftArmCovers = options.findGroup(
"RENDER").check(
"left_arm_covers",Value(1),
"What did the user select?").asString();
126 if (actLeftArmCovers.length()<1 ) stopConfig(
"actLeftArmCovers");
127 FLAGIFY(flags,actLeftArmCovers);
129 string actRightArmCovers = options.findGroup(
"RENDER").check(
"right_arm_covers",Value(1),
"What did the user select?").asString();
130 if (actRightArmCovers.length()<1 ) stopConfig(
"actRightArmCovers");
131 FLAGIFY(flags,actRightArmCovers);
133 string actTorsoCovers = options.findGroup(
"RENDER").check(
"torso_covers",Value(1),
"What did the user select?").asString();
134 if ( actTorsoCovers.length()<1 ) stopConfig(
"actTorsoCovers");
142 yInfo() <<
"The iCub simulator will start with the following configuration: \n\n" <<
143 "Elevation : " << actElevation <<
"\n" <<
144 "startHomePos : " << actStartHomePos <<
"\n" <<
145 "Legs : " << actLegs <<
"\n" <<
146 "Torso : " << actTorso <<
"\n" <<
147 "Left arm : " << actLArm <<
"\n" <<
148 "Left hand : " << actLHand <<
"\n" <<
149 "Right arm : " << actRArm <<
"\n" <<
150 "Right hand : " << actRHand <<
"\n" <<
151 "Head : " << actHead <<
"\n" <<
152 "Fixed Hip : " << actfixedHip <<
"\n" <<
"\n" <<
153 "Self-collisions : " << actSelfCol <<
"\n" <<
154 "Collisions for covers : " << actCoversCol <<
"\n" <<
"\n" <<
155 "Pressure sensors: " << actPressure <<
"\n" <<
156 "Whole body skin emulation: " << actSkinEmul <<
"\n" <<
157 "Cameras :" << actVision <<
"\n" <<
158 "Objects : " << actWorld <<
"\n" <<
159 "Head Cover : " << actHeadCover <<
"\n" <<
160 "Legs Cover : " << actLegsCovers <<
"\n" <<
161 "Left arm Covers : " << actLeftArmCovers <<
"\n" <<
162 "Right arm Covers : " << actRightArmCovers <<
"\n" <<
163 "Torso Cover : " << actTorsoCovers <<
"\n" <<
164 "Screen : " << actScreen <<
"\n" <<
"\n";
172 yError() <<
"\n\n\nThere seems to be a conflict with the " << error <<
" configuration file";
173 yError() <<
"Check the iCub_parts_activation.ini under $ICUB_ROOT/app/simConfig ";
174 yError() <<
"If it still does not work (update svn) and re-install the app folder\n\n";
175 yError() <<
"The iCub simulator will not start..\n\n\n";