9 #define P_MODEL_NUMBER_L 0x00
10 #define P_MODEL_NUMBER_H 0x01
11 #define P_FIRMWARE_VERSION 0x02
13 #define P_BAUD_RATE 0x04
14 #define P_RETURN_DELAY_TIME 0x05
15 #define P_CW_ANGLE_LIMIT_L 0x06
16 #define P_CW_ANGLE_LIMIT_H 0x07
17 #define P_CCW_ANGLE_LIMIT_L 0x08
18 #define P_CCW_ANGLE_LIMIT_H 0x09
19 #define P_INTERNAL_HIGHEST_TEMP 0x0B
20 #define P_LOWEST_LIMIT_VOLTAGE 0x0C
21 #define P_HIGHEST_LIMIT_VOLTAGE 0x0D
22 #define P_MAX_TORQUE_L 0x0E
23 #define P_MAX_TORQUE_H 0x0F
24 #define P_STATUS_RETURN_LEVEL 0x10
25 #define P_ALARM_LED 0x11
26 #define P_ALARM_SHUTDOWN 0x12
27 #define P_TORQUE_ENABLE 0x18
29 #define P_CW_COMPLIANCE_MARGIN 0x1A
30 #define P_CCW_COMPLIANCE_MARGIN 0x1B
31 #define P_CW_COMPLIANCE_SLOPE 0x1C
32 #define P_CCW_COMPLIANCE_SLOPE 0x1D
33 #define P_GOAL_POSITION_L 0x1E
34 #define P_GOAL_POSITION_H 0x1F
35 #define P_MOVING_SPEED_L 0x20
36 #define P_MOVING_SPEED_H 0x21
37 #define P_TORQUE_LIMIT_L 0x22
38 #define P_TORQUE_LIMIT_H 0x23
39 #define P_PRESENT_POSITION_L 0x24
40 #define P_PRESENT_POSITION_H 0x25
41 #define P_PRESENT_SPEED_L 0x26
42 #define P_PRESENT_SPEED_H 0x27
43 #define P_PRESENT_LOAD_L 0x28
44 #define P_PRESENT_LOAD_H 0x29
45 #define P_PRESENT_VOLTAGE 0x2A
46 #define P_PRESENT_TEMPERATURE 0x2B
47 #define P_REGISTERED 0x2C
50 #define P_PUNCH_L 0x30
51 #define P_PUNCH_H 0x31
58 namespace RobotIOControls
78 m_iGoalPos = iGoalPos;
79 m_iGoalVelocity = iGoalVelocity;
266 virtual void RecalculateParams();
268 virtual void WriteGoalPosition(
int iServoID,
int iPos) = 0;
269 virtual int ReadGoalPosition(
int iServoID) = 0;
270 virtual int ReadPresentPosition(
int iServoID) = 0;
272 virtual void WriteMovingSpeed(
int iServoID,
int iVelocity) = 0;
273 virtual int ReadMovingSpeed(
int iServoID) = 0;
274 virtual int ReadPresentSpeed(
int iServoID) = 0;
276 virtual int ReadPresentLoad(
int iServoID) = 0;
277 virtual int ReadPresentVoltage(
int iServoID) = 0;
278 virtual int ReadPresentTemperature(
int iServoID) = 0;
279 virtual int ReadIsMoving(
int iServoID) = 0;
280 virtual int ReadLED(
int iServoID) = 0;
281 virtual int ReadAlarmShutdown(
int iServoID) = 0;
282 virtual int ReadModelNumber(
int iServoID) = 0;
283 virtual int ReadID(
int iServoID) = 0;
284 virtual int ReadFirmwareVersion(
int iServoID) = 0;
286 virtual void WriteCWComplianceMargin(
int iServoID,
int iVal) = 0;
287 virtual int ReadCWComplianceMargin(
int iServoID) = 0;
289 virtual void WriteCCWComplianceMargin(
int iServoID,
int iVal) = 0;
290 virtual int ReadCCWComplianceMargin(
int iServoID) = 0;
292 virtual void WriteCWComplianceSlope(
int iServoID,
int iVal) = 0;
293 virtual int ReadCWComplianceSlope(
int iServoID) = 0;
295 virtual void WriteCCWComplianceSlope(
int iServoID,
int iVal) = 0;
296 virtual int ReadCCWComplianceSlope(
int iServoID) = 0;
298 virtual void WriteMaxTorque(
int iServoID,
int iVal) = 0;
299 virtual int ReadMaxTorque(
int iServoID) = 0;
301 virtual void WriteReturnDelayTime(
int iServoID,
int iVal) = 0;
302 virtual int ReadReturnDelayTime(
int iServoID) = 0;
304 virtual void WriteCCWAngleLimit(
int iServoID,
int iVal) = 0;
305 virtual int ReadCCWAngleLimit(
int iServoID) = 0;
307 virtual void WriteCWAngleLimit(
int iServoID,
int iVal) = 0;
308 virtual int ReadCWAngleLimit(
int iServoID) = 0;
310 virtual void WriteTorqueLimit(
int iServoID,
int iVal) = 0;
311 virtual int ReadTorqueLimit(
int iServoID) = 0;
313 virtual void AddMotorUpdate(
int iPos,
int iSpeed) = 0;
314 virtual void SetMotorPosVel();
316 virtual float *GetDataPointer(
const std::string &strDataType);
317 virtual bool SetData(
const std::string &strDataType,
const std::string &strValue);
318 virtual void QueryProperties(CStdPtrArray<TypeProperty> &aryProperties);
319 virtual void StepSimulation();
322 virtual void GetLimitValues();
324 virtual void ResetSimulation();
326 virtual void SetRegister(
unsigned char reg,
unsigned char length,
unsigned int value) = 0;
327 virtual int GetRegister(
unsigned char reg,
unsigned char length) = 0;
329 virtual void ConfigureServo();
335 virtual void QueryMotorData(
bool bVal);
336 virtual bool QueryMotorData();
338 virtual void MinPosFP(
int iVal);
339 virtual int MinPosFP();
341 virtual void MaxPosFP(
int iVal);
342 virtual int MaxPosFP();
344 virtual void MinAngle(
float fltVal);
345 virtual float MinAngle();
347 virtual void MaxAngle(
float fltVal);
348 virtual float MaxAngle();
350 virtual void MinVelocityFP(
int iVal);
351 virtual int MinVelocityFP();
353 virtual void MaxVelocityFP(
int iVal);
354 virtual int MaxVelocityFP();
356 virtual void RPMPerFPUnit(
float fltVal);
357 virtual float RPMPerFPUnit();
359 virtual void MinLoadFP(
int iVal);
360 virtual int MinLoadFP();
362 virtual void MaxLoadFP(
int iVal);
363 virtual int MaxLoadFP();
365 virtual void CWComplianceMargin(
int iVal);
366 virtual int CWComplianceMargin();
368 virtual void CCWComplianceMargin(
int iVal);
369 virtual int CCWComplianceMargin();
371 virtual void CWComplianceSlope(
int iVal);
372 virtual int CWComplianceSlope();
374 virtual void CCWComplianceSlope(
int iVal);
375 virtual int CCWComplianceSlope();
377 virtual void MaxTorque(
int iVal);
378 virtual int MaxTorque();
380 virtual float ConvertPosFPToFloat(
int iPos);
381 virtual int ConvertPosFloatToFP(
float fltPos);
383 virtual float TranslationRange();
384 virtual void TranslationRange(
float fltVal);
386 virtual float ConvertFPVelocity(
int iVel);
387 virtual int ConvertFloatVelocity(
float fltVelocity);
389 virtual float ConvertFPLoad(
int iLoad);
391 virtual void ServoID(
int iID);
392 virtual int ServoID();
394 virtual void SetGoalVelocity_FP(
int iVelocity);
395 virtual void SetNextGoalVelocity_FP(
int iVelocity);
396 virtual int GetGoalVelocity_FP();
398 virtual void SetMaximumVelocity();
399 virtual void SetNextMaximumVelocity();
401 virtual void SetGoalVelocity(
float fltVelocity);
402 virtual void SetNextGoalVelocity(
float fltVelocity);
403 virtual float GetGoalVelocity();
405 virtual void SetGoalPosition_FP(
int iPos);
406 virtual void SetNextGoalPosition_FP(
int iPos);
407 virtual int GetGoalPosition_FP();
409 virtual void SetGoalPosition(
float fltPos);
410 virtual void SetNextGoalPosition(
float fltPos);
411 virtual float GetGoalPosition();
415 virtual int LastGoalPosition_FP();
417 virtual int GetActualPosition_FP();
418 virtual float GetActualPosition();
420 virtual int GetActualVelocity_FP();
421 virtual float GetActualVelocity();
423 virtual int LastGoalVelocity_FP();
425 virtual int GetActualLoad_FP();
426 virtual float GetActualLoad();
428 virtual int GetActualVoltage_FP();
429 virtual float GetActualVoltage();
431 virtual float GetActualTemperatureFahrenheit();
432 virtual float GetActualTemperatureCelcius();
434 virtual float GetPresentPosition() {
return m_fltPresentPos;}
435 virtual float GetPresentVelocity() {
return m_fltPresentVelocity;}
436 virtual float GetPresentLoad() {
return m_fltLoad;}
437 virtual float GetPresentVoltage() {
return m_fltVoltage;}
438 virtual float GetPresentTemperature() {
return m_fltTemperature;}
440 virtual bool GetIsMoving();
441 virtual void GetIsLEDOn(
bool &bIsBlueOn,
bool &bIsGreenOn,
bool &bIsRedOn);
442 virtual bool GetIsAlarmShutdown();
444 virtual int GetModelNumber();
445 virtual int GetIDNumber();
446 virtual int GetFirmwareVersion();
448 virtual void InitMotorData();
449 virtual void ShutdownMotor();
451 virtual void SetReturnDelayTime_FP(
int iVal);
452 virtual int GetReturnDelayTime_FP();
454 virtual void SetCWAngleLimit_FP(
int iVal);
455 virtual void SetCWAngleLimit(
float fltLimit);
456 virtual int GetCWAngleLimit_FP();
457 virtual float GetCWAngleLimit();
459 virtual void SetCCWAngleLimit_FP(
int iVal);
460 virtual void SetCCWAngleLimit(
float fltLimit);
461 virtual int GetCCWAngleLimit_FP();
462 virtual float GetCCWAngleLimit();
464 virtual void SetCWComplianceMargin_FP(
int iVal);
465 virtual int GetCWComplianceMargin_FP();
467 virtual void SetCCWComplianceMargin_FP(
int iVal);
468 virtual int GetCCWComplianceMargin_FP();
470 virtual void SetCWComplianceSlope_FP(
int iVal);
471 virtual int GetCWComplianceSlope_FP();
473 virtual void SetCCWComplianceSlope_FP(
int iVal);
474 virtual int GetCCWComplianceSlope_FP();
476 virtual void SetMaxTorque_FP(
int iVal);
477 virtual int GetMaxTorque_FP();
479 virtual int GetMinSimPos_FP();
480 virtual float GetMinSimPos();
481 virtual void SetMinSimPos(
float fltVal);
483 virtual int GetMaxSimPos_FP();
484 virtual float GetMaxSimPos();
485 virtual void SetMaxSimPos(
float fltVal);
487 virtual void SetTorqueLimit_FP(
int iVal);
488 virtual int GetTorqueLimit_FP();
490 virtual bool ResetToStartPos();
491 virtual void ResetToStartPos(
bool bVal);
493 virtual float QuantizeServoPosition(
float fltPos);
494 virtual float QuantizeServoVelocity(
float fltVel);
496 virtual void MicroSleep(
unsigned int iTime) = 0;
497 virtual Simulator *GetSimulator() = 0;
499 virtual void Move(
float fltPos,
float fltVel);
500 virtual void WaitForMoveToFinish();
float m_fltPosFloatToFPSlope
The conversion factor to convert radians to FP position.
int m_iTotalAngle
Maximum angle the servo can move in fixed point number. m_iMaxPosFP - m_iMinPosFP.
int m_iCWComplianceSlope
Used to set the CW compliance slope of the servo.
int m_iMaxVelocityFP
Maximum value that can be set for the velocity.
int m_iMinSimPos
This is the minimum angle in fixed point that can be used for this servo as specified in the simulati...
float m_fltConvertFPToPosS
The conversion factor to convert FP velocity value to rad/s.
int m_iMaxTorque
Used to set the maximum torque of the servo.
bool m_bVelStopPosSet
Keeps track of whether we have already set velocity to stop when doing velocity control.
int m_iCCWComplianceMargin
Used to set the CCW compliance margin of the servo.
int m_iMaxLoadFP
Maximum value that can be set for the load.
float m_fltLowLimit
Low constraint limit value.
float m_fltMaxAngle
Maximum value that can be set for the position in floating point number.
int m_iMaxSimPos
This is the maximum angle in fixed point that can be used for this servo as specified in the simulati...
int m_iVoltage
The current voltage that was last read in for this servo.
float m_fltConvertPosSToFP
The conversion factor to convert rad/s to FP velocity.
float m_fltMinAngle
Minimum value that can be set for the position in floating point number.
int m_iLastGoalVelocity
Keeps track of the last servo goal velocity that we set.
int m_iServoID
ID used for communications with this servo.
int m_iMinLoadFP
Minimum value that can be set for the load.
int m_iNextGoalVelocity
This is the goal velocity that you would like to use in the next time step.
int m_iLastGoalPos
Keeps track of the last servo goal position that we set.
float m_fltFloatToFPTranslation
Conversion factor for when we are doing prismatic joints. Converts rotations to linear movements...
float m_fltHiLimit
Hi constraint limit value.
int m_iMinPosFP
Minimum value that can be set for the position in fixed point number.
float m_fltPresentPos
The current position that was last read in for this servo.
int m_iTemperature
The current temperature that was last read in for this servo.
int m_iPresentPos
The current position that was last read in for this servo.
float m_fltReadParamTime
The time taken to read the params of this motor for the current step.
int m_iNextGoalPos
This is the goal position that you would like to use in the next time step.
float m_fltPosFloatToFPIntercept
The conversion factor to convert radians to FP position.
bool m_bNeedSetVelStopPos
A standard xml manipulation class.
float m_fltMaxPosSec
Stores the maximum rad/sec for this motor.
int m_iMinVelocityFP
Minimum value that can be set for the velocity.
int m_iLoad
The current load that was last read in for this servo.
float m_fltConvertFPToLoad
Used to conver the load fixed point value back to a percentage of load.
float m_fltMaxSimPos
This is the maximum angle in radians that can be used for this servo as specified in the simulation...
float m_fltPresentVelocity
The current velocity that was last read in for this servo.
MotorizedJoint * m_lpMotorJoint
Pointer to an associated motorized joint.
float m_fltFPToFloatTranslation
Conversion factor for when we are doing prismatic joints. Converts rotations to linear movements...
float m_fltLoad
The current load that was last read in for this servo.
int m_iCWComplianceMargin
Used to set the CW compliance margin of the servo.
float m_fltTranslationRange
The total translation range over which a prismatic joint can move. This does not apply to hinge joint...
float m_fltRPMPerFPUnit
Stores the maximum rot/min for this motor. The max rotations (rad) per fixed point unit...
int m_iCCWComplianceSlope
Used to set the CCW compliance slope of the servo.
float m_fltCenterPos
The center point value in radians.
float m_fltTotalAngle
Maximum angle the servo can move in floating point number. m_iMaxPosFP - m_iMinPosFP.
bool m_bResetToStartPos
If true then we should reset to the start position at the beginning of the simulation.
float m_fltIOPos
Used to report back the IO position of the servo at each step.
int m_iMaxPosFP
Maximum value that can be set for the position in fixed point number.
float m_fltVoltage
The current voltage that was last read in for this servo.
float m_fltPosFPToFloatIntercept
The conversion factor to convert FP position to floating point position..
float m_fltMinSimPos
This is the minimum angle in radians that can be used for this servo as specified in the simulation...
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
float m_fltTemperature
The current temperature that was last read in for this servo.
float m_fltIOVelocity
Used to report back the IO velocity of the servo at each step.
int m_iPresentVelocity
The current velocity that was last read in for this servo.
int m_iCenterPosFP
The center point value in fixed point numbers.
float m_fltPosFPToFloatSlope
The conversion factor to convert FP position to floating point position.