63 bool inverted =
false;
74 this->
path.append(
"/");
78 if(boost::filesystem::exists((
path+
"jointDataTrace").c_str())){
79 while(input !=
'y' && input !=
'n' && overwriteFiles ==
false){
80 std::cout <<
"Do you want to overwrite the existing files? [n/y]" << std::endl;
85 throw std::runtime_error(
"Will not overwrite files!");
90 boost::filesystem::path rootPath (this->
path);
92 if ( !boost::filesystem::exists(this->
path) ){
93 if ( !boost::filesystem::create_directory( rootPath ))
94 throw std::runtime_error(
"could not create folder: " + this->
path);
112 file.open((
path+
"jointDataTrace").c_str(), std::fstream::out | std::fstream::trunc);
115 today = second_clock::local_time();
117 file <<
"# Name: " << this->
name << std::endl;
119 file <<
"# Date: " << boost::posix_time::to_simple_string(today) << std::endl;
123 std::string parameterString;
126 jointName.
toString(parameterString);
127 file <<
"# " << parameterString << std::endl;
128 firmwareParameter.
toString(parameterString);
129 file <<
"# " << parameterString << std::endl;
132 file <<
"# time [milliseconds]" 133 <<
" " <<
"angle setpoint [rad]" 134 <<
" " <<
"velocity setpoint [rad/s]" 135 <<
" " <<
"RPM setpoint" 136 <<
" " <<
"current setpoint [A]" 137 <<
" " <<
"torque setpoint [Nm]" 138 <<
" " <<
"ramp generator setpoint [rad/s]" 139 <<
" " <<
"encoder setpoint" 141 <<
" " <<
"sensed angle [rad]" 142 <<
" " <<
"sensed encoder ticks" 143 <<
" " <<
"sensed velocity [rad/s]" 144 <<
" " <<
"sensed RPM" 145 <<
" " <<
"sensed current [A]" 146 <<
" " <<
"sensed torque [Nm]" 147 <<
" " <<
"actual PWM" 149 <<
" " <<
"OVER_CURRENT" <<
" " 150 <<
"UNDER_VOLTAGE" <<
" " 151 <<
"OVER_VOLTAGE" <<
" " 152 <<
"OVER_TEMPERATURE" <<
" " 153 <<
"MOTOR_HALTED" <<
" " 154 <<
"HALL_SENSOR_ERROR" <<
" " 155 <<
"PWM_MODE_ACTIVE" <<
" " 156 <<
"VELOCITY_MODE" <<
" " 157 <<
"POSITION_MODE" <<
" " 158 <<
"TORQUE_MODE" <<
" " 159 <<
"POSITION_REACHED" <<
" " 160 <<
"INITIALIZED" <<
" " 162 <<
"I2T_EXCEEDED" <<
" " 262 jointName.
toString(parameterString);
265 firmwareParameter.
toString(parameterString);
270 torqueconst.
toString(parameterString);
276 jointLimits.
toString(parameterString);
282 encoderTicksPerRound.
toString(parameterString);
288 gearRatio.
toString(parameterString);
294 inverseMovementDirection.
toString(parameterString);
317 std::string parameterString;
321 today = second_clock::local_time();
326 jointName.
toString(parameterString);
332 firmwareParameter.
toString(parameterString);
337 torqueconst.
toString(parameterString);
343 jointLimits.
toString(parameterString);
349 encoderTicksPerRound.
toString(parameterString);
355 gearRatio.
toString(parameterString);
361 inverseMovementDirection.
toString(parameterString);
380 std::string executeString =
"cd ";
381 executeString.append(
path);
382 executeString.append(
"; gnuplot ../../gnuplotconfig > /dev/null 2>&1");
383 std::system(executeString.c_str());
481 unsigned int statusFlags;
494 std::stringstream angleSet, angleEncSet, velSet, velRPMSet, currentSet, pwmSet, torqueSet;
499 angleEncSet <<
"NaN";
517 angleEncSet <<
"NaN";
526 angleEncSet <<
"NaN";
535 angleEncSet <<
"NaN";
544 angleEncSet <<
"NaN";
553 angleEncSet <<
"NaN";
565 <<
" " << angleSet.str()
566 <<
" " << velSet.str()
567 <<
" " << velRPMSet.str()
568 <<
" " << currentSet.str()
569 <<
" " << torqueSet.str()
571 <<
" " << angleEncSet.str()
593 << bool(statusFlags &
TIMEOUT) <<
" " An actual I2t sum that exceeds this limit leads to increasing the I2t exceed counter.
Adjusts the limit to switch between first velocity PID parameter set and second velocity PID paramete...
Acceleration parameter for velocity control and position control.
JointCurrentSetpoint currentSetpoint
Adjust in standstill to lowest possible value at which the motor keeps its position. A too high value causes overshooting at positioning mode. (second position parameter set)
I-Parameter of PID current regulator.
the firmware version of the joint
time_duration timeDuration
the resolution of the encoders, it is needed for the calculations of the youBot Driver ...
JointTorqueSetpoint torqueSetpoint
virtual void getConfigurationParameter(JointParameter ¶meter)
the resolution of the encoders, it is needed for the calculations of the youBot Driver ...
Thermal winding time constant for the used motor. Used for I2t monitoring.
quantity< angular_velocity > angularVelocity
DataTrace(YouBotJoint &youBotJoint, const std::string Name, const bool overwriteFiles=false)
unsigned long getTimeDurationMilliSec()
JointRoundsPerMinuteSetpoint roundsPerMinuteSetpoint
Switching threshold for position control between the first and second set of parameters. If the velocity threshold is set to zero, the parameter set 2 is used all the time.
DataTraceCntrollerMode controllerMode
Encoder direction Set this flag in a way, that turn right increases position counter.
Velocity for sine initialization. [rpm].
I-Parameter of PID position regulator (first position parameter set)
JointPWMSetpoint PWMSetpoint
Set-point velocity of the joint.
The torque set-point of the joint will be set by setting the computed current set-point.
JointVelocitySetpoint targetVelocity
Maximum distance at which the position end flag is set.
JointSensedRoundsPerMinute sensedRoundsPerMinute
joint position limits in encoder ticks
JointSensedCurrent sensedCurrent
JointAngleSetpoint angleSetpoint
The actual speed of the velocity ramp used for positioning and velocity mode.
std::fstream parametersBeginTraceFile
Velocity to switch from controlled to hallFX mode. Set this value to a realistic velocity which the m...
JointSensedEncoderTicks sensedEncoderTicks
Switches the ramp generator for speed and position control on and off.
P-Parameter of PID position regulator (second position parameter set)
JointSensedVelocity sensedVelocity
Adjust in standstill to lowest possible value at which the motor keeps its position. A too high value causes overshooting at positioning mode. (first position parameter set)
quantity< plane_angle > angle
D-Parameter of PID current regulator.
Sums of errors of PID position regulator.
Counts the module operational time.
quantity< si::torque > torque
Duration for sine initialization sequence. This parameter should be set in a way, that the motor has ...
std::fstream parametersEndTraceFile
void toString(std::string &value)
PID calculation delay: Set operational frequency PID.
D-Parameter of PID position regulator (first position parameter set)
void toString(std::string &value)
Set Encoder counter to zero at next N channel event.
If the actual speed is below this value the motor halted flag will be set. [rpm]. ...
the gear ratio which is needed for the calculations in the youBot driver
JointRampGeneratorVelocity rampGenSetpoint
Set encoder counter to zero at next switch event.
Mass inertia constant for position regulation. Compensates mass moment of inertia of rotor...
JointSensedAngle sensedAngle
encoder ticks setpoint of the joint
Actual error of PID velocity regulator.
JointVelocitySetpoint velocitySetpoint
inverse the joint movement direction
quantity< si::angular_velocity > angularVelocity
The maximum velocity used for move to position command when executing a ramp to a position...
std::vector< YouBotJointParameterReadOnly * > parameterVector
Actual temperature of the motor driver.
I-Parameter of PID position regulator (second position parameter set)
This value represents the internal commutation offset. (0 ... max. Encoder steps per rotation) ...
JointCurrentSetpoint targetCurrent
Actual error of PID position regulator.
Sums of Errors of PID velocity regulator.
Motor current for controlled commutation. This parameter is used in commutation mode 1...
JointAngleSetpoint targetAngle
void toString(std::string &value)
JointEncoderSetpoint encoderSetpoint
virtual void getStatus(std::vector< std::string > &statusMessages)
Returns the status messages for the motor controller.
Maximum velocity at which end position can be set. Prevents issuing of end position when the target i...
I-Clipping Parameter of PID current regulator.
void toString(std::string &value)
quantity< si::torque > torque
P-Parameter of PID current regulator.
SlaveMessageOutput stctOutput
Delay of current limitation algorithm / PID current regulator.
unsigned long timeDurationMicroSec
void toString(std::string &value)
JointSensedTorque sensedTorque
Set-point current of the joint.
Hall sensor invert. Sets one of the motors invert with inverted hall scheme, e.g. some Maxon motors...
quantity< si::current > current
virtual void getData(JointData &data)
Resistance of motor coil. Used for current resistance regulation, position regulation and velocity re...
Enable overvoltage protection.
quantity< si::current > current
EtherCat message of the youBot EtherCat slaves.
Actual sum of the I2t monitor.
Set/Get Timeout to determine an interrupted communication with the EtherCAT master. (automatically stored in EEProm)
void getParameter(bool ¶meter) const
quantity< plane_angle > angle
P-Parameter of PID position regulator (first position parameter set)
BEMF constant of motor. Used for current regulation, position regulation and velocity regulation...
Set-point angle / position of the joint.
quantity< si::angular_velocity > angularVelocity
void toString(std::string &value)
Rounds per minute set-point of the joint.
Counts how often an I2t sum was higher than the I2t limit.
void toString(std::string &value)
D-Parameter of PID position regulator (second position parameter set)
Encoder Steps per Rotation.