BE@R lab / MX28

Dependents:   MX_control

Fork of MX28 by Georgios Petrou

Embed: (wiki syntax)

« Back to documentation index

MX28 Class Reference

MX28 Class Reference

MX28 servo control class. More...

#include <MX28.h>

Public Member Functions

uint8_t CommunicatePacket (MX28_PROTOCOL_PACKET *packet)
 Send the MX28 packet over the serial half duplex connection.
uint8_t GetModelNumber (uint8_t servoId, uint16_t *modelNumber)
 Get the servo model number.
uint8_t GetFirmwareVersion (uint8_t servoId, uint8_t *firmwareVersion)
 Get the servo firmware version.
uint8_t GetId (uint8_t servoId, uint8_t *id)
 Get the servo id.
uint8_t SetId (uint8_t servoId, uint8_t newId, bool isRegWrite=false)
 Set the servo id.
uint8_t GetBaudRate (uint8_t servoId, int32_t *baudRate)
 Get the servo baudrate.
uint8_t SetBaudRate (uint8_t servoId, int baudRate, bool isRegWrite=false)
 Set the servo baudrate.
uint8_t GetReturnDelayTime (uint8_t servoId, uint8_t *returnDelayTime)
 Get the servo return delay time.
uint8_t SetReturnDelayTime (uint8_t servoId, uint8_t returnDelayTime, bool isRegWrite=false)
 Set the servo delay time.
uint8_t GetCWAngleLimit (uint8_t servoId, uint16_t *cwAngleLimit)
 Get the servo clockwise angle limit.
uint8_t SetCWAngleLimit (uint8_t servoId, uint16_t cwAngleLimit, bool isRegWrite=false)
 Set the servo clockwise angle limit.
uint8_t GetCCWAngleLimit (uint8_t servoId, uint16_t *ccwAngleLimit)
 Get the servo counterclockwise angle limit.
uint8_t SetCCWAngleLimit (uint8_t servoId, uint16_t ccwAngleLimit, bool isRegWrite=false)
 Set the servo counterclockwise angle limit.
uint8_t GetHighestTemperatureLimit (uint8_t servoId, uint8_t *highestTemperatureLimit)
 Get the servo up temperature limit.
uint8_t SetHighestTemperatureLimit (uint8_t servoId, uint8_t highestTemperatureLimit, bool isRegWrite=false)
 Set the servo highest temperature limit.
uint8_t GetLowestVoltageLimit (uint8_t servoId, uint8_t *lowestVoltageLimit)
 Get the servo lowest voltage limit.
uint8_t SetLowestVoltageLimit (uint8_t servoId, uint8_t lowestVoltageLimit, bool isRegWrite=false)
 Set the servo lowest voltage limit.
uint8_t GetHighestVoltageLimit (uint8_t servoId, uint8_t *highestVoltageLimit)
 Get the servo highest voltage limit.
uint8_t SetHighestVoltageLimit (uint8_t servoId, uint8_t highestVoltageLimit, bool isRegWrite=false)
 Set the servo highest voltage limit.
uint8_t GetMaxTorque (uint8_t servoId, uint16_t *maxTorque)
 Get the servo max torque.
uint8_t SetMaxTorque (uint8_t servoId, uint16_t maxTorque, bool isRegWrite=false)
 Set the servo max torque.
uint8_t GetStatusReturnLevel (uint8_t servoId, uint8_t *statusReturnLevel)
 Get the servo status return level.
uint8_t SetStatusReturnLevel (uint8_t servoId, uint8_t statusReturnLevel, bool isRegWrite=false)
 Set the servo status return level.
uint8_t GetAlarmLED (uint8_t servoId, uint8_t *alarmLED)
 Get the servo alarm LED.
uint8_t SetAlarmLED (uint8_t servoId, uint8_t alarmLED, bool isRegWrite=false)
 Set the servo alarm LED.
uint8_t GetAlarmShutdown (uint8_t servoId, uint8_t *alarmShutdown)
 Get the servo alarm shutdown.
uint8_t SetAlarmShutdown (uint8_t servoId, uint8_t alarmShutdown, bool isRegWrite=false)
 Set the servo alarm shutdown.
uint8_t GetEnableTorque (uint8_t servoId, uint8_t *enableTorque)
 Get the servo enable torque.
uint8_t SetEnableTorque (uint8_t servoId, uint8_t enableTorque, bool isRegWrite=false)
 Set the servo enable torque.
