Source Code

This library was based on the dynamixel functions and examples avaiable in the Dynamixel SDK , created with the purpose of being used with the Mixcell QT interface, returning specific errors that will be used to alert the user for some commom problems, the complete code can be find at: https://github.com/clebercoutof/mixcell/

class source_code.Dynamixel[source]

This class is used to store the Dynamixel, id, baudrate, protocol and model.

source_code.factory_reset(id, baudrate)[source]

Resets a servo to factory config.

Parameters:
  • id (int) – Servo ìd
  • baudrate – Baudrate of the servo to be configured
Returns:

PORT_ERROR case it fails to open the port.

BAUDRATE_ERROR case it fails to change baudrate.

COMM_ERROR case there is a communication error.

HARDWARE_COMM_ERROR case there is a hardware communication error.

NONE case the operation succeeds.

source_code.reverse_slave(id, reverse_mode_enable, slave_mode_enable, baudrate)[source]

Sets the drive mode.

Parameters:
  • id (int) – Servo ìd
  • baudrate – Baudrate of the servo to be configured
  • reverse_mode_enable (int) – Reverse mode checkbox state
  • slave_mode_enable (int) – Slave mode checkbox state
Returns:

PORT_ERROR case it fails to open the port.

BAUDRATE_ERROR case it fails to change baudrate.

COMM_ERROR case there is a communication error.

HARDWARE_COMM_ERROR case there is a hardware communication error.

NONE case the operation succeeds.

source_code.search(id_search_min, id_search_max, baudrates_search_list)[source]

Search for servos in range of id_search_min and id_search_max for all baudrates in baudrates_search_list.

Parameters:
  • id_search_min (int) – ID to start searching.
  • id_search_max (int) – ID to stop pinging.
  • baudrates_search_list (list) – List containing the baudrates that the user want to search.
Returns:

found_servos list containing the servos found.

Return type:

List containing the Dynamixel object servos

source_code.set_angle_limit(id, cw_angle_limit, ccw_angle_limit, baudrate)[source]

Configure the angle limits of a servo.

Parameters:
  • id (int) – Servo ìd
  • cw_angle_limit (int) – Clockwise angle limit to be configured
  • ccw_angle_limit (int) – Counter-clockwise angle limit to be configured
  • baudrate – Baudrate of the servo to be configured
Returns:

PORT_ERROR case it fails to open the port.

BAUDRATE_ERROR case it fails to change baudrate.

COMM_ERROR case there is a communication error.

HARDWARE_COMM_ERROR case there is a hardware communication error.

NONE case the operation succeeds.

source_code.set_baudrate(id, new_baudrate, baudrate)[source]

Sets a servo baudrate.

Parameters:
  • id (int) – Servo ìd
  • baudrate – Baudrate of the servo to be configured
  • new_baudrate (int) – new_baudrate to be configured
Returns:

PORT_ERROR case it fails to open the port.

BAUDRATE_ERROR case it fails to change baudrate.

COMM_ERROR case there is a communication error.

HARDWARE_COMM_ERROR case there is a hardware communication error.

NONE case the operation succeeds.

source_code.set_id(id, new_id, baudrate)[source]

Sets a servo ID.

Parameters:
  • id (int) – Servo ìd
  • baudrate – Baudrate of the servo to be configured
  • new_id (int) – new_id to be configured
Returns:

PORT_ERROR case it fails to open the port.

BAUDRATE_ERROR case it fails to change baudrate.

COMM_ERROR case there is a communication error.

HARDWARE_COMM_ERROR case there is a hardware communication error.

NONE case the operation succeeds.

source_code.set_pid_gain(id, d_gain, i_gain, p_gain, baudrate)[source]

Sets the PID Gains.

Parameters:
  • id (int) – Servo ìd
  • baudrate – Baudrate of the servo to be configured
  • d_gain (int) – D Gain
  • i_gain (int) – I Gain
  • p_gain (int) – P Gain
Returns:

PORT_ERROR case it fails to open the port.

BAUDRATE_ERROR case it fails to change baudrate.

COMM_ERROR case there is a communication error.

HARDWARE_COMM_ERROR case there is a hardware communication error.

NONE case the operation succeeds.

source_code.set_torque_max(id, percentage, baudrate)[source]

Sets a servo max torque.

Parameters:
  • id (int) – Servo ìd
  • baudrate – Baudrate of the servo to be configured
  • percentage (int) – Torque percentage
Returns:

PORT_ERROR case it fails to open the port.

BAUDRATE_ERROR case it fails to change baudrate.

COMM_ERROR case there is a communication error.

HARDWARE_COMM_ERROR case there is a hardware communication error.

NONE case the operation succeeds.