Tetrapod Project
make_can_msg Namespace Reference

The functions within this namespace converts the incomming 8-byte arrays to CAN data messages for RMDX motors. Please see the attached pdf, RMD_servo_motor_driver_protocol for full details. NB! All messages are related to the inner motor, not the output shaft. More...

Functions

void readPIDParameters (unsigned char *_can_message)
 The function creates a CAN data message that can be used to request the motor to send back a CAN message containing the motor's PI parameters. More...
 
void writePIDParametersToRAM (unsigned char *_can_message, unsigned char _k_p_position, unsigned char _k_i_position, unsigned char _k_p_speed, unsigned char _k_i_speed, unsigned char _k_p_torque, unsigned char _k_i_torque)
 The function creates a CAN data message that can be used to set the PI parameters of the motor in RAM. The parameters are deleted when the motor is turned off. More...
 
void writePIDParametersToROM (unsigned char *_can_message, unsigned char _k_p_position, unsigned char _k_i_position, unsigned char _k_p_speed, unsigned char _k_i_speed, unsigned char _k_p_torque, unsigned char _k_i_torque)
 The function creates a CAN data message that can be used to set the PI parameters of the motor. The parameters are stored even when the motor is turned off. NB! This should be avoided as the ROM memory will quickly wear out from writing to it. More...
 
void readAcceleration (unsigned char *_can_message)
 The function creates a CAN data message that can be used to request the motor to send back a CAN message containing the motor's acceleration. More...
 
void writeAccelerationToRAM (unsigned char *_can_message, int32_t _acceleration)
 The function creates a CAN data message that can be used to set the acceleration of the motor. More...
 
void readEncoderPosition (unsigned char *_can_message)
 The function creates a CAN data message that can be used to request the motor to send back a CAN message containing the motor's enocder data, raw encoder data, and encoder offset. More...
 
void writeEncoderPositionOffset (unsigned char *_can_message, uint16_t _encoder_offset)
 The function creates a CAN data message that can be used to request the motor to set the encoder position offset. More...
 
void writeCurrentPositionToROM (unsigned char *_can_message)
 The function creates a CAN data message that can be used to request the motor to set the current position as the zero position. More...
 
void readMultiTurnAngle (unsigned char *_can_message)
 The function creates a CAN data message that can be used to request the motor to send back a CAN message containing the position of the motor even through multiple rotations. More...
 
void readCircleTurnAngle (unsigned char *_can_message)
 The function creates a CAN data message that can be used to request the motor to send back a CAN message containing the position of the motor for a single rotation. The position is reset after each revolution of the motor. More...
 
void motorOff (unsigned char *_can_message)
 The function creates a CAN data message that can be used to request the motor to turn off its controller, clear its operating status and clear previously received control commands. More...
 
void motorStop (unsigned char *_can_message)
 The function creates a CAN data message that can be used to request the motor to stop its controller and clear previously received control commands. More...
 
void motorRunning (unsigned char *_can_message)
 The function creates a CAN data message that can be used to request the motor to resume its control object from before it was stopped. More...
 
void readMotorStatus1AndErrorFlag (unsigned char *_can_message)
 The function creates a CAN data message that can be used to request the motor to send back a CAN message containing its error status, voltage, and temperature. More...
 
void clearMotorErrorFlag (unsigned char *_can_message)
 The function creates a CAN data message that can be used to request the motor to clear its error status. More...
 
void readMotorStatus2 (unsigned char *_can_message)
 The function creates a CAN data message that can be used to request the motor to send back a CAN message containing its temperature, torque current, speed, and encoder position. More...
 
void readMotorStatus3 (unsigned char *_can_message)
 The function creates a CAN data message that can be used to request the motor to send back a CAN message cointaining its three phase currents. More...
 
void torqueCurrentControl (unsigned char *_can_message, int16_t _torque_current)
 The function creates a CAN data message that can be used to set the motor's torque current. After receiving the command the motor will reply with a CAN message containing temperature, torque current, speed and encoder position. More...
 
void speedControl (unsigned char *_can_message, int32_t speed)
 The function creates a CAN data message that can be used to set the motor's speed. After receiving the command the motor will reply with a CAN message containing temperature, torque current, speed and encoder position. More...
 
void positionControl1 (unsigned char *_can_message, int32_t _multiturn_angle)
 The function creates a CAN data message that can be used to set the motor's multi turn position. After receiving the command the motor will reply with a CAN message containing temperature, torque current, speed and encoder position. More...
 
void positionControl2 (unsigned char *_can_message, int32_t _multiturn_angle, uint16_t _max_speed)
 The function creates a CAN data message that can be used to set the motor's multi turn position with a maximum speed. After receiving the command the motor will reply with a CAN message containing temperature, torque current, speed and encoder position. More...
 