uint8_t GetEnableLED (uint8_t servoId, uint8_t *enableLED)
 Get the servo enable LED.
uint8_t SetEnableLED (uint8_t servoId, uint8_t enableLED, bool isRegWrite=false)
 Set the servo enable LED.
uint8_t GetPGain (uint8_t servoId, uint8_t *pGain)
 Get the servo P gain.
uint8_t SetPGain (uint8_t servoId, uint8_t pGain, bool isRegWrite=false)
 Set the servo P gain.
uint8_t GetIGain (uint8_t servoId, uint8_t *iGain)
 Get the servo I gain.
uint8_t SetIGain (uint8_t servoId, uint8_t iGain, bool isRegWrite=false)
 Set the servo I gain.
uint8_t GetDGain (uint8_t servoId, uint8_t *dGain)
 Get the servo D gain.
uint8_t SetDGain (uint8_t servoId, uint8_t dGain, bool isRegWrite=false)
 Set the servo D gain.
uint8_t GetGoalPosition (uint8_t servoId, uint16_t *goalPosition)
 Get the servo goal position.
uint8_t SetGoalPosition (uint8_t servoId, uint16_t goalPosition, bool isRegWrite=false)
 Set the servo goal position.
uint8_t GetMovingSpeed (uint8_t servoId, uint16_t *movingSpeed)
 Get the servo moving speed.
uint8_t SetMovingSpeed (uint8_t servoId, uint16_t movingSpeed, bool isRegWrite=false)
 Set the servo moving speed.
uint8_t GetTorqueLimit (uint8_t servoId, uint16_t *torqueLimit)
 Get the servo torque limit.
uint8_t SetTorqueLimit (uint8_t servoId, uint16_t torqueLimit, bool isRegWrite=false)
 Set the servo torque limit.
uint8_t GetPresentPosition (uint8_t servoId, uint16_t *presentPosition)
 Get the servo present position.
uint8_t GetPresentSpeed (uint8_t servoId, uint16_t *presentSpeed)
 Get the servo present speed.
uint8_t GetPresentLoad (uint8_t servoId, uint16_t *presentLoad)
 Get the servo present load.
uint8_t GetPresentVoltage (uint8_t servoId, uint8_t *presentVoltage)
 Get the servo present voltage.
uint8_t GetPresentTemperature (uint8_t servoId, uint8_t *presentTemperature)
 Get the servo present temperature.
uint8_t GetIsRegistered (uint8_t servoId, uint8_t *isRegistered)
 Get if there are commands transmitted by MX28_REG_WRITE.
uint8_t GetIsMoving (uint8_t servoId, uint8_t *isMoving)
 Get if the servo is moving.
uint8_t GetIsLocked (uint8_t servoId, uint8_t *isLocked)
 Get if the servo EEPROM is locked.
uint8_t SetIsLocked (uint8_t servoId, uint8_t isLocked, bool isRegWrite=false)
 Set if the servo EEPROM is locked.
uint8_t GetPunch (uint8_t servoId, uint16_t *punch)
 Get the servo punch.
uint8_t SetPunch (uint8_t servoId, uint16_t punch, bool isRegWrite=false)
 Set the servo punch.
uint8_t Ping (uint8_t servoId)
 Ping the servo.
uint8_t Reset (uint8_t servoId)
 Reset the servo.
uint8_t Action (uint8_t servoId)
 Trigger the servo.
 MX28 (PinName tx, PinName rx, int baudRate)
 Create an MX28 servo object connected to the specified serial half duplex pins, with the specified baudrate.
 ~MX28 ()
 Destroy an MX28 servo object.

Detailed Description

MX28 servo control class.

