DataTrace.cpp
Go to the documentation of this file.
00001 /****************************************************************
00002  *
00003  * Copyright (c) 2011
00004  * All rights reserved.
00005  *
00006  * Hochschule Bonn-Rhein-Sieg
00007  * University of Applied Sciences
00008  * Computer Science Department
00009  *
00010  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00011  *
00012  * Author:
00013  * Jan Paulus, Nico Hochgeschwender, Michael Reckhaus, Azamat Shakhimardanov
00014  * Supervised by:
00015  * Gerhard K. Kraetzschmar
00016  *
00017  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00018  *
00019  * This sofware is published under a dual-license: GNU Lesser General Public 
00020  * License LGPL 2.1 and BSD license. The dual-license implies that users of this
00021  * code may choose which terms they prefer.
00022  *
00023  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00024  *
00025  * Redistribution and use in source and binary forms, with or without
00026  * modification, are permitted provided that the following conditions are met:
00027  *
00028  *     * Redistributions of source code must retain the above copyright
00029  *       notice, this list of conditions and the following disclaimer.
00030  *     * Redistributions in binary form must reproduce the above copyright
00031  *       notice, this list of conditions and the following disclaimer in the
00032  *       documentation and/or other materials provided with the distribution.
00033  *     * Neither the name of the Hochschule Bonn-Rhein-Sieg nor the names of its
00034  *       contributors may be used to endorse or promote products derived from
00035  *       this software without specific prior written permission.
00036  *
00037  * This program is free software: you can redistribute it and/or modify
00038  * it under the terms of the GNU Lesser General Public License LGPL as
00039  * published by the Free Software Foundation, either version 2.1 of the
00040  * License, or (at your option) any later version or the BSD license.
00041  *
00042  * This program is distributed in the hope that it will be useful,
00043  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00044  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00045  * GNU Lesser General Public License LGPL and the BSD license for more details.
00046  *
00047  * You should have received a copy of the GNU Lesser General Public
00048  * License LGPL and BSD license along with this program.
00049  *
00050  ****************************************************************/
00051 #include <youbot_driver/youbot/DataTrace.hpp>
00052 namespace youbot
00053 {
00054 
00055 DataTrace::DataTrace(YouBotJoint& youBotJoint, const std::string Name, const bool overwriteFiles) :
00056     joint(youBotJoint)
00057 {
00058   // Bouml preserved body begin 000C8F71
00059 
00060   roundsPerMinuteSetpoint.rpm = 0;
00061   PWMSetpoint.pwm = 0;
00062   encoderSetpoint.encoderTicks = 0;
00063 
00064   InverseMovementDirection invertDirectionParameter;
00065   joint.getConfigurationParameter(invertDirectionParameter);
00066   bool inverted = false;
00067   invertDirectionParameter.getParameter(inverted);
00068   if (inverted)
00069   {
00070     invertDirection = -1;
00071   }
00072   else
00073   {
00074     invertDirection = 1;
00075   }
00076 
00077   this->name = Name;
00078   if (Name != "")
00079   {
00080     this->path = Name;
00081     this->path.append("/");
00082   }
00083   char input = 0;
00084 
00085   if (boost::filesystem::exists((path + "jointDataTrace").c_str()))
00086   {
00087     while (input != 'y' && input != 'n' && overwriteFiles == false)
00088     {
00089       std::cout << "Do you want to overwrite the existing files? [n/y]" << std::endl;
00090 
00091       input = getchar();
00092 
00093       if (input == 'n')
00094       {
00095         throw std::runtime_error("Will not overwrite files!");
00096       }
00097     }
00098 
00099   }
00100   else
00101   {
00102     boost::filesystem::path rootPath(this->path);
00103 
00104     if (!boost::filesystem::create_directories(rootPath))
00105       throw std::runtime_error("could not create folder!");
00106 
00107   }
00108 
00109   // Bouml preserved body end 000C8F71
00110 }
00111 
00112 DataTrace::~DataTrace()
00113 {
00114   // Bouml preserved body begin 000C8FF1
00115   // Bouml preserved body end 000C8FF1
00116 }
00117 
00118 void DataTrace::startTrace()
00119 {
00120   // Bouml preserved body begin 000C93F1
00121 
00122   timeDurationMicroSec = 0;
00123 
00124   file.open((path + "jointDataTrace").c_str(), std::fstream::out | std::fstream::trunc);
00125 
00126   ptime today;
00127   today = second_clock::local_time();
00128 
00129   file << "# Name: " << this->name << std::endl;
00130 
00131   file << "# Date: " << boost::posix_time::to_simple_string(today) << std::endl;
00132 
00133   JointName jointName;
00134   FirmwareVersion firmwareParameter;
00135   std::string parameterString;
00136   joint.getConfigurationParameter(firmwareParameter);
00137   joint.getConfigurationParameter(jointName);
00138   jointName.toString(parameterString);
00139   file << "# " << parameterString << std::endl;
00140   firmwareParameter.toString(parameterString);
00141   file << "# " << parameterString << std::endl;
00142 
00143   file << "# time [milliseconds]" << " " << "angle setpoint [rad]" << " " << "velocity setpoint [rad/s]" << " "
00144       << "RPM setpoint" << " " << "current setpoint [A]" << " " << "torque setpoint [Nm]" << " "
00145       << "ramp generator setpoint [rad/s]" << " " << "encoder setpoint"
00146 
00147       << " " << "sensed angle [rad]" << " " << "sensed encoder ticks" << " " << "sensed velocity [rad/s]" << " "
00148       << "sensed RPM" << " " << "sensed current [A]" << " " << "sensed torque [Nm]" << " " << "actual PWM"
00149 
00150       << " " << "OVER_CURRENT" << " " << "UNDER_VOLTAGE" << " " << "OVER_VOLTAGE" << " " << "OVER_TEMPERATURE" << " "
00151       << "MOTOR_HALTED" << " " << "HALL_SENSOR_ERROR" << " " << "PWM_MODE_ACTIVE" << " " << "VELOCITY_MODE" << " "
00152       << "POSITION_MODE" << " " << "TORQUE_MODE" << " " << "POSITION_REACHED" << " " << "INITIALIZED" << " "
00153       << "TIMEOUT" << " " << "I2T_EXCEEDED" << " " << std::endl;
00154 
00155   parametersBeginTraceFile.open((path + "ParametersAtBegin").c_str(), std::fstream::out | std::fstream::trunc);
00156 
00157   parameterVector.push_back(new ActualMotorVoltage);
00158   //   parameterVector.push_back(new ErrorAndStatus);
00159   parameterVector.push_back(new ActualMotorDriverTemperature);
00160   parameterVector.push_back(new I2tSum);
00161   parameterVector.push_back(new PositionError);
00162   parameterVector.push_back(new PositionErrorSum);
00163   parameterVector.push_back(new RampGeneratorSpeed);
00164   parameterVector.push_back(new VelocityError);
00165   parameterVector.push_back(new VelocityErrorSum);
00166   //   parameterVector.push_back(new CalibrateJoint);
00167   parameterVector.push_back(new DParameterFirstParametersPositionControl);
00168   parameterVector.push_back(new DParameterFirstParametersSpeedControl);
00169   parameterVector.push_back(new DParameterCurrentControl);
00170   parameterVector.push_back(new DParameterSecondParametersPositionControl);
00171   parameterVector.push_back(new DParameterSecondParametersSpeedControl);
00172 
00173   parameterVector.push_back(new IClippingParameterFirstParametersPositionControl);
00174   parameterVector.push_back(new IClippingParameterFirstParametersSpeedControl);
00175   parameterVector.push_back(new IClippingParameterCurrentControl);
00176   parameterVector.push_back(new IClippingParameterSecondParametersPositionControl);
00177   parameterVector.push_back(new IClippingParameterSecondParametersSpeedControl);
00178   //    parameterVector.push_back(new InitializeJoint);
00179 
00180   parameterVector.push_back(new IParameterFirstParametersPositionControl);
00181   parameterVector.push_back(new IParameterFirstParametersSpeedControl);
00182   parameterVector.push_back(new IParameterCurrentControl);
00183   parameterVector.push_back(new IParameterSecondParametersPositionControl);
00184   parameterVector.push_back(new IParameterSecondParametersSpeedControl);
00185 
00186   parameterVector.push_back(new MaximumPositioningVelocity);
00187   parameterVector.push_back(new MotorAcceleration);
00188   parameterVector.push_back(new PositionControlSwitchingThreshold);
00189   parameterVector.push_back(new PParameterFirstParametersPositionControl);
00190   parameterVector.push_back(new PParameterFirstParametersSpeedControl);
00191   parameterVector.push_back(new PParameterCurrentControl);
00192   parameterVector.push_back(new PParameterSecondParametersPositionControl);
00193   parameterVector.push_back(new PParameterSecondParametersSpeedControl);
00194   parameterVector.push_back(new RampGeneratorSpeedAndPositionControl);
00195   parameterVector.push_back(new SpeedControlSwitchingThreshold);
00196 
00197   parameterVector.push_back(new ActivateOvervoltageProtection);
00198   parameterVector.push_back(new ActualCommutationOffset);
00199   //   parameterVector.push_back(new ApproveProtectedParameters);
00200   parameterVector.push_back(new BEMFConstant);
00201   //   parameterVector.push_back(new ClearI2tExceededFlag);
00202   //   parameterVector.push_back(new ClearMotorControllerTimeoutFlag);
00203   parameterVector.push_back(new CommutationMode);
00204   parameterVector.push_back(new CommutationMotorCurrent);
00205   parameterVector.push_back(new CurrentControlLoopDelay);
00206   parameterVector.push_back(new EncoderResolution);
00207   parameterVector.push_back(new EncoderStopSwitch);
00208   parameterVector.push_back(new HallSensorPolarityReversal);
00209   parameterVector.push_back(new I2tExceedCounter);
00210   parameterVector.push_back(new I2tLimit);
00211   parameterVector.push_back(new InitializationMode);
00212   parameterVector.push_back(new InitSineDelay);
00213   parameterVector.push_back(new MassInertiaConstant);
00214   parameterVector.push_back(new MaximumMotorCurrent);
00215   parameterVector.push_back(new MaximumVelocityToSetPosition);
00216   parameterVector.push_back(new MotorCoilResistance);
00217   parameterVector.push_back(new MotorControllerTimeout);
00218   parameterVector.push_back(new MotorPoles);
00219   parameterVector.push_back(new OperationalTime);
00220   parameterVector.push_back(new PIDControlTime);
00221   parameterVector.push_back(new PositionTargetReachedDistance);
00222   parameterVector.push_back(new ReversingEncoderDirection);
00223   parameterVector.push_back(new SetEncoderCounterZeroAtNextNChannel);
00224   parameterVector.push_back(new SetEncoderCounterZeroAtNextSwitch);
00225   parameterVector.push_back(new SetEncoderCounterZeroOnlyOnce);
00226   parameterVector.push_back(new SineInitializationVelocity);
00227   parameterVector.push_back(new StopSwitchPolarity);
00228   parameterVector.push_back(new ThermalWindingTimeConstant);
00229   parameterVector.push_back(new VelocityThresholdForHallFX);
00230   parameterVector.push_back(new MotorHaltedVelocity);
00231 
00232 //    apiParameterVector.push_back(new JointName);
00233 //    apiParameterVector.push_back(new TorqueConstant);
00234 //    apiParameterVector.push_back(new JointLimits);
00235 //    apiParameterVector.push_back(new GearRatio);
00236 //    apiParameterVector.push_back(new EncoderTicksPerRound);
00237 //    apiParameterVector.push_back(new InverseMovementDirection);
00238 
00239 //    for (int i = 0; i < apiParameterVector.size(); i++) {
00240 //      joint.getConfigurationParameter(*(apiParameterVector[i]));
00241 //      apiParameterVector[i]->toString(parameterString);
00242 //      //   std::cout << parameterString << std::endl;
00243 //      parametersBeginTraceFile << parameterString << std::endl;
00244 //    }
00245 
00246   parametersBeginTraceFile << "Name: " << this->name << std::endl;
00247   parametersBeginTraceFile << "Date: " << boost::posix_time::to_simple_string(today) << std::endl;
00248   //  joint.getConfigurationParameter(jointName);
00249   jointName.toString(parameterString);
00250   //   std::cout << parameterString << std::endl;
00251   parametersBeginTraceFile << parameterString << std::endl;
00252   firmwareParameter.toString(parameterString);
00253   parametersBeginTraceFile << parameterString << std::endl;
00254 
00255   TorqueConstant torqueconst;
00256   joint.getConfigurationParameter(torqueconst);
00257   torqueconst.toString(parameterString);
00258   //   std::cout << parameterString << std::endl;
00259   parametersBeginTraceFile << parameterString << std::endl;
00260 
00261   JointLimits jointLimits;
00262   joint.getConfigurationParameter(jointLimits);
00263   jointLimits.toString(parameterString);
00264   //   std::cout << parameterString << std::endl;
00265   parametersBeginTraceFile << parameterString << std::endl;
00266 
00267   EncoderTicksPerRound encoderTicksPerRound;
00268   joint.getConfigurationParameter(encoderTicksPerRound);
00269   encoderTicksPerRound.toString(parameterString);
00270   //   std::cout << parameterString << std::endl;
00271   parametersBeginTraceFile << parameterString << std::endl;
00272 
00273   GearRatio gearRatio;
00274   joint.getConfigurationParameter(gearRatio);
00275   gearRatio.toString(parameterString);
00276   //   std::cout << parameterString << std::endl;
00277   parametersBeginTraceFile << parameterString << std::endl;
00278 
00279   InverseMovementDirection inverseMovementDirection;
00280   joint.getConfigurationParameter(inverseMovementDirection);
00281   inverseMovementDirection.toString(parameterString);
00282   //   std::cout << parameterString << std::endl;
00283   parametersBeginTraceFile << parameterString << std::endl;
00284 
00285   for (unsigned int i = 0; i < parameterVector.size(); i++)
00286   {
00287     joint.getConfigurationParameter(*(parameterVector[i]));
00288     parameterVector[i]->toString(parameterString);
00289     //   std::cout << parameterString << std::endl;
00290     parametersBeginTraceFile << parameterString << std::endl;
00291   }
00292   parametersBeginTraceFile.close();
00293 
00294   traceStartTime = microsec_clock::local_time();
00295   // Bouml preserved body end 000C93F1
00296 }
00297 
00298 void DataTrace::stopTrace()
00299 {
00300   // Bouml preserved body begin 000C9471
00301   file.close();
00302 
00303   parametersEndTraceFile.open((path + "ParametersAfterTrace").c_str(), std::fstream::out | std::fstream::trunc);
00304   std::string parameterString;
00305 
00306   parametersEndTraceFile << "Name: " << this->name << std::endl;
00307   ptime today;
00308   today = second_clock::local_time();
00309   parametersEndTraceFile << "Date: " << boost::posix_time::to_simple_string(today) << std::endl;
00310 
00311   JointName jointName;
00312   joint.getConfigurationParameter(jointName);
00313   jointName.toString(parameterString);
00314   //   std::cout << parameterString << std::endl;
00315   parametersEndTraceFile << parameterString << std::endl;
00316 
00317   FirmwareVersion firmwareParameter;
00318   joint.getConfigurationParameter(firmwareParameter);
00319   firmwareParameter.toString(parameterString);
00320   parametersEndTraceFile << parameterString << std::endl;
00321 
00322   TorqueConstant torqueconst;
00323   joint.getConfigurationParameter(torqueconst);
00324   torqueconst.toString(parameterString);
00325   //   std::cout << parameterString << std::endl;
00326   parametersEndTraceFile << parameterString << std::endl;
00327 
00328   JointLimits jointLimits;
00329   joint.getConfigurationParameter(jointLimits);
00330   jointLimits.toString(parameterString);
00331   //   std::cout << parameterString << std::endl;
00332   parametersEndTraceFile << parameterString << std::endl;
00333 
00334   EncoderTicksPerRound encoderTicksPerRound;
00335   joint.getConfigurationParameter(encoderTicksPerRound);
00336   encoderTicksPerRound.toString(parameterString);
00337   //   std::cout << parameterString << std::endl;
00338   parametersEndTraceFile << parameterString << std::endl;
00339 
00340   GearRatio gearRatio;
00341   joint.getConfigurationParameter(gearRatio);
00342   gearRatio.toString(parameterString);
00343   //   std::cout << parameterString << std::endl;
00344   parametersEndTraceFile << parameterString << std::endl;
00345 
00346   InverseMovementDirection inverseMovementDirection;
00347   joint.getConfigurationParameter(inverseMovementDirection);
00348   inverseMovementDirection.toString(parameterString);
00349   //   std::cout << parameterString << std::endl;
00350   parametersEndTraceFile << parameterString << std::endl;
00351 
00352   for (unsigned int i = 0; i < parameterVector.size(); i++)
00353   {
00354     joint.getConfigurationParameter(*(parameterVector[i]));
00355     parameterVector[i]->toString(parameterString);
00356     parametersEndTraceFile << parameterString << std::endl;
00357     delete parameterVector[i];
00358   }
00359 
00360   parametersEndTraceFile.close();
00361   // Bouml preserved body end 000C9471
00362 }
00363 
00364 void DataTrace::plotTrace()
00365 {
00366   // Bouml preserved body begin 000C9571
00367 
00368   std::string executeString = "cd ";
00369   executeString.append(path);
00370   executeString.append("; gnuplot ../../gnuplotconfig > /dev/null 2>&1");
00371   if (!std::system(executeString.c_str()))
00372   {
00373     //complain
00374   }
00375   // Bouml preserved body end 000C9571
00376 }
00377 
00378 void DataTrace::updateTrace(const JointAngleSetpoint& setpoint)
00379 {
00380   // Bouml preserved body begin 000C9071
00381   angleSetpoint = setpoint;
00382   controllerMode = POSITION_CONTROL_RAD;
00383   this->update();
00384   // Bouml preserved body end 000C9071
00385 }
00386 
00387 void DataTrace::updateTrace(const JointVelocitySetpoint& setpoint)
00388 {
00389   // Bouml preserved body begin 000C90F1
00390   velocitySetpoint = setpoint;
00391   controllerMode = VELOCITY_CONTROL_RAD_SEC;
00392   this->update();
00393   // Bouml preserved body end 000C90F1
00394 }
00395 
00396 void DataTrace::updateTrace(const JointRoundsPerMinuteSetpoint& setpoint)
00397 {
00398   // Bouml preserved body begin 000C9171
00399   roundsPerMinuteSetpoint = setpoint;
00400   controllerMode = VELOCITY_CONTROL_RPM;
00401   this->update();
00402   // Bouml preserved body end 000C9171
00403 }
00404 
00405 void DataTrace::updateTrace(const JointCurrentSetpoint& setpoint)
00406 {
00407   // Bouml preserved body begin 000C91F1
00408   currentSetpoint = setpoint;
00409   controllerMode = CURRENT_CONTROL_MODE;
00410   this->update();
00411   // Bouml preserved body end 000C91F1
00412 }
00413 
00414 void DataTrace::updateTrace(const JointTorqueSetpoint& setpoint)
00415 {
00416   // Bouml preserved body begin 000C9271
00417   torqueSetpoint = setpoint;
00418   controllerMode = TORQUE_CONTROL_MODE;
00419   this->update();
00420   // Bouml preserved body end 000C9271
00421 }
00422 
00423 void DataTrace::updateTrace(const JointEncoderSetpoint& setpoint)
00424 {
00425   // Bouml preserved body begin 000C9371
00426   encoderSetpoint = setpoint;
00427   controllerMode = POSITION_CONTROL_ENC;
00428   this->update();
00429   // Bouml preserved body end 000C9371
00430 }
00431 
00432 void DataTrace::updateTrace()
00433 {
00434   // Bouml preserved body begin 000EEC71
00435   YouBotSlaveMsg message;
00436   joint.getData(message);
00437   switch (message.stctOutput.controllerMode)
00438   {
00439     case MOTOR_STOP:
00440       controllerMode = NOT_DEFINED;
00441       break;
00442     case POSITION_CONTROL:
00443       encoderSetpoint.encoderTicks = message.stctOutput.value * invertDirection;
00444       controllerMode = POSITION_CONTROL_ENC;
00445       break;
00446     case VELOCITY_CONTROL:
00447       roundsPerMinuteSetpoint.rpm = message.stctOutput.value * invertDirection;
00448       controllerMode = VELOCITY_CONTROL_RPM;
00449       break;
00450     case NO_MORE_ACTION:
00451       controllerMode = NOT_DEFINED;
00452       break;
00453     case SET_POSITION_TO_REFERENCE:
00454       controllerMode = NOT_DEFINED;
00455       break;
00456     case CURRENT_MODE:
00457       currentSetpoint.current = (double)message.stctOutput.value / 1000.0 * invertDirection * ampere;
00458       controllerMode = CURRENT_CONTROL_MODE;
00459       break;
00460     default:
00461       controllerMode = NOT_DEFINED;
00462       break;
00463   };
00464 
00465   this->update();
00466   // Bouml preserved body end 000EEC71
00467 }
00468 
00469 unsigned long DataTrace::getTimeDurationMilliSec()
00470 {
00471   // Bouml preserved body begin 000DCFF1
00472   return timeDurationMicroSec;
00473   // Bouml preserved body end 000DCFF1
00474 }
00475 
00476 void DataTrace::update()
00477 {
00478   // Bouml preserved body begin 000C94F1
00479   timeDuration = microsec_clock::local_time() - traceStartTime;
00480   timeDurationMicroSec = timeDuration.total_milliseconds();
00481   unsigned int statusFlags;
00482   joint.getStatus(statusFlags);
00483   joint.getData(sensedAngle);
00484   joint.getData(sensedEncoderTicks);
00485   joint.getData(sensedVelocity);
00486   joint.getData(sensedRoundsPerMinute);
00487   joint.getData(sensedCurrent);
00488   joint.getData(sensedTorque);
00489   joint.getData(targetAngle);
00490   joint.getData(targetVelocity);
00491   joint.getData(targetCurrent);
00492   joint.getData(rampGenSetpoint);
00493 
00494   std::stringstream angleSet, angleEncSet, velSet, velRPMSet, currentSet, pwmSet, torqueSet;
00495 
00496   switch (controllerMode)
00497   {
00498     case POSITION_CONTROL_RAD:
00499       angleSet << angleSetpoint.angle.value();
00500       angleEncSet << "NaN";
00501       velSet << targetVelocity.angularVelocity.value();
00502       velRPMSet << "NaN";
00503       currentSet << targetCurrent.current.value();
00504       pwmSet << "NaN";
00505       torqueSet << "NaN";
00506       break;
00507     case POSITION_CONTROL_ENC:
00508       angleSet << "NaN";
00509       angleEncSet << encoderSetpoint.encoderTicks;
00510       velSet << targetVelocity.angularVelocity.value();
00511       velRPMSet << "NaN";
00512       currentSet << targetCurrent.current.value();
00513       pwmSet << "NaN";
00514       torqueSet << "NaN";
00515       break;
00516     case VELOCITY_CONTROL_RAD_SEC:
00517       angleSet << "NaN";
00518       angleEncSet << "NaN";
00519       velSet << velocitySetpoint.angularVelocity.value();
00520       velRPMSet << "NaN";
00521       currentSet << targetCurrent.current.value();
00522       pwmSet << "NaN";
00523       torqueSet << "NaN";
00524       break;
00525     case VELOCITY_CONTROL_RPM:
00526       angleSet << "NaN";
00527       angleEncSet << "NaN";
00528       velSet << "NaN";
00529       velRPMSet << roundsPerMinuteSetpoint.rpm;
00530       currentSet << targetCurrent.current.value();
00531       pwmSet << "NaN";
00532       torqueSet << "NaN";
00533       break;
00534     case CURRENT_CONTROL_MODE:
00535       angleSet << "NaN";
00536       angleEncSet << "NaN";
00537       velSet << "NaN";
00538       velRPMSet << "NaN";
00539       currentSet << currentSetpoint.current.value();
00540       pwmSet << "NaN";
00541       torqueSet << "NaN";
00542       break;
00543     case TORQUE_CONTROL_MODE:
00544       angleSet << "NaN";
00545       angleEncSet << "NaN";
00546       velSet << "NaN";
00547       velRPMSet << "NaN";
00548       currentSet << "NaN";
00549       pwmSet << "NaN";
00550       torqueSet << torqueSetpoint.torque.value();
00551       break;
00552     case NOT_DEFINED:
00553       angleSet << "NaN";
00554       angleEncSet << "NaN";
00555       velSet << "NaN";
00556       velRPMSet << "NaN";
00557       currentSet << "NaN";
00558       pwmSet << "NaN";
00559       torqueSet << "NaN";
00560       break;
00561   };
00562 
00563   file << timeDurationMicroSec //1
00564       << " " << angleSet.str() //2
00565       << " " << velSet.str() //3
00566       << " " << velRPMSet.str() //4
00567       << " " << currentSet.str() //5
00568       << " " << torqueSet.str() //6
00569       << " " << rampGenSetpoint.angularVelocity.value() //7
00570       << " " << angleEncSet.str() //8
00571 
00572       << " " << sensedAngle.angle.value() //9
00573       << " " << sensedEncoderTicks.encoderTicks //10
00574       << " " << sensedVelocity.angularVelocity.value() //11
00575       << " " << sensedRoundsPerMinute.rpm //12
00576       << " " << sensedCurrent.current.value() //13
00577       << " " << sensedTorque.torque.value() //14
00578       << " " << "0" //15  //dummy has been pwm
00579 
00580       << " " << bool(statusFlags & OVER_CURRENT) << " " //16
00581       << bool(statusFlags & UNDER_VOLTAGE) << " " //17
00582       << bool(statusFlags & OVER_VOLTAGE) << " " //18
00583       << bool(statusFlags & OVER_TEMPERATURE) << " " //19
00584       << bool(statusFlags & MOTOR_HALTED) << " " //20
00585       << bool(statusFlags & HALL_SENSOR_ERROR) << " " //21
00586       << "0" << " " //22 //dummy has been pwm
00587       << bool(statusFlags & VELOCITY_MODE) << " " //23
00588       << bool(statusFlags & POSITION_MODE) << " " //24
00589       << bool(statusFlags & TORQUE_MODE) << " " //25
00590       << bool(statusFlags & POSITION_REACHED) << " " //26
00591       << bool(statusFlags & INITIALIZED) << " " //27
00592       << bool(statusFlags & TIMEOUT) << " " //28
00593       << bool(statusFlags & I2T_EXCEEDED) //29
00594       << std::endl;
00595 
00596   // Bouml preserved body end 000C94F1
00597 }
00598 
00599 } // namespace youbot


youbot_driver
Author(s): Jan Paulus
autogenerated on Mon Oct 6 2014 09:08:01