7 #include "RbDynamixelServo.h"
13 namespace RobotIOControls
15 namespace DynamixelUSB
36 virtual void AddMotorUpdate(
int iPos,
int iSpeed);
38 virtual void WriteGoalPosition(
int iServoID,
int iPos) {dxl_write_word(iServoID, P_GOAL_POSITION_L, iPos );};
39 virtual int ReadGoalPosition(
int iServoID) {
return dxl_read_word(iServoID, P_GOAL_POSITION_L);};
40 virtual int ReadPresentPosition(
int iServoID) {
return dxl_read_word(iServoID, P_PRESENT_POSITION_L);};
42 virtual void WriteMovingSpeed(
int iServoID,
int iVelocity) {dxl_write_word(iServoID, P_MOVING_SPEED_L, iVelocity);};
43 virtual int ReadMovingSpeed(
int iServoID) {
return dxl_read_word(iServoID, P_MOVING_SPEED_L);};
44 virtual int ReadPresentSpeed(
int iServoID) {
return dxl_read_word(iServoID, P_PRESENT_SPEED_L);};
46 virtual int ReadPresentLoad(
int iServoID) {
return dxl_read_word(iServoID, P_PRESENT_LOAD_L);};
47 virtual int ReadPresentVoltage(
int iServoID) {
return dxl_read_byte(iServoID, P_PRESENT_VOLTAGE);};
48 virtual int ReadPresentTemperature(
int iServoID) {
return dxl_read_byte(iServoID, P_PRESENT_TEMPERATURE);};
49 virtual int ReadIsMoving(
int iServoID) {
return dxl_read_byte(iServoID, P_MOVING);};
50 virtual int ReadLED(
int iServoID) {
return dxl_read_byte(iServoID, P_LED);};
51 virtual int ReadAlarmShutdown(
int iServoID) {
return dxl_read_byte(iServoID, P_ALARM_SHUTDOWN);};
52 virtual int ReadModelNumber(
int iServoID) {
return dxl_read_word(iServoID, P_MODEL_NUMBER_L);};
53 virtual int ReadID(
int iServoID) {
return dxl_read_byte(iServoID, P_ID);};
54 virtual int ReadFirmwareVersion(
int iServoID) {
return dxl_read_byte(iServoID, P_FIRMWARE_VERSION);};
56 virtual void WriteCWComplianceMargin(
int iServoID,
int iVal) {dxl_write_byte(iServoID, P_CW_COMPLIANCE_MARGIN, iVal);};
57 virtual int ReadCWComplianceMargin(
int iServoID) {
return dxl_read_byte(iServoID, P_CW_COMPLIANCE_MARGIN);};
59 virtual void WriteCCWComplianceMargin(
int iServoID,
int iVal) {dxl_write_byte(iServoID, P_CCW_COMPLIANCE_MARGIN, iVal);};
60 virtual int ReadCCWComplianceMargin(
int iServoID) {
return dxl_read_byte(iServoID, P_CCW_COMPLIANCE_MARGIN);};
62 virtual void WriteCWComplianceSlope(
int iServoID,
int iVal) {dxl_write_byte(iServoID, P_CW_COMPLIANCE_SLOPE, iVal);};
63 virtual int ReadCWComplianceSlope(
int iServoID) {
return dxl_read_byte(iServoID, P_CW_COMPLIANCE_SLOPE);};
65 virtual void WriteCCWComplianceSlope(
int iServoID,
int iVal) {dxl_write_byte(iServoID, P_CCW_COMPLIANCE_SLOPE, iVal);};
66 virtual int ReadCCWComplianceSlope(
int iServoID) {
return dxl_read_byte(iServoID, P_CCW_COMPLIANCE_SLOPE);};
68 virtual void WriteMaxTorque(
int iServoID,
int iVal) {dxl_write_word(iServoID, P_MAX_TORQUE_L, iVal);};
69 virtual int ReadMaxTorque(
int iServoID) {
return dxl_read_word(iServoID, P_MAX_TORQUE_L);};
71 virtual void WriteReturnDelayTime(
int iServoID,
int iVal) {dxl_write_byte(iServoID, P_RETURN_DELAY_TIME, iVal);};
72 virtual int ReadReturnDelayTime(
int iServoID) {
return dxl_read_byte(iServoID, P_RETURN_DELAY_TIME);};
74 virtual void WriteCCWAngleLimit(
int iServoID,
int iVal) {dxl_write_word(iServoID, P_CCW_ANGLE_LIMIT_L, iVal);};
75 virtual int ReadCCWAngleLimit(
int iServoID) {
return dxl_read_word(iServoID, P_CCW_ANGLE_LIMIT_L);};
77 virtual void WriteCWAngleLimit(
int iServoID,
int iVal) {dxl_write_word(iServoID, P_CW_ANGLE_LIMIT_L, iVal);};
78 virtual int ReadCWAngleLimit(
int iServoID) {
return dxl_read_word(iServoID, P_CW_ANGLE_LIMIT_L);};
80 virtual void WriteTorqueLimit(
int iServoID,
int iVal) {dxl_write_word(iServoID, P_MAX_TORQUE_L, iVal);};
81 virtual int ReadTorqueLimit(
int iServoID) {
return dxl_read_word(iServoID, P_MAX_TORQUE_L);};
83 virtual void SetRegister(
unsigned char reg,
unsigned char length,
unsigned int value);
84 virtual int GetRegister(
unsigned char reg,
unsigned char length);
87 RbDynamixelUSBServo();
88 virtual ~RbDynamixelUSBServo();
92 virtual void IOComponentID(
int iID);
94 virtual void UpdateAllParamsCount(
int iVal);
95 virtual int UpdateAllParamsCount();
97 virtual void UpdateQueueIndex(
int iVal);
98 virtual int UpdateQueueIndex();
100 virtual float QuantizeServoPosition(
float fltPos);
101 virtual float QuantizeServoVelocity(
float fltVel);
103 virtual bool IncludeInPartsCycle();
105 virtual bool dxl_read_block(
int id,
int address,
int length, std::vector<int> &aryData);
106 virtual void ReadAllParams();
107 virtual void ReadKeyParams();
109 virtual std::string GetErrorCode();
110 virtual std::string GetCommStatus(
int CommStatus);
112 #pragma region DataAccesMethods
114 virtual float *GetDataPointer(
const std::string &strDataType);
115 virtual bool SetData(
const std::string &strDataType,
const std::string &strValue,
bool bThrowError =
true);
116 virtual void QueryProperties(CStdPtrArray<TypeProperty> &aryProperties);
120 virtual void SetupIO();
121 virtual void StepIO(
int iPartIdx);
122 virtual void ShutdownIO();
124 virtual void Initialize();
125 virtual void StepSimulation();
126 virtual void ResetSimulation();
128 virtual void MicroSleep(
unsigned int iTime);
129 virtual Simulator *GetSimulator();
int m_iUpdateIdx
Keeps track of the number of update loops that have occurred since we last updated all params...
virtual bool IsMotorControl()
Returns true if this part interface is for controlling a motor.
A standard xml manipulation class.
int m_iUpdateAllParamsCount
Classes for implementing the cm-labs vortex physics engine for AnimatLab.