Example:

 #include "mbed.h"
 #include "MX28.h"
 
 Serial pc(USBTX, USBRX);
 MX28 mx28(p28, p27, 57600);

 int main() 
 {
    pc.baud(115200);   
    
    pc.getc();
    pc.printf("======================================================\r\n"); 
    
   uint8_t servoId = 0x01;
    
    uint16_t modelNumber;        
    mx28.GetModelNumber(servoId, &modelNumber);
    
    uint8_t firmwareVersion;        
    mx28.GetFirmwareVersion(servoId, &firmwareVersion);
    
    uint8_t id;        
    mx28.GetId(servoId, &id);               
    mx28.SetId(servoId, servoId);
    
    int32_t baudRate;
    mx28.GetBaudRate(servoId, &baudRate);    
    mx28.SetBaudRate(servoId, 57600); 
    
    uint8_t returnDelayTime;
    mx28.GetReturnDelayTime(servoId, &returnDelayTime);     
    mx28.SetReturnDelayTime(servoId, 0xFA); 
    
    uint16_t cwAngleLimit;
    mx28.GetCWAngleLimit(servoId, &cwAngleLimit);
    mx28.SetCWAngleLimit(servoId, 0x0000);
    
    uint16_t ccwAngleLimit;
    mx28.GetCCWAngleLimit(servoId, &ccwAngleLimit);    
    mx28.SetCCWAngleLimit(servoId, 0x0FFF);
    
    uint8_t highestTemperatureLimit;
    mx28.GetHighestTemperatureLimit(servoId, &highestTemperatureLimit);       
    mx28.SetHighestTemperatureLimit(servoId, 0x50);
    
    uint8_t downLimitVoltage;
    mx28.GetLowestVoltageLimit(servoId, &downLimitVoltage);       
    mx28.SetLowestVoltageLimit(servoId, 0x3C);
   
    uint8_t upLimitVoltage;
    mx28.GetHighestVoltageLimit(servoId, &upLimitVoltage);       
    mx28.SetHighestVoltageLimit(servoId, 0xA0);
    
    uint16_t maxTorque;
    mx28.GetMaxTorque(servoId, &maxTorque);    
    mx28.SetMaxTorque(servoId, 0x03FF);
    
    uint8_t statusReturnLevel;        
    mx28.GetStatusReturnLevel(servoId, &statusReturnLevel);
    mx28.SetStatusReturnLevel(servoId, 0x02);
    
    uint8_t alarmLED;        
    mx28.GetAlarmLED(servoId, &alarmLED);           
    mx28.SetAlarmLED(servoId, 0x24);
    
    uint8_t alarmShutdown;        
    mx28.GetAlarmShutdown(servoId, &alarmShutdown);           
    mx28.SetAlarmShutdown(servoId, 0x24); 
            
    uint8_t enableTorque;   
    mx28.GetEnableTorque(servoId, &enableTorque);    
    mx28.SetEnableTorque(servoId, 0x00);
    
    uint8_t enableLED;   
    mx28.GetEnableLED(servoId, &enableLED);    
    mx28.SetEnableLED(servoId, 0x00);
    
    uint8_t pGain;        
    mx28.GetPGain(servoId, &pGain);           
    mx28.SetPGain(servoId, 0x20);
    
    uint8_t iGain;        
    mx28.GetIGain(servoId, &iGain);           
    mx28.SetIGain(servoId, 0x00);
    
    uint8_t dGain;        
    mx28.GetDGain(servoId, &dGain);           
    mx28.SetDGain(servoId, 0x00);
    
    uint16_t goalPosition;
    mx28.GetGoalPosition(servoId, &goalPosition);     
    mx28.SetGoalPosition(servoId, 0x0800);
    
    uint16_t movingSpeed;
    mx28.GetMovingSpeed(servoId, &movingSpeed);     
    mx28.SetMovingSpeed(servoId, 0x00FF);
    
    uint16_t torqueLimit;
    mx28.GetTorqueLimit(servoId, &torqueLimit);     
    mx28.SetTorqueLimit(servoId, 0x03FF);
    
    uint16_t presentPosition;
    mx28.GetPresentPosition(servoId, &presentPosition);
    
    uint16_t presentSpeed;
    mx28.GetPresentSpeed(servoId, &presentSpeed); 

    uint16_t presentLoad;
    mx28.GetPresentLoad(servoId, &presentLoad);     
    
    uint8_t presentVoltage;        
    mx28.GetPresentVoltage(servoId, &presentVoltage);
    
    uint8_t presentTemperature;        
    mx28.GetPresentTemperature(servoId, &presentTemperature);
    
    uint8_t isRegistered;   

    mx28.GetIsRegistered(servoId, &isRegistered);
    
    uint8_t isMoving;   
    mx28.GetIsMoving(servoId, &isMoving);
    
    uint8_t lock;        
    mx28.GetIsLocked(servoId, &lock);           
    mx28.SetIsLocked(servoId, 0x00); 
    
    uint16_t punch;
    mx28.GetPunch(servoId, &punch);     
    mx28.SetPunch(servoId, 0x0020);
    
    mx28.Ping(servoId);
    
    mx28.Reset(servoId);
    
    uint8_t servo1Id = 0x01;
    uint8_t servo2Id = 0x02;
    uint8_t servo3Id = 0x03;
    
    uint16_t servo1GoalPosition = 0x0800;
    uint16_t servo2GoalPosition = 0x0800;
    uint16_t servo3GoalPosition = 0x0800;
    
    MX28_PROTOCOL_PACKET packet;
    packet.servoId = MX28_PROTOCOL_BROADCAST_ID;
    // (Data length + 1) * Number of servos + 4
    packet.length = (2+ 1) * 3 + 4;             
    packet.instructionErrorId = MX28_SYNC_WRITE;
    packet.parameter[0] = MX28_GOAL_POSITION_L;
    packet.parameter[1] = 0x06;
    packet.parameter[2] = servo1Id;
    Utilities::ConvertUInt16ToUInt8Array(servo1GoalPosition, (uint8_t*)&(packet.parameter[3]));    
    packet.parameter[9] = servo2Id;
    Utilities::ConvertUInt16ToUInt8Array(servo2GoalPosition, (uint8_t*)&(packet.parameter[10]));
    packet.parameter[16] = servo3Id;
    Utilities::ConvertUInt16ToUInt8Array(servo3GoalPosition, (uint8_t*)&(packet.parameter[17]));
   
    pc.printf("Set servos goal positions: %hu %hu %hu\r\n", servo1GoalPosition, servo2GoalPosition, servo3GoalPosition);
    
    mx28.CommunicatePacket(&packet);
          
    packet.servoId = servoId;
    packet.length = 4;
    packet.instructionErrorId = MX28_READ_DATA;
    packet.parameter[0] = MX28_PRESENT_POSITION_L;
    packet.parameter[1] = 0x08;
 
    mx28.CommunicatePacket(&packet);
    
    presentPosition = Utilities::ConvertUInt8ArrayToUInt16(packet.parameter);
    presentSpeed = Utilities::ConvertUInt8ArrayToUInt16((uint8_t*)&(packet.parameter[2]));   
    presentLoad = Utilities::ConvertUInt8ArrayToUInt16((uint8_t*)&(packet.parameter[4]));    
    presentVoltage = packet.parameter[6];
    presentTemperature = packet.parameter[7];
        
    pc.printf("Present position: %hu\r\n", presentPosition);
    pc.printf("Present speed: %hu\r\n", presentSpeed);
    pc.printf("Present load: %hu\r\n", presentLoad);
    pc.printf("Present voltage: 0x%02X\r\n", presentVoltage);
    pc.printf("Present temperature: 0x%02X\r\n", presentTemperature);             
        
    uint8_t status = mx28.GetModelNumber(servoId, &modelNumber);
   
    if(status == MX28_ERRBIT_WRITE_TIMEOUT)
        pc.printf("Error: Write timeout\r\n");
    else if(status == MX28_ERRBIT_READ_TIMEOUT) 
        pc.printf("Error: Read timeout\r\n");
    else if(status == MX28_ERRBIT_MASTER_CHECKSUM) 
        pc.printf("Error: Master checksum error\r\n");
    else
    {
        if(status & MX28_ERRBIT_VOLTAGE)
            pc.printf("Error: Input voltage error\r\n");
        if(status & MX28_ERRBIT_ANGLE)
            pc.printf("Error: Angle limit error\r\n");
        if(status & MX28_ERRBIT_OVERHEAT)
            pc.printf("Error: Overheat error\r\n");
        if(status & MX28_ERRBIT_RANGE)
            pc.printf("Error: Out of range error\r\n");
        if(status & MX28_ERRBIT_CHECKSUM)
            pc.printf("Error: Checksum error\r\n");
        if(status & MX28_ERRBIT_OVERLOAD)
            pc.printf("Error: Overload error\r\n");
        if(status & MX28_ERRBIT_INSTRUCTION)
            pc.printf("Error: Instruction code error\r\n");
    }
    
    pc.printf("======================================================\r\n"); 
 
    return 0;           
 }

