00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #include "youbot/YouBotBase.hpp"
00052 namespace youbot {
00053
00054 YouBotBase::YouBotBase(const std::string name, const std::string configFilePath)
00055 : ethercatMaster(EthercatMaster::getInstance("youbot-ethercat.cfg", configFilePath)) {
00056
00057
00058 this->controllerType = 174;
00059 this->alternativeControllerType = 1632;
00060 this->supportedFirmwareVersions.push_back("148");
00061 this->supportedFirmwareVersions.push_back("200");
00062 this->actualFirmwareVersionAllJoints = "";
00063
00064 string filename;
00065 filename = name;
00066 filename.append(".cfg");
00067
00068 configfile.reset(new ConfigFile(filename, configFilePath));
00069
00070 if(ethercatMaster.isThreadActive()){
00071 ethercatMasterWithThread = static_cast<EthercatMasterWithThread*>(&(EthercatMaster::getInstance()));
00072 }else{
00073 ethercatMasterWithThread = NULL;
00074 }
00075
00076 this->initializeJoints();
00077
00078 this->initializeKinematic();
00079
00080
00081 }
00082
00083 YouBotBase::~YouBotBase() {
00084
00085 if(ethercatMaster.isThreadActive()){
00086 for (unsigned int i = 0; i < BASEJOINTS; i++) {
00087 ethercatMasterWithThread->deleteJointTrajectoryControllerRegistration(this->joints[i].getJointNumber());
00088 }
00089 }
00090
00091 }
00092
00093
00094 void YouBotBase::doJointCommutation() {
00095
00096
00097 if(this->actualFirmwareVersionAllJoints == "148"){
00098 this->commutationFirmware148();
00099 }else if(this->actualFirmwareVersionAllJoints == "200" ){
00100 this->commutationFirmware200();
00101 }else{
00102 throw std::runtime_error("Unable to commutate joints - Unsupported firmware version!");
00103 }
00104
00105 }
00106
00107
00108
00109 YouBotJoint& YouBotBase::getBaseJoint(const unsigned int baseJointNumber) {
00110
00111 if (baseJointNumber <= 0 || baseJointNumber > BASEJOINTS) {
00112 throw std::out_of_range("Invalid Joint Number");
00113 }
00114 return joints[baseJointNumber - 1];
00115
00116 }
00117
00118
00119
00120
00121
00122 void YouBotBase::getBasePosition(quantity<si::length>& longitudinalPosition, quantity<si::length>& transversalPosition, quantity<plane_angle>& orientation) {
00123
00124
00125 std::vector<quantity<plane_angle> > wheelPositions;
00126 quantity<plane_angle> dummy;
00127 JointSensedAngle sensedPos;
00128 wheelPositions.assign(BASEJOINTS, dummy);
00129
00130 ethercatMaster.AutomaticReceiveOn(false);
00131 joints[0].getData(sensedPos);
00132 wheelPositions[0] = sensedPos.angle;
00133 joints[1].getData(sensedPos);
00134 wheelPositions[1] = sensedPos.angle;
00135 joints[2].getData(sensedPos);
00136 wheelPositions[2] = sensedPos.angle;
00137 joints[3].getData(sensedPos);
00138 wheelPositions[3] = sensedPos.angle;
00139 ethercatMaster.AutomaticReceiveOn(true);
00140
00141 youBotBaseKinematic.wheelPositionsToCartesianPosition(wheelPositions, longitudinalPosition, transversalPosition, orientation);
00142
00143 }
00144
00145
00146
00147
00148
00149 void YouBotBase::setBasePosition(const quantity<si::length>& longitudinalPosition, const quantity<si::length>& transversalPosition, const quantity<plane_angle>& orientation) {
00150
00151
00152 std::vector<quantity<plane_angle> > wheelPositions;
00153 quantity<plane_angle> dummy;
00154 JointAngleSetpoint setpointPos;
00155 wheelPositions.assign(BASEJOINTS, dummy);
00156 JointSensedAngle sensedPos;
00157
00158 youBotBaseKinematic.cartesianPositionToWheelPositions(longitudinalPosition, transversalPosition, orientation, wheelPositions);
00159
00160 if (wheelPositions.size() < BASEJOINTS)
00161 throw std::out_of_range("To less wheel velocities");
00162
00163 joints[0].setEncoderToZero();
00164 joints[1].setEncoderToZero();
00165 joints[2].setEncoderToZero();
00166 joints[3].setEncoderToZero();
00167 SLEEP_MILLISEC(10);
00168
00169 ethercatMaster.AutomaticSendOn(false);
00170 joints[0].getData(sensedPos);
00171 setpointPos.angle = sensedPos.angle + wheelPositions[0];
00172 joints[0].setData(setpointPos);
00173
00174 joints[1].getData(sensedPos);
00175 setpointPos.angle = sensedPos.angle + wheelPositions[1];
00176 joints[1].setData(setpointPos);
00177
00178 joints[2].getData(sensedPos);
00179 setpointPos.angle = sensedPos.angle + wheelPositions[2];
00180 joints[2].setData(setpointPos);
00181
00182 joints[3].getData(sensedPos);
00183 setpointPos.angle = sensedPos.angle + wheelPositions[3];
00184 joints[3].setData(setpointPos);
00185 ethercatMaster.AutomaticSendOn(true);
00186
00187
00188 }
00189
00190
00191
00192
00193
00194 void YouBotBase::getBaseVelocity(quantity<si::velocity>& longitudinalVelocity, quantity<si::velocity>& transversalVelocity, quantity<si::angular_velocity>& angularVelocity) {
00195
00196
00197 std::vector<quantity<angular_velocity> > wheelVelocities;
00198 quantity<angular_velocity> dummy;
00199 JointSensedVelocity sensedVel;
00200 wheelVelocities.assign(BASEJOINTS, dummy);
00201
00202 ethercatMaster.AutomaticReceiveOn(false);
00203 joints[0].getData(sensedVel);
00204 wheelVelocities[0] = sensedVel.angularVelocity;
00205 joints[1].getData(sensedVel);
00206 wheelVelocities[1] = sensedVel.angularVelocity;
00207 joints[2].getData(sensedVel);
00208 wheelVelocities[2] = sensedVel.angularVelocity;
00209 joints[3].getData(sensedVel);
00210 wheelVelocities[3] = sensedVel.angularVelocity;
00211 ethercatMaster.AutomaticReceiveOn(true);
00212
00213 youBotBaseKinematic.wheelVelocitiesToCartesianVelocity(wheelVelocities, longitudinalVelocity, transversalVelocity, angularVelocity);
00214
00215
00216 }
00217
00218
00219
00220
00221
00222 void YouBotBase::setBaseVelocity(const quantity<si::velocity>& longitudinalVelocity, const quantity<si::velocity>& transversalVelocity, const quantity<si::angular_velocity>& angularVelocity) {
00223
00224
00225 std::vector<quantity<angular_velocity> > wheelVelocities;
00226 JointVelocitySetpoint setVel;
00227
00228 youBotBaseKinematic.cartesianVelocityToWheelVelocities(longitudinalVelocity, transversalVelocity, angularVelocity, wheelVelocities);
00229
00230 if (wheelVelocities.size() < BASEJOINTS)
00231 throw std::out_of_range("To less wheel velocities");
00232
00233 ethercatMaster.AutomaticSendOn(false);
00234 setVel.angularVelocity = wheelVelocities[0];
00235 joints[0].setData(setVel);
00236 setVel.angularVelocity = wheelVelocities[1];
00237 joints[1].setData(setVel);
00238 setVel.angularVelocity = wheelVelocities[2];
00239 joints[2].setData(setVel);
00240 setVel.angularVelocity = wheelVelocities[3];
00241 joints[3].setData(setVel);
00242 ethercatMaster.AutomaticSendOn(true);
00243
00244 }
00245
00246
00247
00248
00249 void YouBotBase::setJointData(const std::vector<JointAngleSetpoint>& JointData) {
00250
00251 if (JointData.size() != BASEJOINTS)
00252 throw std::out_of_range("Wrong number of JointAngleSetpoints");
00253
00254 ethercatMaster.AutomaticSendOn(false);
00255 joints[0].setData(JointData[0]);
00256 joints[1].setData(JointData[1]);
00257 joints[2].setData(JointData[2]);
00258 joints[3].setData(JointData[3]);
00259 ethercatMaster.AutomaticSendOn(true);
00260
00261
00262 }
00263
00264
00265
00266
00267 void YouBotBase::getJointData(std::vector<JointSensedAngle>& data) {
00268
00269 data.resize(BASEJOINTS);
00270 ethercatMaster.AutomaticReceiveOn(false);
00271 joints[0].getData(data[0]);
00272 joints[1].getData(data[1]);
00273 joints[2].getData(data[2]);
00274 joints[3].getData(data[3]);
00275 ethercatMaster.AutomaticReceiveOn(true);
00276
00277 }
00278
00279
00280
00281
00282 void YouBotBase::setJointData(const std::vector<JointVelocitySetpoint>& JointData) {
00283
00284 if (JointData.size() != BASEJOINTS)
00285 throw std::out_of_range("Wrong number of JointVelocitySetpoints");
00286
00287 ethercatMaster.AutomaticSendOn(false);
00288 joints[0].setData(JointData[0]);
00289 joints[1].setData(JointData[1]);
00290 joints[2].setData(JointData[2]);
00291 joints[3].setData(JointData[3]);
00292 ethercatMaster.AutomaticSendOn(true);
00293
00294 }
00295
00296
00297
00298
00299 void YouBotBase::getJointData(std::vector<JointSensedVelocity>& data) {
00300
00301 data.resize(BASEJOINTS);
00302 ethercatMaster.AutomaticReceiveOn(false);
00303 joints[0].getData(data[0]);
00304 joints[1].getData(data[1]);
00305 joints[2].getData(data[2]);
00306 joints[3].getData(data[3]);
00307 ethercatMaster.AutomaticReceiveOn(true);
00308
00309 }
00310
00311
00312
00313
00314 void YouBotBase::setJointData(const std::vector<JointCurrentSetpoint>& JointData) {
00315
00316 if (JointData.size() != BASEJOINTS)
00317 throw std::out_of_range("Wrong number of JointCurrentSetpoint");
00318
00319 ethercatMaster.AutomaticSendOn(false);
00320 joints[0].setData(JointData[0]);
00321 joints[1].setData(JointData[1]);
00322 joints[2].setData(JointData[2]);
00323 joints[3].setData(JointData[3]);
00324 ethercatMaster.AutomaticSendOn(true);
00325
00326 }
00327
00328
00329
00330
00331 void YouBotBase::getJointData(std::vector<JointSensedCurrent>& data) {
00332
00333 data.resize(BASEJOINTS);
00334 ethercatMaster.AutomaticReceiveOn(false);
00335 joints[0].getData(data[0]);
00336 joints[1].getData(data[1]);
00337 joints[2].getData(data[2]);
00338 joints[3].getData(data[3]);
00339 ethercatMaster.AutomaticReceiveOn(true);
00340
00341 }
00342
00343
00344
00345
00346 void YouBotBase::setJointData(const std::vector<JointTorqueSetpoint>& JointData) {
00347
00348 if (JointData.size() != BASEJOINTS)
00349 throw std::out_of_range("Wrong number of JointTorqueSetpoint");
00350
00351 ethercatMaster.AutomaticSendOn(false);
00352 joints[0].setData(JointData[0]);
00353 joints[1].setData(JointData[1]);
00354 joints[2].setData(JointData[2]);
00355 joints[3].setData(JointData[3]);
00356 ethercatMaster.AutomaticSendOn(true);
00357
00358 }
00359
00360
00361
00362
00363 void YouBotBase::getJointData(std::vector<JointSensedTorque>& data) {
00364
00365 data.resize(BASEJOINTS);
00366 ethercatMaster.AutomaticReceiveOn(false);
00367 joints[0].getData(data[0]);
00368 joints[1].getData(data[1]);
00369 joints[2].getData(data[2]);
00370 joints[3].getData(data[3]);
00371 ethercatMaster.AutomaticReceiveOn(true);
00372
00373 }
00374
00375
00376 void YouBotBase::commutationFirmware200() {
00377
00378
00379 InitializeJoint doInitialization;
00380 bool isInitialized = false;
00381 int noInitialization = 0;
00382 std::string jointName;
00383 unsigned int statusFlags;
00384 std::vector<bool> isCommutated;
00385 isCommutated.assign(BASEJOINTS, false);
00386 unsigned int u = 0;
00387 JointCurrentSetpoint zerocurrent;
00388 zerocurrent.current = 0.0 * ampere;
00389
00390
00391 ClearMotorControllerTimeoutFlag clearTimeoutFlag;
00392 for (unsigned int i = 1; i <= BASEJOINTS; i++) {
00393 this->getBaseJoint(i).setConfigurationParameter(clearTimeoutFlag);
00394 }
00395
00396 for (unsigned int i = 1; i <= BASEJOINTS; i++) {
00397 doInitialization.setParameter(false);
00398 this->getBaseJoint(i).getConfigurationParameter(doInitialization);
00399 doInitialization.getParameter(isInitialized);
00400 if (!isInitialized) {
00401 noInitialization++;
00402 }
00403 }
00404
00405 if (noInitialization != 0) {
00406 LOG(info) << "Base Joint Commutation with firmware 2.0";
00407 doInitialization.setParameter(true);
00408
00409 JointRoundsPerMinuteSetpoint rpmSetpoint(100);
00410
00411 ethercatMaster.AutomaticReceiveOn(false);
00412 this->getBaseJoint(1).setData(rpmSetpoint);
00413 this->getBaseJoint(2).setData(rpmSetpoint);
00414 this->getBaseJoint(3).setData(rpmSetpoint);
00415 this->getBaseJoint(4).setData(rpmSetpoint);
00416 ethercatMaster.AutomaticReceiveOn(true);
00417 rpmSetpoint.rpm = 0;
00418
00419
00420
00421 for (u = 1; u <= 5000; u++) {
00422 for (unsigned int i = 1; i <= BASEJOINTS; i++) {
00423 this->getBaseJoint(i).getStatus(statusFlags);
00424 if (statusFlags & INITIALIZED) {
00425 isCommutated[i - 1] = true;
00426 this->getBaseJoint(i).setData(rpmSetpoint);
00427 }
00428 }
00429 if(!ethercatMaster.isThreadActive()){
00430 ethercatMaster.sendProcessData();
00431 ethercatMaster.receiveProcessData();
00432 }
00433 if (isCommutated[0] && isCommutated[1] && isCommutated[2] && isCommutated[3]) {
00434 break;
00435 }
00436 SLEEP_MILLISEC(1);
00437 }
00438
00439 for (unsigned int i = 1; i <= BASEJOINTS; i++) {
00440 this->getBaseJoint(i).setData(rpmSetpoint);
00441 if(!ethercatMaster.isThreadActive()){
00442 ethercatMaster.sendProcessData();
00443 ethercatMaster.receiveProcessData();
00444 }
00445 doInitialization.setParameter(false);
00446 this->getBaseJoint(i).getConfigurationParameter(doInitialization);
00447 doInitialization.getParameter(isInitialized);
00448 if (!isInitialized) {
00449 std::stringstream jointNameStream;
00450 jointNameStream << "base joint " << i;
00451 jointName = jointNameStream.str();
00452 throw std::runtime_error("Could not commutate " + jointName);
00453 }
00454 }
00455 }
00456
00457 }
00458
00459
00460 void YouBotBase::commutationFirmware148() {
00461
00462
00463 InitializeJoint doInitialization;
00464 bool isInitialized = false;
00465 int noInitialization = 0;
00466 std::string jointName;
00467
00468
00469 ClearMotorControllerTimeoutFlag clearTimeoutFlag;
00470 for (unsigned int i = 1; i <= BASEJOINTS; i++) {
00471 this->getBaseJoint(i).setConfigurationParameter(clearTimeoutFlag);
00472 }
00473
00474 for (unsigned int i = 1; i <= BASEJOINTS; i++) {
00475 doInitialization.setParameter(false);
00476 this->getBaseJoint(i).getConfigurationParameter(doInitialization);
00477 doInitialization.getParameter(isInitialized);
00478 if (!isInitialized) {
00479 noInitialization++;
00480 }
00481 }
00482
00483 if (noInitialization != 0) {
00484 LOG(info) << "Base Joint Commutation with firmware 1.48";
00485 doInitialization.setParameter(true);
00486
00487 ethercatMaster.AutomaticReceiveOn(false);
00488 this->getBaseJoint(1).setConfigurationParameter(doInitialization);
00489 this->getBaseJoint(2).setConfigurationParameter(doInitialization);
00490 this->getBaseJoint(3).setConfigurationParameter(doInitialization);
00491 this->getBaseJoint(4).setConfigurationParameter(doInitialization);
00492 ethercatMaster.AutomaticReceiveOn(true);
00493
00494 unsigned int statusFlags;
00495 std::vector<bool> isCommutated;
00496 isCommutated.assign(BASEJOINTS, false);
00497 unsigned int u = 0;
00498
00499
00500 for (u = 1; u <= 5000; u++) {
00501 for (unsigned int i = 1; i <= BASEJOINTS; i++) {
00502 if(!ethercatMaster.isThreadActive()){
00503 ethercatMaster.sendProcessData();
00504 ethercatMaster.receiveProcessData();
00505 }
00506 this->getBaseJoint(i).getStatus(statusFlags);
00507 if (statusFlags & INITIALIZED) {
00508 isCommutated[i - 1] = true;
00509 }
00510 }
00511 if (isCommutated[0] && isCommutated[1] && isCommutated[2] && isCommutated[3]) {
00512 break;
00513 }
00514 SLEEP_MILLISEC(1);
00515 }
00516
00517 SLEEP_MILLISEC(10);
00518
00519 for (unsigned int i = 1; i <= BASEJOINTS; i++) {
00520 doInitialization.setParameter(false);
00521 this->getBaseJoint(i).getConfigurationParameter(doInitialization);
00522 doInitialization.getParameter(isInitialized);
00523 if (!isInitialized) {
00524 std::stringstream jointNameStream;
00525 jointNameStream << "base joint " << i;
00526 jointName = jointNameStream.str();
00527 throw std::runtime_error("Could not commutate " + jointName);
00528 }
00529 }
00530 }
00531
00532
00533
00534 }
00535
00536 void YouBotBase::initializeJoints() {
00537
00538
00539 LOG(trace) << "Initializing Joints";
00540
00541
00542 unsigned int noSlaves = ethercatMaster.getNumberOfSlaves();
00543
00544 if (noSlaves < BASEJOINTS) {
00545 throw std::out_of_range("Not enough ethercat slaves were found to create a YouBotBase!");
00546 }
00547
00548
00549
00550
00551
00552
00553 unsigned int slaveNumber = 0;
00554 configfile->readInto(slaveNumber, "JointTopology", "BaseLeftFront");
00555 if (slaveNumber <= noSlaves) {
00556 joints.push_back(new YouBotJoint(slaveNumber));
00557 } else {
00558 throw std::out_of_range("The ethercat slave number is not available!");
00559 }
00560
00561 configfile->readInto(slaveNumber, "JointTopology", "BaseRightFront");
00562 if (slaveNumber <= noSlaves) {
00563 joints.push_back(new YouBotJoint(slaveNumber));
00564 } else {
00565 throw std::out_of_range("The ethercat slave number is not available!");
00566 }
00567
00568 configfile->readInto(slaveNumber, "JointTopology", "BaseLeftBack");
00569 if (slaveNumber <= noSlaves) {
00570 joints.push_back(new YouBotJoint(slaveNumber));
00571 } else {
00572 throw std::out_of_range("The ethercat slave number is not available!");
00573 }
00574
00575 configfile->readInto(slaveNumber, "JointTopology", "BaseRightBack");
00576 if (slaveNumber <= noSlaves) {
00577 joints.push_back(new YouBotJoint(slaveNumber));
00578 } else {
00579 throw std::out_of_range("The ethercat slave number is not available!");
00580 }
00581
00582
00583
00584 std::string jointName;
00585 JointName jName;
00586 GearRatio gearRatio;
00587 EncoderTicksPerRound ticksPerRound;
00588 InverseMovementDirection inverseDir;
00589 FirmwareVersion firmwareTypeVersion;
00590 TorqueConstant torqueConst;
00591
00592 double trajectory_p=0, trajectory_i=0, trajectory_d=0, trajectory_imax=0, trajectory_imin=0;
00593 double gearRatio_numerator = 0;
00594 double gearRatio_denominator = 1;
00595 JointLimits jLimits;
00596
00597 for (unsigned int i = 0; i < BASEJOINTS; i++) {
00598 std::stringstream jointNameStream;
00599 jointNameStream << "Joint_" << i + 1;
00600 jointName = jointNameStream.str();
00601
00602
00603 joints[i].getConfigurationParameter(firmwareTypeVersion);
00604 std::string version;
00605 int controllerType;
00606 std::string firmwareVersion;
00607 firmwareTypeVersion.getParameter(controllerType, firmwareVersion);
00608
00609 string name;
00610 configfile->readInto(name, jointName, "JointName");
00611 jName.setParameter(name);
00612
00613 LOG(info) << name << "\t Controller Type: " << controllerType << " Firmware version: " << firmwareVersion;
00614
00615 if (this->controllerType != controllerType && alternativeControllerType != controllerType) {
00616 std::stringstream ss;
00617 ss << "The youBot base motor controller have to be of type: " << this->controllerType << " or " << alternativeControllerType;
00618 throw std::runtime_error(ss.str().c_str());
00619 }
00620
00621
00622 bool isfirmwareSupported = false;
00623 for(unsigned int d = 0; d < supportedFirmwareVersions.size(); d++){
00624 if(this->supportedFirmwareVersions[d] == firmwareVersion){
00625 isfirmwareSupported = true;
00626 break;
00627 }
00628 }
00629
00630 if(!isfirmwareSupported){
00631 throw std::runtime_error("Unsupported firmware version: "+ firmwareVersion);
00632 }
00633
00634 if(this->actualFirmwareVersionAllJoints == ""){
00635 this->actualFirmwareVersionAllJoints = firmwareVersion;
00636 }
00637
00638 if(!(firmwareVersion == this->actualFirmwareVersionAllJoints)){
00639 throw std::runtime_error("All joints must have the same firmware version!");
00640 }
00641
00642 configfile->readInto(gearRatio_numerator, jointName, "GearRatio_numerator");
00643 configfile->readInto(gearRatio_denominator, jointName, "GearRatio_denominator");
00644 gearRatio.setParameter(gearRatio_numerator / gearRatio_denominator);
00645 int ticks;
00646 configfile->readInto(ticks, jointName, "EncoderTicksPerRound");
00647 ticksPerRound.setParameter(ticks);
00648
00649 double torqueConstant;
00650 configfile->readInto(torqueConstant, jointName, "TorqueConstant_[newton_meter_divided_by_ampere]");
00651 torqueConst.setParameter(torqueConstant);
00652
00653 bool invdir = false;
00654 configfile->readInto(invdir, jointName, "InverseMovementDirection");
00655 inverseDir.setParameter(invdir);
00656
00657 joints[i].setConfigurationParameter(jName);
00658 joints[i].setConfigurationParameter(gearRatio);
00659 joints[i].setConfigurationParameter(ticksPerRound);
00660 joints[i].setConfigurationParameter(torqueConst);
00661 joints[i].setConfigurationParameter(inverseDir);
00662
00663 long upperlimit = 0, lowerlimit = 0;
00664 configfile->readInto(lowerlimit, jointName, "LowerLimit_[encoderTicks]");
00665 configfile->readInto(upperlimit, jointName, "UpperLimit_[encoderTicks]");
00666
00667 jLimits.setParameter(lowerlimit, upperlimit, false);
00668 joints[i].setConfigurationParameter(jLimits);
00669
00670
00671 if(ethercatMaster.isThreadActive()){
00672 configfile->readInto(trajectory_p, jointName, "trajectory_controller_P");
00673 configfile->readInto(trajectory_i, jointName, "trajectory_controller_I");
00674 configfile->readInto(trajectory_d, jointName, "trajectory_controller_D");
00675 configfile->readInto(trajectory_imax, jointName, "trajectory_controller_I_max");
00676 configfile->readInto(trajectory_imin, jointName, "trajectory_controller_I_min");
00677 joints[i].trajectoryController.setConfigurationParameter(trajectory_p, trajectory_i, trajectory_d, trajectory_imax, trajectory_imin);
00678 joints[i].trajectoryController.setEncoderTicksPerRound(ticks);
00679 joints[i].trajectoryController.setGearRatio(gearRatio_numerator / gearRatio_denominator);
00680 joints[i].trajectoryController.setInverseMovementDirection(invdir);
00681 ethercatMasterWithThread->registerJointTrajectoryController(&(joints[i].trajectoryController), joints[i].getJointNumber());
00682 }
00683 }
00684
00685 return;
00686
00687 }
00688
00689 void YouBotBase::initializeKinematic() {
00690
00691 FourSwedishWheelOmniBaseKinematicConfiguration kinematicConfig;
00692
00693
00694 configfile->readInto(kinematicConfig.rotationRatio, "YouBotKinematic", "RotationRatio");
00695 configfile->readInto(kinematicConfig.slideRatio, "YouBotKinematic", "SlideRatio");
00696 double dummy = 0;
00697 configfile->readInto(dummy, "YouBotKinematic", "LengthBetweenFrontAndRearWheels_[meter]");
00698 kinematicConfig.lengthBetweenFrontAndRearWheels = dummy * meter;
00699 configfile->readInto(dummy, "YouBotKinematic", "LengthBetweenFrontWheels_[meter]");
00700 kinematicConfig.lengthBetweenFrontWheels = dummy * meter;
00701 configfile->readInto(dummy, "YouBotKinematic", "WheelRadius_[meter]");
00702 kinematicConfig.wheelRadius = dummy * meter;
00703
00704
00705 youBotBaseKinematic.setConfiguration(kinematicConfig);
00706
00707 }
00708
00709
00710 }