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;
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;
211 if(integrateOpt == OpenHRP::DynamicsSimulator::EULER){
220 for(
int i=0;
i <
n; ++
i){
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;
281 if(bodyIndex1 >= 0 && bodyIndex2 >= 0){
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;
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;
350 if(bodyIndex1 >= 0 && bodyIndex2 >= 0){
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;
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 <<
")";
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);
464 case Sensor::RATE_GYRO:
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);
476 case Sensor::ACCELERATION:
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;
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] );
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;
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;
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;
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;
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)];
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
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);
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;
1052 std::cerr <<
"not found! :" << characterName << std::endl;
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];
1067 solved =
path.calcInverseKinematics(p, R);
1083 const char * characterName
1087 cout <<
"DynamicsSimulator_impl::calcCharacterForwardKinematics( " 1088 << characterName << endl;
1093 std::cerr <<
"not found! :" << characterName << std::endl;
1096 body->calcForwardKinematics(
true,
true);
1098 for(
int j=0;
j<body->numLinks();
j++){
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);
1235 sensorState.force.length(body->numSensors(Sensor::FORCE));
1236 sensorState.rateGyro.length(body->numSensors(Sensor::RATE_GYRO));
1237 sensorState.accel.length(body->numSensors(Sensor::ACCELERATION));
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;
1311 int n = body->numSensors(Sensor::FORCE);
1312 for(
int id = 0;
id <
n; ++
id){
1317 std::cout <<
"Force Sensor: f:" << sensor->
f <<
"tau:" << sensor->
tau <<
"\n";
1321 n = body->numSensors(Sensor::RATE_GYRO);
1322 for(
int id=0;
id <
n; ++
id){
1326 std::cout <<
"Rate Gyro:" << sensor->
w <<
"\n";
1330 n = body->numSensors(Sensor::ACCELERATION);
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){
1351 rangeSensor->
distances.resize(data->length());
1352 for (
unsigned int i=0;
i<data->length();
i++){
1364 cout <<
"_updateCharacterData() - exit" << endl;
1377 const char *characterName,
1378 LinkPairSequence_out pairs
1382 cout <<
"DynamicsSimulator_impl::getCharacterCollidingPairs(" 1383 << characterName <<
")" << endl;
1387 std::cerr <<
"not found! :" << characterName << std::endl;
1391 std::vector<unsigned int> locations;
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;
1433 std::cerr <<
"not found! :" << characterName << std::endl;
1437 JointPath path(body->link(baseLink), body->link(targetLink));
1441 path.calcJacobian(J);
1443 jacobian->length(height * width);
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);
std::vector< double > distances
The header file of the LinkTraverse class.
virtual void registerCharacter(const char *name, BodyInfo_ptr binfo)
virtual void getWorldState(WorldState_out wstate)
const dReal * getTorque()
virtual void registerIntersectionCheckPair(const char *char1, const char *name1, const char *char2, const char *name2, const double tolerance)
void useInternalCollisionDetector(bool use)
void clearExternalForces()
SensorStateSequence_var allCharacterSensorStates
png_infop png_charp png_int_32 png_int_32 int * type
double ddq
joint acceleration
int bodyIndex(const std::string &name)
get index of body by name
~DynamicsSimulatorFactory_impl()
void setEulerMethod()
choose euler method for integration
std::vector< Link * >::const_iterator end() const
void setTransform(const hrp::Vector3 &pos, const hrp::Matrix33 &R)
void addBody(OpenHRP::BodyInfo_ptr body, const char *name)
add body to this world
void _updateCharacterPositions()
png_infop png_charpp name
static const bool USE_INTERNAL_COLLISION_DETECTOR
virtual void getExtraJointConstraintForce(const char *characterName, const char *extraJointName, DblSequence6_out contactForce)
void setForce(double fx, double fy, double fz)
void setCurrentTime(double tm)
set current time
void getGravityAcceleration(dVector3 &gravity)
get gravity acceleration
void addCollisionPair(OpenHRP::LinkPair &linkPair)
virtual void setCharacterLinkData(const char *characterName, const char *link, OpenHRP::DynamicsSimulator::LinkDataType type, const DblSequence &data)
virtual CORBA::Boolean getCharacterCollidingPairs(const char *characterName, LinkPairSequence_out pairs)
void _setupCharacterData()
virtual void getCharacterLinkData(const char *characterName, const char *link, OpenHRP::DynamicsSimulator::LinkDataType type, DblSequence_out rdata)
void setVector3(const Vector3 &v3, V &v, size_t top=0)
void getMatrix33FromRowMajorArray(Matrix33 &m33, const Array &a, size_t top=0)
CharacterPositionSequence_var allCharacterPositions
void initialize()
initialize this world. This must be called after all bodies are registered.
Vector3 w
angular velocity, omega
virtual void calcCharacterForwardKinematics(const char *characterName)
virtual void setCharacterAllLinkData(const char *characterName, OpenHRP::DynamicsSimulator::LinkDataType type, const DblSequence &wdata)
virtual void getCharacterAllLinkData(const char *characterName, OpenHRP::DynamicsSimulator::LinkDataType type, DblSequence_out wdata)
std::vector< Link * >::const_iterator begin() const
void setRungeKuttaMethod()
choose runge-kutta method for integration
virtual LinkPairSequence * checkIntersection(CORBA::Boolean checkAll)
void _updateSensorStates()
boost::shared_ptr< Body > BodyPtr
png_infop png_uint_32 * width
static const bool enableTimeMeasure
void getTransform(hrp::Vector3 &pos, hrp::Matrix33 &R)
void setSegmentAttitude(const Matrix33 &R)
BodyPtr body(int index)
get body by index
void setGravityAcceleration(const dVector3 &gravity)
set gravity acceleration
void setMatrix33ToRowMajorArray(const Matrix33 &m33, Array &a, size_t top=0)
virtual CORBA::Boolean calcCharacterInverseKinematics(const char *characterName, const char *baseLink, const char *targetLink, const LinkPosition &target)
virtual void calcWorldForwardKinematics()
virtual DistanceSequence * checkDistance()
static const bool USE_ODE_COLLISION_DETECTOR
unsigned int numLinks() const
bool needToUpdatePositions
virtual void registerCollisionCheckPair(const char *char1, const char *name1, const char *char2, const char *name2, CORBA::Double staticFriction, CORBA::Double slipFriction, const DblSequence6 &K, const DblSequence6 &C, const double culling_thresh, const double restitution)
DynamicsSimulatorFactory_impl(CORBA::ORB_ptr orb)
png_infop png_uint_32 png_uint_32 * height
virtual void getCharacterSensorState(const char *characterName, SensorState_out sstate)
virtual void calcCharacterJacobian(const char *characterName, const char *baseLink, const char *targetLink, DblSequence_out jacobian)
def j(str, encoding="cp932")
static const int debugMode
virtual void stepSimulation()
void setAbsVelocity(hrp::Vector3 &v, hrp::Vector3 &w)
virtual void setGVector(const DblSequence3 &wdata)
The header file of the LinkPath and JointPath classes.
CollisionSequence_var collisions
double averageTime() const
CollisionDetector_var collisionDetector
virtual void setCharacterAllJointModes(const char *characterName, OpenHRP::DynamicsSimulator::JointDriveMode jointMode)
virtual void registerExtraJoint(const char *charName1, const char *linkName1, const char *charName2, const char *linkName2, const DblSequence3 &link1LocalPos, const DblSequence3 &link2LocalPos, const ExtraJointType jointType, const DblSequence3 &jointAxis, const char *extraJointName)
virtual void getGVector(DblSequence3_out wdata)
void setTorque(double fx, double fy, double fz)
virtual void init(CORBA::Double timeStep, OpenHRP::DynamicsSimulator::IntegrateMethod integrateOpt, OpenHRP::DynamicsSimulator::SensorOption sensorOpt)
~ODE_DynamicsSimulator_impl()
DynamicsSimulator_ptr create()
void getLinearVel(hrp::Vector3 &v)
void setTimeStep(double dt)
set time step
virtual bool checkCollision(bool checkAll)
double currentTime(void) const
get current time
void calcNextState(OpenHRP::CollisionSequence &corbaCollisionSequence)
compute forward dynamics and update current state
LinkPairSequence_var collidingLinkPairs
const dReal * getAngularVel()
unsigned int numBodies()
get the number of bodies in this world
virtual void initSimulation()
void enableSensors(bool on)
enable/disable sensor simulation
X_ptr checkCorbaServer(std::string n, CosNaming::NamingContext_var &cxt)
bool needToUpdateSensorStates
ODE_DynamicsSimulator_impl(CORBA::ORB_ptr orb)
Matrix33 segmentAttitude()
virtual void getCharacterSensorValues(const char *characterName, const char *sensorName, DblSequence_out values)