Definition at line 252 of file MX28.h.


Constructor & Destructor Documentation

MX28 ( PinName  tx,
PinName  rx,
int  baudRate 
)

Create an MX28 servo object connected to the specified serial half duplex pins, with the specified baudrate.

Parameters:
txSend pin.
rxReceive pin.
baudrateThe bus speed.

Definition at line 1538 of file MX28.cpp.

~MX28 (  )

Destroy an MX28 servo object.

Definition at line 1556 of file MX28.cpp.


Member Function Documentation

uint8_t Action ( uint8_t  servoId )

Trigger the servo.

Triggers the action registered by the REG_WRITE instruction

Parameters:
servoIdThe servo id.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1523 of file MX28.cpp.

uint8_t CommunicatePacket ( MX28_PROTOCOL_PACKET *  packet )

Send the MX28 packet over the serial half duplex connection.

Parameters:
packetThe MX28 packet.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 27 of file MX28.cpp.

uint8_t GetAlarmLED ( uint8_t  servoId,
uint8_t *  alarmLED 
)

Get the servo alarm LED.

Parameters:
servoIdThe servo id.
alarmLEDThe variable to store the alarm LED.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 833 of file MX28.cpp.

uint8_t GetAlarmShutdown ( uint8_t  servoId,
uint8_t *  alarmShutdown 
)