void positionControl3 (unsigned char *_can_message, uint16_t _singleturn_angle, uint8_t _spin_direction)
 The function creates a CAN data message that can be used to set the motor's single turn position with a specified rotation direction. After receiving the command the motor will reply with a CAN message containing temperature, torque current, speed and encoder position. More...
 
void positionControl4 (unsigned char *_can_message, uint16_t _single_turn_angle, uint8_t _spin_direction, uint16_t max_speed)
 The function creates a CAN data message that can be used to set the motor's single turn position with a specified rotation direction and maximum speed. After receiving the command the motor will reply with a CAN message containing temperature, torque current, speed and encoder position. More...
 

Detailed Description

The functions within this namespace converts the incomming 8-byte arrays to CAN data messages for RMDX motors. Please see the attached pdf, RMD_servo_motor_driver_protocol for full details. NB! All messages are related to the inner motor, not the output shaft.

Function Documentation

◆ readPIDParameters()

void make_can_msg::readPIDParameters ( unsigned char *  _can_message)

The function creates a CAN data message that can be used to request the motor to send back a CAN message containing the motor's PI parameters.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message

Definition at line 3 of file make_can_msg.cpp.

◆ writePIDParametersToRAM()

void make_can_msg::writePIDParametersToRAM ( unsigned char *  _can_message,
unsigned char  _k_p_position,
unsigned char  _k_i_position,
unsigned char  _k_p_speed,
unsigned char  _k_i_speed,
unsigned char  _k_p_torque,
unsigned char  _k_i_torque 
)

The function creates a CAN data message that can be used to set the PI parameters of the motor in RAM. The parameters are deleted when the motor is turned off.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.
[in]_k_p_position
[in]_k_i_position
[in]_k_p_velocity
[in]_k_i_velocity
[in]_k_p_torque
[in]_k_i_torque

Definition at line 9 of file make_can_msg.cpp.

◆ writePIDParametersToROM()

void make_can_msg::writePIDParametersToROM ( unsigned char *  _can_message,
unsigned char  _k_p_position,
unsigned char  _k_i_position,
unsigned char  _k_p_speed,
unsigned char  _k_i_speed,
unsigned char  _k_p_torque,
unsigned char  _k_i_torque 
)

The function creates a CAN data message that can be used to set the PI parameters of the motor. The parameters are stored even when the motor is turned off. NB! This should be avoided as the ROM memory will quickly wear out from writing to it.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message
[in]_k_p_position
[in]_k_i_position
[in]_k_p_velocity
[in]_k_i_velocity
[in]_k_p_torque
[in]_k_i_torque

Definition at line 27 of file make_can_msg.cpp.

◆ readAcceleration()

void make_can_msg::readAcceleration ( unsigned char *  _can_message)

The function creates a CAN data message that can be used to request the motor to send back a CAN message containing the motor's acceleration.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.

Definition at line 45 of file make_can_msg.cpp.

◆ writeAccelerationToRAM()

void make_can_msg::writeAccelerationToRAM ( unsigned char *  _can_message,
int32_t  _acceleration 
)

The function creates a CAN data message that can be used to set the acceleration of the motor.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.

Definition at line 51 of file make_can_msg.cpp.

◆ readEncoderPosition()

void make_can_msg::readEncoderPosition ( unsigned char *  _can_message)

The function creates a CAN data message that can be used to request the motor to send back a CAN message containing the motor's enocder data, raw encoder data, and encoder offset.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.

Definition at line 61 of file make_can_msg.cpp.

◆ writeEncoderPositionOffset()

void make_can_msg::writeEncoderPositionOffset ( unsigned char *  _can_message,
uint16_t  _encoder_offset 
)

The function creates a CAN data message that can be used to request the motor to set the encoder position offset.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.
[in]_encoder_offsetThe desired encoder offset

Definition at line 67 of file make_can_msg.cpp.

◆ writeCurrentPositionToROM()

void make_can_msg::writeCurrentPositionToROM ( unsigned char *  _can_message)

The function creates a CAN data message that can be used to request the motor to set the current position as the zero position.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.

Definition at line 75 of file make_can_msg.cpp.

◆ readMultiTurnAngle()

void make_can_msg::readMultiTurnAngle ( unsigned char *  _can_message)

The function creates a CAN data message that can be used to request the motor to send back a CAN message containing the position of the motor even through multiple rotations.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.

Definition at line 81 of file make_can_msg.cpp.

◆ readCircleTurnAngle()

void make_can_msg::readCircleTurnAngle ( unsigned char *  _can_message)

The function creates a CAN data message that can be used to request the motor to send back a CAN message containing the position of the motor for a single rotation. The position is reset after each revolution of the motor.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.

Definition at line 87 of file make_can_msg.cpp.

◆ motorOff()

void make_can_msg::motorOff ( unsigned char *  _can_message)

