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/DataTrace.hpp"
00052 namespace youbot {
00053 
00054 DataTrace::DataTrace(YouBotJoint& youBotJoint, const std::string Name, const bool overwriteFiles):joint(youBotJoint) {
00055   // Bouml preserved body begin 000C8F71
00056 
00057     roundsPerMinuteSetpoint.rpm = 0;
00058     PWMSetpoint.pwm = 0;
00059     encoderSetpoint.encoderTicks = 0;
00060     
00061     InverseMovementDirection invertDirectionParameter;
00062     joint.getConfigurationParameter(invertDirectionParameter);
00063     bool inverted = false;
00064     invertDirectionParameter.getParameter(inverted);
00065     if(inverted){
00066       invertDirection = -1;
00067     }else{
00068       invertDirection = 1;
00069     }
00070     
00071     this->name = Name;
00072     if(Name != ""){
00073       this->path = Name;
00074       this->path.append("/");
00075     }
00076     char input = 0;
00077     
00078     if(boost::filesystem::exists((path+"jointDataTrace").c_str())){
00079       while(input != 'y' && input != 'n' && overwriteFiles == false){
00080         std::cout << "Do you want to overwrite the existing files? [n/y]" << std::endl; 
00081 
00082         input = getchar();
00083 
00084         if(input == 'n'){
00085           throw std::runtime_error("Will not overwrite files!");
00086         }
00087       }
00088 
00089     }else{
00090       boost::filesystem::path rootPath (this->path);
00091 
00092       if ( !boost::filesystem::create_directories( rootPath ))
00093         throw std::runtime_error("could not create folder!");
00094       
00095     }
00096     
00097   // Bouml preserved body end 000C8F71
00098 }
00099 
00100 DataTrace::~DataTrace() {
00101   // Bouml preserved body begin 000C8FF1
00102   // Bouml preserved body end 000C8FF1
00103 }
00104 
00105 void DataTrace::startTrace() {
00106   // Bouml preserved body begin 000C93F1
00107 
00108     timeDurationMicroSec = 0;
00109     
00110    
00111     file.open((path+"jointDataTrace").c_str(), std::fstream::out | std::fstream::trunc);
00112     
00113     ptime today;
00114     today = second_clock::local_time();
00115     
00116     file << "# Name: " << this->name << std::endl;
00117     
00118     file << "# Date: " << boost::posix_time::to_simple_string(today) << std::endl;
00119     
00120     JointName jointName;
00121     FirmwareVersion firmwareParameter;
00122     std::string parameterString;
00123     joint.getConfigurationParameter(firmwareParameter);
00124     joint.getConfigurationParameter(jointName);
00125     jointName.toString(parameterString);
00126     file << "# " << parameterString << std::endl;
00127     firmwareParameter.toString(parameterString);
00128     file << "# " << parameterString << std::endl;
00129     
00130     
00131     file << "# time [milliseconds]"
00132             << " " << "angle setpoint [rad]"
00133             << " " << "velocity setpoint [rad/s]"
00134             << " " << "RPM setpoint"
00135             << " " << "current setpoint [A]"
00136             << " " << "torque setpoint [Nm]"
00137             << " " << "ramp generator setpoint [rad/s]"
00138             << " " << "encoder setpoint"
00139 
00140             << " " << "sensed angle [rad]"
00141             << " " << "sensed encoder ticks"
00142             << " " << "sensed velocity [rad/s]"
00143             << " " << "sensed RPM"
00144             << " " << "sensed current [A]"
00145             << " " << "sensed torque [Nm]"
00146             << " " << "actual PWM"
00147 
00148             << " " << "OVER_CURRENT" << " "
00149             << "UNDER_VOLTAGE" << " "
00150             << "OVER_VOLTAGE" << " "
00151             << "OVER_TEMPERATURE" << " "
00152             << "MOTOR_HALTED" << " "
00153             << "HALL_SENSOR_ERROR" << " "
00154             << "PWM_MODE_ACTIVE" << " "
00155             << "VELOCITY_MODE" << " "
00156             << "POSITION_MODE" << " "
00157             << "TORQUE_MODE" << " "
00158             << "POSITION_REACHED" << " "
00159             << "INITIALIZED" << " "
00160             << "TIMEOUT" << " "
00161             << "I2T_EXCEEDED" << " "
00162             << std::endl;
00163 
00164     parametersBeginTraceFile.open((path+"ParametersAtBegin").c_str(), std::fstream::out | std::fstream::trunc);
00165     
00166 
00167 
00168     parameterVector.push_back(new ActualMotorVoltage);
00169     //   parameterVector.push_back(new ErrorAndStatus);
00170     parameterVector.push_back(new ActualMotorDriverTemperature);
00171     parameterVector.push_back(new I2tSum);
00172     parameterVector.push_back(new PositionError);
00173     parameterVector.push_back(new PositionErrorSum);
00174     parameterVector.push_back(new RampGeneratorSpeed);
00175     parameterVector.push_back(new VelocityError);
00176     parameterVector.push_back(new VelocityErrorSum);
00177     //   parameterVector.push_back(new CalibrateJoint);
00178     parameterVector.push_back(new DParameterFirstParametersPositionControl);
00179     parameterVector.push_back(new DParameterFirstParametersSpeedControl);
00180     parameterVector.push_back(new DParameterCurrentControl);
00181     parameterVector.push_back(new DParameterSecondParametersPositionControl);
00182     parameterVector.push_back(new DParameterSecondParametersSpeedControl);
00183 
00184     parameterVector.push_back(new IClippingParameterFirstParametersPositionControl);
00185     parameterVector.push_back(new IClippingParameterFirstParametersSpeedControl);
00186     parameterVector.push_back(new IClippingParameterCurrentControl);
00187     parameterVector.push_back(new IClippingParameterSecondParametersPositionControl);
00188     parameterVector.push_back(new IClippingParameterSecondParametersSpeedControl);
00189     //    parameterVector.push_back(new InitializeJoint);
00190     
00191     parameterVector.push_back(new IParameterFirstParametersPositionControl);
00192     parameterVector.push_back(new IParameterFirstParametersSpeedControl);
00193     parameterVector.push_back(new IParameterCurrentControl);
00194     parameterVector.push_back(new IParameterSecondParametersPositionControl);
00195     parameterVector.push_back(new IParameterSecondParametersSpeedControl);
00196 
00197     parameterVector.push_back(new MaximumPositioningVelocity);
00198     parameterVector.push_back(new MotorAcceleration);
00199     parameterVector.push_back(new PositionControlSwitchingThreshold);
00200     parameterVector.push_back(new PParameterFirstParametersPositionControl);
00201     parameterVector.push_back(new PParameterFirstParametersSpeedControl);
00202     parameterVector.push_back(new PParameterCurrentControl);
00203     parameterVector.push_back(new PParameterSecondParametersPositionControl);
00204     parameterVector.push_back(new PParameterSecondParametersSpeedControl);
00205     parameterVector.push_back(new RampGeneratorSpeedAndPositionControl);
00206     parameterVector.push_back(new SpeedControlSwitchingThreshold);
00207 
00208     parameterVector.push_back(new ActivateOvervoltageProtection);
00209     parameterVector.push_back(new ActualCommutationOffset);
00210     //   parameterVector.push_back(new ApproveProtectedParameters);
00211     parameterVector.push_back(new BEMFConstant);
00212     //   parameterVector.push_back(new ClearI2tExceededFlag);
00213     //   parameterVector.push_back(new ClearMotorControllerTimeoutFlag);
00214     parameterVector.push_back(new CommutationMode);
00215     parameterVector.push_back(new CommutationMotorCurrent);
00216     parameterVector.push_back(new CurrentControlLoopDelay);
00217     parameterVector.push_back(new EncoderResolution);
00218     parameterVector.push_back(new EncoderStopSwitch);
00219     parameterVector.push_back(new HallSensorPolarityReversal);
00220     parameterVector.push_back(new I2tExceedCounter);
00221     parameterVector.push_back(new I2tLimit);
00222     parameterVector.push_back(new InitializationMode);
00223     parameterVector.push_back(new InitSineDelay);
00224     parameterVector.push_back(new MassInertiaConstant);
00225     parameterVector.push_back(new MaximumMotorCurrent);
00226     parameterVector.push_back(new MaximumVelocityToSetPosition);
00227     parameterVector.push_back(new MotorCoilResistance);
00228     parameterVector.push_back(new MotorControllerTimeout);
00229     parameterVector.push_back(new MotorPoles);
00230     parameterVector.push_back(new OperationalTime);
00231     parameterVector.push_back(new PIDControlTime);
00232     parameterVector.push_back(new PositionTargetReachedDistance);
00233     parameterVector.push_back(new ReversingEncoderDirection);
00234     parameterVector.push_back(new SetEncoderCounterZeroAtNextNChannel);
00235     parameterVector.push_back(new SetEncoderCounterZeroAtNextSwitch);
00236     parameterVector.push_back(new SetEncoderCounterZeroOnlyOnce);
00237     parameterVector.push_back(new SineInitializationVelocity);
00238     parameterVector.push_back(new StopSwitchPolarity);
00239     parameterVector.push_back(new ThermalWindingTimeConstant);
00240     parameterVector.push_back(new VelocityThresholdForHallFX);
00241     parameterVector.push_back(new MotorHaltedVelocity);
00242 
00243 //    apiParameterVector.push_back(new JointName);
00244 //    apiParameterVector.push_back(new TorqueConstant);
00245 //    apiParameterVector.push_back(new JointLimits);
00246 //    apiParameterVector.push_back(new GearRatio);
00247 //    apiParameterVector.push_back(new EncoderTicksPerRound);
00248 //    apiParameterVector.push_back(new InverseMovementDirection);
00249 
00250 //    for (int i = 0; i < apiParameterVector.size(); i++) {
00251 //      joint.getConfigurationParameter(*(apiParameterVector[i]));
00252 //      apiParameterVector[i]->toString(parameterString);
00253 //      //   std::cout << parameterString << std::endl;
00254 //      parametersBeginTraceFile << parameterString << std::endl;
00255 //    }
00256 
00257 
00258     parametersBeginTraceFile << "Name: " << this->name << std::endl;
00259     parametersBeginTraceFile << "Date: " << boost::posix_time::to_simple_string(today) << std::endl;
00260   //  joint.getConfigurationParameter(jointName);
00261     jointName.toString(parameterString);
00262     //   std::cout << parameterString << std::endl;
00263     parametersBeginTraceFile << parameterString << std::endl;
00264     firmwareParameter.toString(parameterString);
00265     parametersBeginTraceFile << parameterString << std::endl;
00266 
00267     TorqueConstant torqueconst;
00268     joint.getConfigurationParameter(torqueconst);
00269     torqueconst.toString(parameterString);
00270     //   std::cout << parameterString << std::endl;
00271     parametersBeginTraceFile << parameterString << std::endl;
00272 
00273     JointLimits jointLimits;
00274     joint.getConfigurationParameter(jointLimits);
00275     jointLimits.toString(parameterString);
00276     //   std::cout << parameterString << std::endl;
00277     parametersBeginTraceFile << parameterString << std::endl;
00278 
00279     EncoderTicksPerRound encoderTicksPerRound;
00280     joint.getConfigurationParameter(encoderTicksPerRound);
00281     encoderTicksPerRound.toString(parameterString);
00282     //   std::cout << parameterString << std::endl;
00283     parametersBeginTraceFile << parameterString << std::endl;
00284 
00285     GearRatio gearRatio;
00286     joint.getConfigurationParameter(gearRatio);
00287     gearRatio.toString(parameterString);
00288     //   std::cout << parameterString << std::endl;
00289     parametersBeginTraceFile << parameterString << std::endl;
00290     
00291     InverseMovementDirection inverseMovementDirection;
00292     joint.getConfigurationParameter(inverseMovementDirection);
00293     inverseMovementDirection.toString(parameterString);
00294     //   std::cout << parameterString << std::endl;
00295     parametersBeginTraceFile << parameterString << std::endl;
00296     
00297     
00298     for (unsigned int i = 0; i < parameterVector.size(); i++) {
00299       joint.getConfigurationParameter(*(parameterVector[i]));
00300       parameterVector[i]->toString(parameterString);
00301       //   std::cout << parameterString << std::endl;
00302       parametersBeginTraceFile << parameterString << std::endl;
00303     }
00304     parametersBeginTraceFile.close();
00305 
00306 
00307     traceStartTime = microsec_clock::local_time();
00308   // Bouml preserved body end 000C93F1
00309 }
00310 
00311 void DataTrace::stopTrace() {
00312   // Bouml preserved body begin 000C9471
00313     file.close();
00314 
00315     parametersEndTraceFile.open((path+"ParametersAfterTrace").c_str(), std::fstream::out | std::fstream::trunc);
00316     std::string parameterString;
00317     
00318     parametersEndTraceFile << "Name: " << this->name << std::endl;
00319     ptime today;
00320     today = second_clock::local_time();
00321     parametersEndTraceFile << "Date: " << boost::posix_time::to_simple_string(today) << std::endl;
00322     
00323         JointName jointName;
00324     joint.getConfigurationParameter(jointName);
00325     jointName.toString(parameterString);
00326     //   std::cout << parameterString << std::endl;
00327     parametersEndTraceFile << parameterString << std::endl;
00328     
00329     FirmwareVersion firmwareParameter;
00330     joint.getConfigurationParameter(firmwareParameter);
00331     firmwareParameter.toString(parameterString);
00332     parametersEndTraceFile << parameterString << std::endl;
00333 
00334     TorqueConstant torqueconst;
00335     joint.getConfigurationParameter(torqueconst);
00336     torqueconst.toString(parameterString);
00337     //   std::cout << parameterString << std::endl;
00338     parametersEndTraceFile << parameterString << std::endl;
00339 
00340     JointLimits jointLimits;
00341     joint.getConfigurationParameter(jointLimits);
00342     jointLimits.toString(parameterString);
00343     //   std::cout << parameterString << std::endl;
00344     parametersEndTraceFile << parameterString << std::endl;
00345 
00346     EncoderTicksPerRound encoderTicksPerRound;
00347     joint.getConfigurationParameter(encoderTicksPerRound);
00348     encoderTicksPerRound.toString(parameterString);
00349     //   std::cout << parameterString << std::endl;
00350     parametersEndTraceFile << parameterString << std::endl;
00351 
00352     GearRatio gearRatio;
00353     joint.getConfigurationParameter(gearRatio);
00354     gearRatio.toString(parameterString);
00355     //   std::cout << parameterString << std::endl;
00356     parametersEndTraceFile << parameterString << std::endl;
00357     
00358     InverseMovementDirection inverseMovementDirection;
00359     joint.getConfigurationParameter(inverseMovementDirection);
00360     inverseMovementDirection.toString(parameterString);
00361     //   std::cout << parameterString << std::endl;
00362     parametersEndTraceFile << parameterString << std::endl;
00363     
00364     for (unsigned int i = 0; i < parameterVector.size(); i++) {
00365       joint.getConfigurationParameter(*(parameterVector[i]));
00366       parameterVector[i]->toString(parameterString);
00367       parametersEndTraceFile << parameterString << std::endl;
00368       delete parameterVector[i];
00369     }
00370     
00371     
00372     parametersEndTraceFile.close();
00373   // Bouml preserved body end 000C9471
00374 }
00375 
00376 void DataTrace::plotTrace() {
00377   // Bouml preserved body begin 000C9571
00378   
00379     std::string executeString = "cd ";
00380     executeString.append(path);
00381     executeString.append("; gnuplot ../../gnuplotconfig > /dev/null 2>&1");
00382     std::system(executeString.c_str());
00383   // Bouml preserved body end 000C9571
00384 }
00385 
00386 void DataTrace::updateTrace(const JointAngleSetpoint& setpoint) {
00387   // Bouml preserved body begin 000C9071
00388     angleSetpoint = setpoint;
00389     controllerMode = POSITION_CONTROL_RAD;
00390     this->update();
00391   // Bouml preserved body end 000C9071
00392 }
00393 
00394 void DataTrace::updateTrace(const JointVelocitySetpoint& setpoint) {
00395   // Bouml preserved body begin 000C90F1
00396     velocitySetpoint = setpoint;
00397     controllerMode = VELOCITY_CONTROL_RAD_SEC;
00398     this->update();
00399   // Bouml preserved body end 000C90F1
00400 }
00401 
00402 void DataTrace::updateTrace(const JointRoundsPerMinuteSetpoint& setpoint) {
00403   // Bouml preserved body begin 000C9171
00404     roundsPerMinuteSetpoint = setpoint;
00405     controllerMode = VELOCITY_CONTROL_RPM;
00406     this->update();
00407   // Bouml preserved body end 000C9171
00408 }
00409 
00410 void DataTrace::updateTrace(const JointCurrentSetpoint& setpoint) {
00411   // Bouml preserved body begin 000C91F1
00412     currentSetpoint = setpoint;
00413     controllerMode = CURRENT_CONTROL_MODE;
00414     this->update();
00415   // Bouml preserved body end 000C91F1
00416 }
00417 
00418 void DataTrace::updateTrace(const JointTorqueSetpoint& setpoint) {
00419   // Bouml preserved body begin 000C9271
00420     torqueSetpoint = setpoint;
00421     controllerMode = TORQUE_CONTROL_MODE;
00422     this->update();
00423   // Bouml preserved body end 000C9271
00424 }
00425 
00426 void DataTrace::updateTrace(const JointEncoderSetpoint& setpoint) {
00427   // Bouml preserved body begin 000C9371
00428     encoderSetpoint = setpoint;
00429     controllerMode = POSITION_CONTROL_ENC;
00430     this->update();
00431   // Bouml preserved body end 000C9371
00432 }
00433 
00434 void DataTrace::updateTrace() {
00435   // Bouml preserved body begin 000EEC71
00436     YouBotSlaveMsg message;
00437     joint.getData(message);
00438     switch (message.stctOutput.controllerMode) {
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 
00466     this->update();
00467   // Bouml preserved body end 000EEC71
00468 }
00469 
00470 unsigned long DataTrace::getTimeDurationMilliSec() {
00471   // Bouml preserved body begin 000DCFF1
00472   return timeDurationMicroSec;
00473   // Bouml preserved body end 000DCFF1
00474 }
00475 
00476 void DataTrace::update() {
00477   // Bouml preserved body begin 000C94F1
00478     timeDuration = microsec_clock::local_time() - traceStartTime;
00479     timeDurationMicroSec = timeDuration.total_milliseconds();
00480     unsigned int statusFlags;
00481     joint.getStatus(statusFlags);
00482     joint.getData(sensedAngle);
00483     joint.getData(sensedEncoderTicks);
00484     joint.getData(sensedVelocity);
00485     joint.getData(sensedRoundsPerMinute);
00486     joint.getData(sensedCurrent);
00487     joint.getData(sensedTorque);
00488     joint.getData(targetAngle);
00489     joint.getData(targetVelocity);
00490     joint.getData(targetCurrent);
00491     joint.getData(rampGenSetpoint);
00492     
00493     std::stringstream angleSet, angleEncSet, velSet, velRPMSet, currentSet, pwmSet, torqueSet;
00494 
00495     switch (controllerMode) {
00496       case POSITION_CONTROL_RAD:
00497         angleSet << angleSetpoint.angle.value();
00498         angleEncSet << "NaN";
00499         velSet << targetVelocity.angularVelocity.value();
00500         velRPMSet << "NaN";
00501         currentSet << targetCurrent.current.value();
00502         pwmSet << "NaN";
00503         torqueSet << "NaN";
00504         break;
00505       case POSITION_CONTROL_ENC:
00506         angleSet << "NaN";
00507         angleEncSet << encoderSetpoint.encoderTicks;
00508         velSet << targetVelocity.angularVelocity.value();
00509         velRPMSet << "NaN";
00510         currentSet << targetCurrent.current.value();
00511         pwmSet << "NaN";
00512         torqueSet << "NaN";
00513         break;
00514       case VELOCITY_CONTROL_RAD_SEC:
00515         angleSet << "NaN";
00516         angleEncSet << "NaN";
00517         velSet << velocitySetpoint.angularVelocity.value();
00518         velRPMSet << "NaN";
00519         currentSet << targetCurrent.current.value();
00520         pwmSet << "NaN";
00521         torqueSet << "NaN";
00522         break;
00523       case VELOCITY_CONTROL_RPM:
00524         angleSet << "NaN";
00525         angleEncSet << "NaN";
00526         velSet << "NaN";
00527         velRPMSet << roundsPerMinuteSetpoint.rpm;
00528         currentSet << targetCurrent.current.value();
00529         pwmSet << "NaN";
00530         torqueSet << "NaN";
00531         break;
00532       case CURRENT_CONTROL_MODE:
00533         angleSet << "NaN";
00534         angleEncSet << "NaN";
00535         velSet << "NaN";
00536         velRPMSet << "NaN";
00537         currentSet << currentSetpoint.current.value();
00538         pwmSet << "NaN";
00539         torqueSet << "NaN";
00540         break;
00541       case TORQUE_CONTROL_MODE:
00542         angleSet << "NaN";
00543         angleEncSet << "NaN";
00544         velSet << "NaN";
00545         velRPMSet << "NaN";
00546         currentSet << "NaN";
00547         pwmSet << "NaN";
00548         torqueSet << torqueSetpoint.torque.value();
00549         break;
00550       case NOT_DEFINED:
00551         angleSet << "NaN";
00552         angleEncSet << "NaN";
00553         velSet << "NaN";
00554         velRPMSet << "NaN";
00555         currentSet << "NaN";
00556         pwmSet << "NaN";
00557         torqueSet << "NaN";
00558         break;
00559     };
00560 
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 
00597   // Bouml preserved body end 000C94F1
00598 }
00599 
00600 
00601 } // namespace youbot
Generated by  doxygen 1.6.3