Get the servo alarm shutdown.

Parameters:
servoIdThe servo id.
alarmShutdownThe variable to store the alarm shutdown.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 874 of file MX28.cpp.

uint8_t GetBaudRate ( uint8_t  servoId,
int32_t *  baudRate 
)

Get the servo baudrate.

Parameters:
servoIdThe servo id.
baudRateThe variable to store the baudrate.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 446 of file MX28.cpp.

uint8_t GetCCWAngleLimit ( uint8_t  servoId,
uint16_t *  ccwAngleLimit 
)

Get the servo counterclockwise angle limit.

Parameters:
servoIdThe servo id.
ccwAngleLimitThe variable to store the counterclockwise angle limit.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 587 of file MX28.cpp.

uint8_t GetCWAngleLimit ( uint8_t  servoId,
uint16_t *  cwAngleLimit 
)

Get the servo clockwise angle limit.

Parameters:
servoIdThe servo id.
cwAngleLimitThe variable to store the clockwise angle limit.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 546 of file MX28.cpp.

uint8_t GetDGain ( uint8_t  servoId,
uint8_t *  dGain 
)

Get the servo D gain.

Parameters:
servoIdThe servo id.
dGainThe variable to store the D gain.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1079 of file MX28.cpp.

uint8_t GetEnableLED ( uint8_t  servoId,
uint8_t *  enableLED 
)

Get the servo enable LED.

Parameters:
servoIdThe servo id.
enableLEDThe variable to store the enable LED.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 956 of file MX28.cpp.

uint8_t GetEnableTorque ( uint8_t  servoId,
uint8_t *  enableTorque 
)

Get the servo enable torque.

Parameters:
servoIdThe servo id.
enableTorqueThe variable to store the enable torque.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 915 of file MX28.cpp.

uint8_t GetFirmwareVersion ( uint8_t  servoId,
uint8_t *  firmwareVersion 
)

Get the servo firmware version.

Parameters:
servoIdThe servo id.
firmwareVersionThe variable to store the model number.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 381 of file MX28.cpp.

uint8_t GetGoalPosition ( uint8_t  servoId,
uint16_t *  goalPosition 
)

Get the servo goal position.

Parameters:
servoIdThe servo id.
goalPositionThe variable to store the goal position.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1120 of file MX28.cpp.

uint8_t GetHighestTemperatureLimit ( uint8_t  servoId,
uint8_t *  highestTemperatureLimit 
)

Get the servo up temperature limit.

Parameters:
servoIdThe servo id.
highestTemperatureLimitThe variable to store the highest temperature limit.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 628 of file MX28.cpp.

uint8_t GetHighestVoltageLimit ( uint8_t  servoId,
uint8_t *  highestVoltageLimit 
)

Get the servo highest voltage limit.

Parameters:
servoIdThe servo id.
highestVoltageLimitThe variable to store the highest voltage limit.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 710 of file MX28.cpp.

uint8_t GetId ( uint8_t  servoId,
uint8_t *  id 
)

Get the servo id.

Parameters:
servoIdThe servo id.
idThe variable to store the id.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 405 of file MX28.cpp.

uint8_t GetIGain ( uint8_t  servoId,
uint8_t *  iGain 
)

Get the servo I gain.