The function creates a CAN data message that can be used to request the motor to turn off its controller, clear its operating status and clear previously received control commands.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.

Definition at line 93 of file make_can_msg.cpp.

◆ motorStop()

void make_can_msg::motorStop ( unsigned char *  _can_message)

The function creates a CAN data message that can be used to request the motor to stop its controller and clear previously received control commands.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.

Definition at line 99 of file make_can_msg.cpp.

◆ motorRunning()

void make_can_msg::motorRunning ( unsigned char *  _can_message)

The function creates a CAN data message that can be used to request the motor to resume its control object from before it was stopped.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.

Definition at line 104 of file make_can_msg.cpp.

◆ readMotorStatus1AndErrorFlag()

void make_can_msg::readMotorStatus1AndErrorFlag ( unsigned char *  _can_message)

The function creates a CAN data message that can be used to request the motor to send back a CAN message containing its error status, voltage, and temperature.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.

Definition at line 110 of file make_can_msg.cpp.

◆ clearMotorErrorFlag()

void make_can_msg::clearMotorErrorFlag ( unsigned char *  _can_message)

The function creates a CAN data message that can be used to request the motor to clear its error status.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.

Definition at line 116 of file make_can_msg.cpp.

◆ readMotorStatus2()

void make_can_msg::readMotorStatus2 ( unsigned char *  _can_message)

The function creates a CAN data message that can be used to request the motor to send back a CAN message containing its temperature, torque current, speed, and encoder position.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.

Definition at line 122 of file make_can_msg.cpp.

◆ readMotorStatus3()

void make_can_msg::readMotorStatus3 ( unsigned char *  _can_message)

The function creates a CAN data message that can be used to request the motor to send back a CAN message cointaining its three phase currents.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.

Definition at line 128 of file make_can_msg.cpp.

◆ torqueCurrentControl()

void make_can_msg::torqueCurrentControl ( unsigned char *  _can_message,
int16_t  _torque_current 
)

The function creates a CAN data message that can be used to set the motor's torque current. After receiving the command the motor will reply with a CAN message containing temperature, torque current, speed and encoder position.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.

Definition at line 134 of file make_can_msg.cpp.

◆ speedControl()

void make_can_msg::speedControl ( unsigned char *  _can_message,
int32_t  speed 
)

The function creates a CAN data message that can be used to set the motor's speed. After receiving the command the motor will reply with a CAN message containing temperature, torque current, speed and encoder position.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.

Definition at line 142 of file make_can_msg.cpp.

◆ positionControl1()

void make_can_msg::positionControl1 ( unsigned char *  _can_message,
int32_t  _multiturn_angle 
)

The function creates a CAN data message that can be used to set the motor's multi turn position. After receiving the command the motor will reply with a CAN message containing temperature, torque current, speed and encoder position.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.
[in]_multiturn_angleThe multi turn angle of the motor.

Definition at line 152 of file make_can_msg.cpp.

◆ positionControl2()

void make_can_msg::positionControl2 ( unsigned char *  _can_message,
int32_t  _multiturn_angle,
uint16_t  _max_speed 
)

The function creates a CAN data message that can be used to set the motor's multi turn position with a maximum speed. After receiving the command the motor will reply with a CAN message containing temperature, torque current, speed and encoder position.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.
[in]_multiturn_angleThe multi turn angle of the motor.
[in]_max_speedThe maximum allowable speed of the motor.

Definition at line 162 of file make_can_msg.cpp.

◆ positionControl3()

void make_can_msg::positionControl3 ( unsigned char *  _can_message,
uint16_t  _singleturn_angle,
uint8_t  _spin_direction 
)

The function creates a CAN data message that can be used to set the motor's single turn position with a specified rotation direction. After receiving the command the motor will reply with a CAN message containing temperature, torque current, speed and encoder position.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.
[in]_singleturn_angleThe single turn angle of the motor.
[in]_spin_directionThe desired rotation direction of the motor. 0 = CW, 1 = CCW

Definition at line 174 of file make_can_msg.cpp.

◆ positionControl4()

void make_can_msg::positionControl4 ( unsigned char *  _can_message,
uint16_t  _single_turn_angle,
uint8_t  _spin_direction,
uint16_t  max_speed 
)

The function creates a CAN data message that can be used to set the motor's single turn position with a specified rotation direction and maximum speed. After receiving the command the motor will reply with a CAN message containing temperature, torque current, speed and encoder position.

Parameters
[in]_can_messageA CAN data array which is turned into the appropriate message.
[in]_singleturn_angleThe single turn angle of the motor.
[in]_spin_directionThe desired rotation direction of the motor. 0 = CW, 1 = CCW
[in]_max_speedThe maximum allowable speed of the motor.

Definition at line 183 of file make_can_msg.cpp.