40 typedef map<int, const char*> IdToLabelMap;
42 IdToLabelMap commandLabelMap;
44 IdLabel commandLabels[] = {
46 { DynamicsSimulator::POSITION_GIVEN,
"Position Given (High Gain Mode)" },
57 void initializeCommandLabelMaps()
59 if(commandLabelMap.empty()){
62 IdLabel& idLabel = commandLabels[
i++];
66 commandLabelMap[idLabel.id] = idLabel.label;
71 const char* getLabelOfLinkDataType(DynamicsSimulator::LinkDataType
type)
73 IdToLabelMap::iterator p = commandLabelMap.find(
type);
74 return (p != commandLabelMap.end()) ? p->second :
"Requesting Unknown Data Type";
79 template<
typename X,
typename X_ptr>
82 CosNaming::Name ncName;
84 ncName[0].id = CORBA::string_dup(
n.c_str());
85 ncName[0].kind = CORBA::string_dup(
"");
88 srv = X::_narrow(cxt->resolve(ncName));
90 std::cerr <<
n <<
" not found: ";
92 case CosNaming::NamingContext::missing_node:
93 std::cerr <<
"Missing Node" << std::endl;
94 case CosNaming::NamingContext::not_context:
95 std::cerr <<
"Not Context" << std::endl;
97 case CosNaming::NamingContext::not_object:
98 std::cerr <<
"Not Object" << std::endl;
102 }
catch(CosNaming::NamingContext::CannotProceed &exc) {
103 std::cerr <<
"Resolve " <<
n <<
" CannotProceed" << std::endl;
104 }
catch(CosNaming::NamingContext::AlreadyBound &exc) {
105 std::cerr <<
"Resolve " <<
n <<
" InvalidName" << std::endl;
112 : orb_(CORBA::ORB::_duplicate(orb))
115 cout <<
"ODE_DynamicsSimulator_impl::ODE_DynamicsSimulator_impl()" << endl;
124 CollisionDetectorFactory_var collisionDetectorFactory;
126 CORBA::Object_var nS = orb->resolve_initial_references(
"NameService");
127 CosNaming::NamingContext_var cxT;
128 cxT = CosNaming::NamingContext::_narrow(nS);
129 collisionDetectorFactory =
131 CollisionDetectorFactory_var>(
"CollisionDetectorFactory", cxT);
132 if (CORBA::is_nil(collisionDetectorFactory)) {
133 std::cerr <<
"CollisionDetectorFactory not found" << std::endl;
139 std::cerr <<
"failed to create CollisionDetector" << std::endl;
156 cout <<
"ODE_DynamicsSimulator_impl::~ODE_DynamicsSimulator_impl()" << endl;
166 cout <<
"ODE_DynamicsSimulator_impl::destroy()" << endl;
169 PortableServer::POA_var poa_ = _default_POA();
170 PortableServer::ObjectId_var
id = poa_->servant_to_id(
this);
171 poa_->deactivate_object(
id);
178 BodyInfo_ptr bodyInfo
182 cout <<
"ODE_DynamicsSimulator_impl::registerCharacter("
183 <<
name <<
", " << bodyInfo <<
" )" << std::endl;
186 world.addBody(bodyInfo,
name);
189 collisionDetector->registerCharacter(
name, bodyInfo);
196 CORBA::Double timeStep,
197 OpenHRP::DynamicsSimulator::IntegrateMethod integrateOpt,
198 OpenHRP::DynamicsSimulator::SensorOption sensorOpt
202 cout <<
"ODE_DynamicsSimulator_impl::init(" << timeStep <<
", ";
203 cout << (integrateOpt == OpenHRP::DynamicsSimulator::EULER ?
"EULER, " :
"RUNGE_KUTTA, ");
204 cout << (sensorOpt == OpenHRP::DynamicsSimulator::DISABLE_SENSOR ?
"DISABLE_SENSOR" :
"ENABLE_SENSOR");
205 std::cout <<
")" << std::endl;
208 world.setTimeStep(timeStep);
209 world.setCurrentTime(0.0);
211 if(integrateOpt == OpenHRP::DynamicsSimulator::EULER){
212 world.setEulerMethod();
214 world.setRungeKuttaMethod();
217 world.enableSensors((sensorOpt == OpenHRP::DynamicsSimulator::ENABLE_SENSOR));
219 int n = world.numBodies();
220 for(
int i=0;
i <
n; ++
i){
221 world.body(
i)->initializeConfiguration();
224 _setupCharacterData();
234 const char *charName1,
235 const char *linkName1,
236 const char *charName2,
237 const char *linkName2,
238 const CORBA::Double staticFriction,
239 const CORBA::Double slipFriction,
240 const DblSequence6 & K,
241 const DblSequence6 & C,
242 const double culling_thresh,
243 const double restitution
246 const double epsilon = 0.0;
249 cout <<
"DynamicsSimulator_impl::registerCollisionCheckPair("
250 << charName1 <<
", " << linkName1 <<
", "
251 << charName2 <<
", " << linkName2 <<
", "
252 << staticFriction <<
", " << slipFriction;
253 if((K.length() == 6) && (C.length() == 6)){
256 << K[CORBA::ULong(0)] <<
", "
257 << K[CORBA::ULong(1)] <<
", "
258 << K[CORBA::ULong(2)] <<
" }\n"
260 << K[CORBA::ULong(3)] <<
", "
261 << K[CORBA::ULong(4)] <<
", "
262 << K[CORBA::ULong(5)] <<
" }\n"
265 << C[CORBA::ULong(0)] <<
", "
266 << C[CORBA::ULong(1)] <<
", "
267 << C[CORBA::ULong(2)] <<
" }\n"
269 << C[CORBA::ULong(3)] <<
", "
270 << C[CORBA::ULong(4)] <<
", "
271 << C[CORBA::ULong(5)] <<
" }\n"
274 cout <<
", NULL, NULL)" << endl;
278 int bodyIndex1 = world.bodyIndex(charName1);
279 int bodyIndex2 = world.bodyIndex(charName2);
281 if(bodyIndex1 >= 0 && bodyIndex2 >= 0){
283 BodyPtr body1 = world.body(bodyIndex1);
284 BodyPtr body2 = world.body(bodyIndex2);
286 std::string emptyString =
"";
287 vector<Link*> links1;
288 if(emptyString == linkName1){
291 std::copy(traverse.
begin(), traverse.
end(), links1.begin());
293 links1.push_back(body1->link(linkName1));
296 vector<Link*> links2;
297 if(emptyString == linkName2){
300 std::copy(traverse.
begin(), traverse.
end(), links2.begin());
302 links2.push_back(body2->link(linkName2));
305 for(
size_t i=0;
i < links1.size(); ++
i){
306 for(
size_t j=0; j < links2.size(); ++j){
307 Link* link1 = links1[
i];
308 Link* link2 = links2[j];
310 if(link1 && link2 && link1 != link2){
311 LinkPair_var linkPair =
new LinkPair();
312 linkPair->charName1 = CORBA::string_dup(charName1);
313 linkPair->linkName1 = CORBA::string_dup(link1->
name.c_str());
314 linkPair->charName2 = CORBA::string_dup(charName2);
315 linkPair->linkName2 = CORBA::string_dup(link2->
name.c_str());
316 linkPair->tolerance = 0;
318 collisionDetector->addCollisionPair(linkPair);
320 world.addCollisionPair(linkPair);
331 const char *charName1,
332 const char *linkName1,
333 const char *charName2,
334 const char *linkName2,
335 const double tolerance
338 const double epsilon = 0.0;
341 cout <<
"DynamicsSimulator_impl::registerIntersectionCheckPair("
342 << charName1 <<
", " << linkName1 <<
", "
343 << charName2 <<
", " << linkName2 <<
", "
344 << tolerance <<
")" << endl;
347 int bodyIndex1 = world.bodyIndex(charName1);
348 int bodyIndex2 = world.bodyIndex(charName2);
350 if(bodyIndex1 >= 0 && bodyIndex2 >= 0){
352 BodyPtr body1 = world.body(bodyIndex1);
353 BodyPtr body2 = world.body(bodyIndex2);
355 std::string emptyString =
"";
356 vector<Link*> links1;
357 if(emptyString == linkName1){
360 std::copy(traverse.
begin(), traverse.
end(), links1.begin());
362 links1.push_back(body1->link(linkName1));
365 vector<Link*> links2;
366 if(emptyString == linkName2){
369 std::copy(traverse.
begin(), traverse.
end(), links2.begin());
371 links2.push_back(body2->link(linkName2));
374 for(
size_t i=0;
i < links1.size(); ++
i){
375 for(
size_t j=0; j < links2.size(); ++j){
376 Link* link1 = links1[
i];
377 Link* link2 = links2[j];
379 if(link1 && link2 && link1 != link2){
380 LinkPair_var linkPair =
new LinkPair();
381 linkPair->charName1 = CORBA::string_dup(charName1);
382 linkPair->linkName1 = CORBA::string_dup(link1->
name.c_str());
383 linkPair->charName2 = CORBA::string_dup(charName2);
384 linkPair->linkName2 = CORBA::string_dup(link2->
name.c_str());
385 linkPair->tolerance = 0;
387 collisionDetector->addCollisionPair(linkPair);
389 world.addCollisionPair(linkPair);
398 const char* charName1,
399 const char* linkName1,
400 const char* charName2,
401 const char* linkName2,
402 const DblSequence3& link1LocalPos,
403 const DblSequence3& link2LocalPos,
404 const ExtraJointType jointType,
405 const DblSequence3& jointAxis,
406 const char* extraJointName)
413 const char * characterName,
414 const char * extraJointName,
415 DblSequence6_out contactForce
419 cout <<
"DynamicsSimulator_impl::getConnectionConstraintForce("
420 << characterName <<
", " << extraJointName <<
")" << endl;
427 const char *characterName,
428 const char *sensorName,
429 DblSequence_out sensorOutput
433 cout <<
"DynamicsSimulator_impl::getCharacterSensorData("
434 << characterName <<
", " << sensorName <<
")";
437 BodyPtr body = world.body(characterName);
439 std::cerr <<
"not found! :" << characterName << std::endl;
443 sensorOutput =
new DblSequence;
447 switch(sensor->
type){
452 sensorOutput->length(6);
457 sensorOutput[CORBA::ULong(0)] = forceSensor->
f(0); sensorOutput[CORBA::ULong(1)] = forceSensor->
f(1); sensorOutput[CORBA::ULong(2)] = forceSensor->
f(2);
458 sensorOutput[CORBA::ULong(3)] = forceSensor->
tau(0); sensorOutput[CORBA::ULong(4)] = forceSensor->
tau(1); sensorOutput[CORBA::ULong(5)] = forceSensor->
tau(2);
467 sensorOutput->length(3);
471 sensorOutput[CORBA::ULong(0)] = gyro->
w(0); sensorOutput[CORBA::ULong(1)] = gyro->
w(1); sensorOutput[CORBA::ULong(2)] = gyro->
w(2);
479 sensorOutput->length(3);
483 sensorOutput[CORBA::ULong(0)] = accelSensor->
dv(0); sensorOutput[CORBA::ULong(1)] = accelSensor->
dv(1); sensorOutput[CORBA::ULong(2)] = accelSensor->
dv(2);
491 sensorOutput->length(rangeSensor->
distances.size());
492 for (
unsigned int i=0;
i<rangeSensor->
distances.size();
i++){
504 cout <<
"DynamicsSimulator_impl::getCharacterSensorData - output\n"
505 <<
"( " << sensorOutput[CORBA::ULong(0)];
509 cout << sensorOutput[
i++];
510 if(
i == sensorOutput->length())
break;
523 cout <<
"DynamicsSimulator_impl::initSimulation()" << endl;
552 cout <<
"DynamicsSimulator_impl::stepSimulation()" << endl;
587 const char* characterName,
588 const char* linkName,
589 OpenHRP::DynamicsSimulator::LinkDataType
type,
590 const DblSequence& wdata
594 cout <<
"DynamicsSimulator_impl::setCharacterLinkData("
595 << characterName <<
", " << linkName <<
", "
596 << getLabelOfLinkDataType(
type) <<
", ";
599 case OpenHRP::DynamicsSimulator::POSITION_GIVEN:
604 cout << wdata[CORBA::ULong(0)] <<
")\n";
608 cout << wdata[CORBA::ULong(0)] <<
", "
609 << wdata[CORBA::ULong(1)] <<
", "
610 << wdata[CORBA::ULong(2)] <<
",\n"
611 << wdata[CORBA::ULong(3)] <<
", "
612 << wdata[CORBA::ULong(4)] <<
", "
613 << wdata[CORBA::ULong(5)] <<
",\n"
614 << wdata[CORBA::ULong(6)] <<
","
615 << wdata[CORBA::ULong(7)] <<
", "
616 << wdata[CORBA::ULong(8)] <<
",\n "
617 << wdata[CORBA::ULong(9)] <<
","
618 << wdata[CORBA::ULong(10)] <<
", "
619 << wdata[CORBA::ULong(11)] <<
")" << endl;
623 cout << wdata[CORBA::ULong(0)] <<
", "
624 << wdata[CORBA::ULong(1)] <<
", "
625 << wdata[CORBA::ULong(2)] <<
")" << endl;
629 BodyPtr body = world.body(characterName);
631 std::cerr <<
"not found! :" << characterName << std::endl;
636 std::cerr <<
"not found! :" << linkName << std::endl;
642 case OpenHRP::DynamicsSimulator::POSITION_GIVEN:
645 std::cerr <<
" HighGainMode is unsupported. " << std::endl;
661 link->
ddq = wdata[0];
665 if(link->
jointType != Link::FIXED_JOINT){
673 link->
p(0) = wdata[0];
674 link->
p(1) = wdata[1];
675 link->
p(2) = wdata[2];
685 link->
v(0) = wdata[0];
686 link->
v(1) = wdata[1];
687 link->
v(2) = wdata[2];
688 link->
w(0) = wdata[3];
689 link->
w(1) = wdata[4];
690 link->
w(2) = wdata[5];
697 std::cerr <<
"ERROR - Invalid type: " << getLabelOfLinkDataType(
type) << endl;
703 link->
setForce(wdata[0], wdata[1], wdata[2] );
704 link->
setTorque(wdata[3], wdata[4], wdata[5] );
712 needToUpdatePositions =
true;
713 needToUpdateSensorStates =
true;
720 const char * characterName,
721 const char * linkName,
722 OpenHRP::DynamicsSimulator::LinkDataType
type,
723 DblSequence_out out_rdata
727 cout <<
"DynamicsSimulator_impl::getCharacterLinkData("
728 << characterName <<
", " << linkName <<
", "
729 << getLabelOfLinkDataType(
type) <<
")" << endl;
732 BodyPtr body = world.body(characterName);
734 std::cerr <<
"not found! :" << characterName << std::endl;
739 std::cerr <<
"not found! :" << linkName << std::endl;
743 DblSequence_var rdata =
new DblSequence;
758 std::cerr <<
"ERROR - Invalid type: " << getLabelOfLinkDataType(
type) << endl;
777 double*
buf = rdata->get_buffer();
812 std::cerr <<
"ERROR - Invalid type: " << getLabelOfLinkDataType(
type) << endl;
821 out_rdata = rdata._retn();
828 const char * characterName,
829 OpenHRP::DynamicsSimulator::LinkDataType
type,
830 DblSequence_out rdata
834 cout <<
"DynamicsSimulator_impl::getCharacterAllLinkData("
835 << characterName <<
", "
836 << getLabelOfLinkDataType(
type) <<
")" << endl;
839 BodyPtr body = world.body(characterName);
841 std::cerr <<
"not found! :" << characterName << std::endl;
844 int n = body->numJoints();
845 rdata =
new DblSequence();
851 for(
int i=0;
i <
n; ++
i){
852 (*rdata)[
i] = body->joint(
i)->q;
857 for(
int i=0;
i <
n; ++
i){
858 (*rdata)[
i] = body->joint(
i)->dq;
863 std::cerr <<
"ERROR - Invalid type: " << getLabelOfLinkDataType(
type) << endl;
864 for(
int i=0;
i <
n; ++
i){
870 for(
int i=0;
i <
n; ++
i){
871 (*rdata)[
i] = body->joint(
i)->u;
876 cerr <<
"ERROR - Invalid type: " << getLabelOfLinkDataType(
type) << endl;
885 const char * characterName,
886 OpenHRP::DynamicsSimulator::LinkDataType
type,
887 const DblSequence & wdata
891 cout <<
"DynamicsSimulator_impl::setCharacterAllLinkData("
892 << characterName <<
", "
893 << getLabelOfLinkDataType(
type) <<
",\n(";
894 if(wdata.length()) cout << wdata[0];
895 for(CORBA::ULong
i=0;
i<wdata.length(); ++
i){
896 cout <<
", " << wdata[
i];
898 cout <<
"))" << endl;
901 BodyPtr body = world.body(characterName);
903 std::cerr <<
"not found! :" << characterName << std::endl;
907 int n = wdata.length();
908 if(
n > body->numJoints()){
909 n = body->numJoints();
915 for(
int i=0;
i <
n; ++
i){
916 if(body->joint(
i)->jointType != Link::FIXED_JOINT)
917 body->joint(
i)->q = wdata[
i];
922 for(
int i=0;
i <
n; ++
i){
923 if(body->joint(
i)->jointType != Link::FIXED_JOINT)
924 body->joint(
i)->dq = wdata[
i];
929 for(
int i=0;
i <
n; ++
i){
930 if(body->joint(
i)->jointType != Link::FIXED_JOINT)
931 body->joint(
i)->ddq = wdata[
i];
936 for(
int i=0;
i <
n; ++
i){
937 if(body->joint(
i)->jointType != Link::FIXED_JOINT){
938 body->joint(
i)->u = wdata[
i];
939 ((
ODE_Link*)body->joint(
i))->setTorque(wdata[
i]);
945 std::cerr <<
"ERROR - Invalid type: " << getLabelOfLinkDataType(
type) << endl;
948 needToUpdatePositions =
true;
949 needToUpdateSensorStates =
true;
955 const DblSequence3& wdata
958 if(wdata.length() != 3){
959 std::cerr <<
"setGVector : The data length is not three. " << std::endl;
964 g[0] = wdata[CORBA::ULong(0)];
965 g[1] = wdata[CORBA::ULong(1)];
966 g[2] = -wdata[CORBA::ULong(2)];
967 world.setGravityAcceleration(g);
970 cout <<
"ODE_DynamicsSimulator_impl::setGVector("
971 << wdata[CORBA::ULong(0)] <<
", "
972 << wdata[CORBA::ULong(1)] <<
", "
973 << wdata[CORBA::ULong(2)] <<
")" << endl;
980 DblSequence3_out wdata
985 world.getGravityAcceleration(g);
991 cout <<
"DynamicsSimulator_impl::getGVector(";
992 cout << wdata[CORBA::ULong(0)] <<
", "
993 << wdata[CORBA::ULong(1)] <<
", "
994 << wdata[CORBA::ULong(2)] <<
")" << endl;
1001 const char * characterName,
1002 OpenHRP::DynamicsSimulator::JointDriveMode jointMode
1005 bool isHighGainMode = (jointMode == OpenHRP::DynamicsSimulator::HIGH_GAIN_MODE);
1007 BodyPtr body = world.body(characterName);
1009 std::cerr <<
"not found! :" << characterName << std::endl;
1013 for(
int i=1;
i < body->numLinks(); ++
i){
1014 body->link(
i)->isHighGainMode = isHighGainMode;
1018 std::cerr <<
" HighGainMode is unsupported. " << std::endl;
1022 cout <<
"DynamicsSimulator_impl::setCharacterAllJointModes(";
1023 cout << characterName <<
", ";
1024 cout << (isHighGainMode ?
"HIGH_GAIN_MODE" :
"TORQUE_MODE");
1025 cout <<
")" << endl;
1033 const char * characterName,
1034 const char * fromLink,
const char * toLink,
1035 const LinkPosition& target
1039 cout <<
"DynamicsSimulator_impl::calcCharacterInverseKinematics("
1040 << characterName <<
", " << fromLink <<
", " << toLink <<
",\n"
1042 << target.p[0] <<
", " << target.p[1] <<
", " << target.p[2] <<
",\n\n"
1043 << target.R[0] <<
", " << target.R[1] <<
", " << target.R[2] <<
",\n"
1044 << target.R[3] <<
", " << target.R[4] <<
", " << target.R[5] <<
",\n"
1045 << target.R[6] <<
", " << target.R[7] <<
", " << target.R[8] << endl;
1048 bool solved =
false;
1050 BodyPtr body = world.body(characterName);
1052 std::cerr <<
"not found! :" << characterName << std::endl;
1056 JointPath path(body->link(fromLink), body->link(toLink));
1059 Vector3 p(target.p[0], target.p[1], target.p[2]);
1061 for (
int i=0;
i<3;
i++) {
1062 for (
int j=0; j<3; j++){
1063 R(
i,j) = target.R[3*
i+j];
1070 needToUpdatePositions =
true;
1071 needToUpdateSensorStates =
true;
1083 const char * characterName
1087 cout <<
"DynamicsSimulator_impl::calcCharacterForwardKinematics( "
1088 << characterName << endl;
1091 BodyPtr body = world.body(characterName);
1093 std::cerr <<
"not found! :" << characterName << std::endl;
1096 body->calcForwardKinematics(
true,
true);
1098 for(
int j=0; j<body->numLinks(); j++){
1104 needToUpdatePositions =
true;
1105 needToUpdateSensorStates =
true;
1115 b->calcForwardKinematics(
true,
true);
1116 for(
int j=0; j<
b->numLinks(); j++){
1152 DistanceSequence_var distances =
new DistanceSequence;
1154 return distances._retn();
1166 LinkPairSequence_var pairs =
new LinkPairSequence;
1168 return pairs._retn();
1176 cout <<
"DynamicsSimulator_impl::getWorldState()\n";
1181 wstate =
new WorldState;
1188 cout <<
"getWorldState - exit" << endl;
1205 sstate =
new SensorState;
1214 cout <<
"DynamicsSimulator_impl::_setupCharacterData()\n";
1221 for(
int i=0;
i <
n; ++
i){
1224 int numLinks = body->numLinks();
1226 characterPosition.characterName = CORBA::string_dup(body->name().c_str());
1227 LinkPositionSequence& linkPositions = characterPosition.linkPositions;
1228 linkPositions.length(numLinks);
1230 int numJoints = body->numJoints();
1232 sensorState.q.length(numJoints);
1233 sensorState.dq.length(numJoints);
1234 sensorState.u.length(numJoints);
1238 sensorState.range.length(body->numSensors(Sensor::RANGE));
1241 std::cout <<
"character[" <<
i <<
"], nlinks = " << numLinks <<
"\n";
1246 cout <<
"_setupCharacterData() - exit" << endl;;
1255 cout <<
"DynamicsSimulator_impl::_updateCharacterPositions()\n";
1261 #pragma omp parallel for num_threads(3)
1262 for(
int i=0;
i <
n; ++
i){
1264 int numLinks = body->numLinks();
1269 cout <<
"character[" <<
i <<
"], nlinks = " << numLinks <<
"\n";
1272 for(
int j=0; j < numLinks; ++j) {
1273 Link* link = body->link(j);
1274 LinkPosition& linkPosition = characterPosition.linkPositions[j];
1283 cout <<
"_updateCharacterData() - exit" << endl;
1293 cout <<
"DynamicsSimulator_impl::_updateSensorStates()\n";
1297 for(
int i=0;
i < numBodies; ++
i){
1302 int numJoints = body->numJoints();
1304 for(
int j=0; j < numJoints; j++){
1306 state.
q [j] = joint->
q;
1307 state.dq[j] = joint->
dq;
1308 state.u [j] = joint->
u;
1312 for(
int id = 0;
id <
n; ++id){
1317 std::cout <<
"Force Sensor: f:" << sensor->
f <<
"tau:" << sensor->
tau <<
"\n";
1322 for(
int id=0;
id <
n; ++id){
1326 std::cout <<
"Rate Gyro:" << sensor->
w <<
"\n";
1331 for(
int id=0;
id <
n; ++id){
1335 std::cout <<
"Accel:" << sensor->
dv << std::endl;
1339 n = body->numSensors(Sensor::RANGE);
1340 for (
int id=0;
id <
n; ++id){
1352 for (
unsigned int i=0;
i<
data->length();
i++){
1356 state.range[id] =
data;
1364 cout <<
"_updateCharacterData() - exit" << endl;
1377 const char *characterName,
1378 LinkPairSequence_out pairs
1382 cout <<
"DynamicsSimulator_impl::getCharacterCollidingPairs("
1383 << characterName <<
")" << endl;
1386 if(!world.body(characterName)){
1387 std::cerr <<
"not found! :" << characterName << std::endl;
1391 std::vector<unsigned int> locations;
1393 for(
unsigned int i=0;
i < collisions->length(); ++
i) {
1395 if( (strcmp(characterName, collisions[
i].pair.charName1) == 0) ||
1396 (strcmp(characterName, collisions[
i].pair.charName2) == 0))
1397 locations.push_back(
i);
1400 pairs->length(locations.size());
1403 for(std::vector<unsigned int>::iterator iter = locations.begin();
1404 iter != locations.end(); ++iter) {
1406 strcpy(pairs[
n].charName1, collisions[*iter].pair.charName1);
1407 strcpy(pairs[
n].charName2, collisions[*iter].pair.charName2);
1408 strcpy(pairs[
n].linkName1, collisions[*iter].pair.linkName1);
1409 strcpy(pairs[
n].linkName2, collisions[*iter].pair.linkName2);
1418 const char *characterName,
1419 const char *baseLink,
1420 const char *targetLink,
1421 DblSequence_out jacobian
1425 cout <<
"DynamicsSimulator_impl::calcCharacterJacobian("
1426 << characterName <<
", "
1428 << targetLink <<
")" << endl;
1431 BodyPtr body = world.body(characterName);
1433 std::cerr <<
"not found! :" << characterName << std::endl;
1437 JointPath path(body->link(baseLink), body->link(targetLink));
1445 for(
int r=0; r <
height; ++r){
1447 (*jacobian)[
i++] = J(r,
c);
1459 orb_(CORBA::ORB::_duplicate(orb))
1461 initializeCommandLabelMaps();
1464 cout <<
"DynamicsSimulatorFactory_impl::DynamicsSimulatorFactory_impl()" << endl;
1472 cout <<
"DynamicsSimulatorFactory_impl::~DynamicsSimulatorFactory_impl()" << endl;
1475 PortableServer::POA_var poa = _default_POA();
1476 PortableServer::ObjectId_var
id = poa -> servant_to_id(
this);
1477 poa -> deactivate_object(
id);
1484 cout <<
"DynamicsSimulatorFactory_impl::create()" << endl;
1489 PortableServer::ServantBase_var integratorrServant = integratorImpl;
1490 PortableServer::POA_var poa_ = _default_POA();
1491 PortableServer::ObjectId_var
id =
1492 poa_ -> activate_object(integratorImpl);
1494 return integratorImpl -> _this();
1500 orb_->shutdown(
false);