Parameters:
servoIdThe servo id.
iGainThe variable to store the I gain.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1038 of file MX28.cpp.

uint8_t GetIsLocked ( uint8_t  servoId,
uint8_t *  isLocked 
)

Get if the servo EEPROM is locked.

0 EEPROM area can be modified. 1 EEPROM area cannot be modified.

Parameters:
servoIdThe servo id.
isLockThe variable to store if the servo EEPROM is locked.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1411 of file MX28.cpp.

uint8_t GetIsMoving ( uint8_t  servoId,
uint8_t *  isMoving 
)

Get if the servo is moving.

0 Goal position command execution is completed. 1 Goal position command execution is in progress.

Parameters:
servoIdThe servo id.
isMovingThe variable to store if the servo is moving.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1387 of file MX28.cpp.

uint8_t GetIsRegistered ( uint8_t  servoId,
uint8_t *  isRegistered 
)

Get if there are commands transmitted by MX28_REG_WRITE.

0 There are no commands transmitted by REG_WRITE. 1 There are commands transmitted by REG_WRITE.

Parameters:
servoIdThe servo id.
isRegisteredThe variable to store if it is registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1363 of file MX28.cpp.

uint8_t GetLowestVoltageLimit ( uint8_t  servoId,
uint8_t *  lowestVoltageLimit 
)

Get the servo lowest voltage limit.

Parameters:
servoIdThe servo id.
lowestVoltageLimitThe variable to store the lowest voltage limit.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 669 of file MX28.cpp.

uint8_t GetMaxTorque ( uint8_t  servoId,
uint16_t *  maxTorque 
)

Get the servo max torque.

Parameters:
servoIdThe servo id.
maxTorqueThe variable to store the max torque.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 751 of file MX28.cpp.

uint8_t GetModelNumber ( uint8_t  servoId,
uint16_t *  modelNumber 
)

Get the servo model number.

Parameters:
servoIdThe servo id.
modelNumberThe variable to store the model number.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 357 of file MX28.cpp.

uint8_t GetMovingSpeed ( uint8_t  servoId,
uint16_t *  movingSpeed 
)

Get the servo moving speed.

Parameters:
servoIdThe servo id.
movingSpeedThe variable to store the moving speed.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1161 of file MX28.cpp.

uint8_t GetPGain ( uint8_t  servoId,
uint8_t *  pGain 
)

Get the servo P gain.

Parameters:
servoIdThe servo id.
pGainThe variable to store the P gain.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 997 of file MX28.cpp.

uint8_t GetPresentLoad ( uint8_t  servoId,
uint16_t *  presentLoad 
)

Get the servo present load.

The range of the value is 0~2047, and the unit is about 0.1%. If the value is 0~1023, it means the load works to the CCW direction. If the value is 1024~2047, it means the load works to the CW direction. That is, the 10th bit becomes the direction bit to control the direction, and 1024 is equal to 0. For example, the value is 512, it means the load is detected in the direction of CCW about 50% of the maximum torque.

Parameters:
servoIdThe servo id.
presentLoadThe variable to store the present load.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1291 of file MX28.cpp.

uint8_t GetPresentPosition ( uint8_t  servoId,
uint16_t *  presentPosition 
)

Get the servo present position.

The range of the value is 0~4095 (0xFFF), and the unit is 0.088 degree.

Parameters:
servoIdThe servo id.
presentPositionThe variable to store the present position.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1243 of file MX28.cpp.

uint8_t GetPresentSpeed ( uint8_t  servoId,
uint16_t *  presentSpeed 
)

Get the servo present speed.

0~2047 (0x000~0X7FF) can be used. If a value is in the rage of 0~1023 then the motor rotates to the CCW direction. If a value is in the rage of 1024~2047 then the motor rotates to the CW direction. The 10th bit becomes the direction bit to control the direction; 0 and 1024 are equal. The value unit is about 0.11rpm. For example, if it is set to 300 then the motor is moving to the CCW direction at a rate of about 34.33rpm.

Parameters:
servoIdThe servo id.
presentSpeedThe variable to store the present speed.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1267 of file MX28.cpp.

uint8_t GetPresentTemperature ( uint8_t  servoId,
uint8_t *  presentTemperature 
)

Get the servo present temperature.

It is the internal temperature of Dynamixel in Celsius. Data value is identical to the actual temperature in Celsius. For example, if the data value is 85 (0x55), the current internal temperature is 85℃.

Parameters:
servoIdThe servo id.
presentTemperatureThe variable to store the present temperature.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1339 of file MX28.cpp.

uint8_t GetPresentVoltage ( uint8_t  servoId,
uint8_t *  presentVoltage 
)

Get the servo present voltage.

This value is 10 times larger than the actual voltage. For example, when 10V is supplied, the data value is 100 (0x64)

Parameters:
servoIdThe servo id.
presentVoltageThe variable to store the present voltage.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1315 of file MX28.cpp.

uint8_t GetPunch ( uint8_t  servoId,
uint16_t *  punch 
)

Get the servo punch.

Can choose vales from 0x00 to 0x3FF.

Parameters:
servoIdThe servo id.
punchThe variable to store the servo punch.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1452 of file MX28.cpp.

uint8_t GetReturnDelayTime ( uint8_t  servoId,
uint8_t *  returnDelayTime 
)

Get the servo return delay time.

Parameters:
servoIdThe servo id.
returnDelayTimeThe variable to store the return delay time.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 505 of file MX28.cpp.

uint8_t GetStatusReturnLevel ( uint8_t  servoId,
uint8_t *  statusReturnLevel 
)

Get the servo status return level.

Parameters:
servoIdThe servo id.
statusReturnLevelThe variable to store the status return level.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 792 of file MX28.cpp.

uint8_t GetTorqueLimit ( uint8_t  servoId,
uint16_t *  torqueLimit 
)

Get the servo torque limit.

0 to 1023 (0x3FF) is available, and the unit is about 0.1%. For example, if the value is 512, it is about 50%; that means only 50% of the maximum torque will be used. If the power is turned on, the value of Max Torque (Address 14, 15) is used as the initial value.

Parameters:
servoIdThe servo id.
torqueLimitThe variable to store the torque limit.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1202 of file MX28.cpp.

uint8_t Ping ( uint8_t  servoId )

Ping the servo.

No action. Used for obtaining a Status Packet.

Parameters:
servoIdThe servo id.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1493 of file MX28.cpp.

uint8_t Reset ( uint8_t  servoId )

Reset the servo.

Changes the control table values of the Dynamixel actuator to the Factory Default Value settings

Parameters:
servoIdThe servo id.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1508 of file MX28.cpp.

uint8_t SetAlarmLED ( uint8_t  servoId,
uint8_t  alarmLED,
bool  isRegWrite = false 
)

Set the servo alarm LED.

Parameters:
servoIdThe servo id.
alarmLEDThe servo alarm LED.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 857 of file MX28.cpp.

uint8_t SetAlarmShutdown ( uint8_t  servoId,
uint8_t  alarmShutdown,
bool  isRegWrite = false 
)

Set the servo alarm shutdown.

Parameters:
servoIdThe servo id.
alarmShutdownThe servo alarm shutdown.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 898 of file MX28.cpp.

uint8_t SetBaudRate ( uint8_t  servoId,
int  baudRate,
bool  isRegWrite = false 
)

Set the servo baudrate.

Parameters:
servoIdThe servo id.
baudRateThe servo baudrate.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.
uint8_t SetCCWAngleLimit ( uint8_t  servoId,
uint16_t  ccwAngleLimit,
bool  isRegWrite = false 
)

Set the servo counterclockwise angle limit.

Parameters:
servoIdThe servo id.
ccwAngleLimitThe servo counterclockwise angle limit.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 611 of file MX28.cpp.

uint8_t SetCWAngleLimit ( uint8_t  servoId,
uint16_t  cwAngleLimit,
bool  isRegWrite = false 
)

Set the servo clockwise angle limit.

Parameters:
servoIdThe servo id.
cwAngleLimitThe servo clockwise angle limit.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 570 of file MX28.cpp.

uint8_t SetDGain ( uint8_t  servoId,
uint8_t  dGain,
bool  isRegWrite = false 
)

Set the servo D gain.

Parameters:
servoIdThe servo id.
dGainThe servo D gain.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1103 of file MX28.cpp.

uint8_t SetEnableLED ( uint8_t  servoId,
uint8_t  enableLED,
bool  isRegWrite = false 
)

Set the servo enable LED.

Parameters:
servoIdThe servo id.
enableLEDThe servo enable LED.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 980 of file MX28.cpp.

uint8_t SetEnableTorque ( uint8_t  servoId,
uint8_t  enableTorque,
bool  isRegWrite = false 
)

Set the servo enable torque.

Parameters:
servoIdThe servo id.
enableTorqueThe servo enable torque.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 939 of file MX28.cpp.

uint8_t SetGoalPosition ( uint8_t  servoId,
uint16_t  goalPosition,
bool  isRegWrite = false 
)

Set the servo goal position.

Parameters:
servoIdThe servo id.
goalPositionThe servo goal position.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1144 of file MX28.cpp.

uint8_t SetHighestTemperatureLimit ( uint8_t  servoId,
uint8_t  highestTemperatureLimit,
bool  isRegWrite = false 
)

Set the servo highest temperature limit.

Parameters:
servoIdThe servo id.
highestTemperatureLimitThe servo highest temperature limit.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 652 of file MX28.cpp.

uint8_t SetHighestVoltageLimit ( uint8_t  servoId,
uint8_t  highestVoltageLimit,
bool  isRegWrite = false 
)

Set the servo highest voltage limit.

Parameters:
servoIdThe servo id.
highestVoltageLimitThe servo highest voltage limit.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 734 of file MX28.cpp.

uint8_t SetId ( uint8_t  servoId,
uint8_t  newId,
bool  isRegWrite = false 
)

Set the servo id.

Parameters:
servoIdThe servo id.
newIdThe new servo id.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 429 of file MX28.cpp.

uint8_t SetIGain ( uint8_t  servoId,
uint8_t  iGain,
bool  isRegWrite = false 
)

Set the servo I gain.

Parameters:
servoIdThe servo id.
iGainThe servo I gain.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1062 of file MX28.cpp.

uint8_t SetIsLocked ( uint8_t  servoId,
uint8_t  isLocked,
bool  isRegWrite = false 
)

Set if the servo EEPROM is locked.

Parameters:
servoIdThe servo id.
isLockedThe variable to store if the servo EEPROM is locked.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1435 of file MX28.cpp.

uint8_t SetLowestVoltageLimit ( uint8_t  servoId,
uint8_t  lowestVoltageLimit,
bool  isRegWrite = false 
)

Set the servo lowest voltage limit.

Parameters:
servoIdThe servo id.
lowestVoltageLimitThe servo lowest voltage limit.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 693 of file MX28.cpp.

uint8_t SetMaxTorque ( uint8_t  servoId,
uint16_t  maxTorque,
bool  isRegWrite = false 
)

Set the servo max torque.

Parameters:
servoIdThe servo id.
maxTorqueThe servo max torque.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 775 of file MX28.cpp.

uint8_t SetMovingSpeed ( uint8_t  servoId,
uint16_t  movingSpeed,
bool  isRegWrite = false 
)

Set the servo moving speed.

Parameters:
servoIdThe servo id.
movingSpeedThe servo moving speed.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1185 of file MX28.cpp.

uint8_t SetPGain ( uint8_t  servoId,
uint8_t  pGain,
bool  isRegWrite = false 
)

Set the servo P gain.

Parameters:
servoIdThe servo id.
pGainThe servo P gain.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1021 of file MX28.cpp.

uint8_t SetPunch ( uint8_t  servoId,
uint16_t  punch,
bool  isRegWrite = false 
)

Set the servo punch.

Parameters:
servoIdThe servo id.
punchThe servo punch value.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1476 of file MX28.cpp.

uint8_t SetReturnDelayTime ( uint8_t  servoId,
uint8_t  returnDelayTime,
bool  isRegWrite = false 
)

Set the servo delay time.

Parameters:
servoIdThe servo id.
returnDelayTimeThe servo return delay time.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 529 of file MX28.cpp.

uint8_t SetStatusReturnLevel ( uint8_t  servoId,
uint8_t  statusReturnLevel,
bool  isRegWrite = false 
)

Set the servo status return level.

Parameters:
servoIdThe servo id.
statusReturnLevelThe servo status return level.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 816 of file MX28.cpp.

uint8_t SetTorqueLimit ( uint8_t  servoId,
uint16_t  torqueLimit,
bool  isRegWrite = false 
)

Set the servo torque limit.

Parameters:
servoIdThe servo id.
torqueLimitThe servo torque limit.
isRegWriteIf the command will be registered.
Returns:
MX28_ERRBIT_NONE if succeeded, error code otherwise.

Definition at line 1226 of file MX28.cpp.