Motor Control

Motor type overview

There are three types of motors in roboy3:

  1. maxon BLDC motors myoBricks

  2. parallax 360 servo M3

  3. linear actuators openBionics hand

All of these motors are controlled with a differential RS485 bus and a custom protocol using uart. The de10 nano dev board implements this communication using the myo_shield_v0.6. The communication with all motors is happening completely transparent to the ROS end-user.

ROS1 message types

roboy_plexus is the main node, that provides topics and services for controlling all 58 motors in roboy3. The available topics for motor control are:

  • /roboy/brain/middleware/MotorState

  • /roboy/brain/middleware/MotorInfo

The MotorState topic is published at 100Hz and provides the following values:

  • global_id the global motor id

  • setpoint the current setpoint of each motor

  • encoder0_pos the position of encoder 0

  • encoder1_pos the position of encoder 1

  • displacement the spring displacement

  • current the current drawn by the unit

Some of these values are not used for the 2. and 3. type of motors:

2.: encoder1_pos is not used. current is not used because the M3 unit has not current sensor.

3.: none of the values are used, because there is no feedback coming from the hand, due to bus speed considerations which are caused by the weak Atmel processor of the openBionics hand.

The MotorInfo topic is published at 10Hz and provides the following values:

  • global_id the global motor id

  • setpoint the current setpoint of each motor

  • control_mode the control_mode the motor is currently in

  • Kp controller P-gain

  • Ki controller I-gain

  • Kd controller D-gain

  • deadband controller deadband

  • IntegralLimit controller I-term limit

  • PWMLimit controller pwm threshold

  • pwm the current pwm value of the controller

  • current_limit current threshold

  • communication_quality achieved communication frequency in Hz

  • error_code developer information about communication process

  • neopixelColor current neopixel color setpoint

Again, some of the values are not used for 2. and 3. type of motors:

2.: currentLimit and neopixelColor are not used, because the M3 units neither have a current sensor nor a neoPixel

3. except for the setpoint, none of the values are used due to bus speed considerations which are caused by the weak Atmel processor of the openBionics hand. there is currently only position control implemented for the hand, so the control_mode is also not used.

ROS1 control_modes

There are four control modes:

  1. ENCODER0_POS → 0 : position control using encoder0

  2. ENCODER1_POS → 0 : position control using encoder1

  3. DISPLACEMENT → 0 : position control using the spring displacement

  4. DIRECT_PWM → 0 : controlling the pwm value directly

roboy_plexus provides two services for changing between the control modes:

  • /roboy/brain/middleware/ControlMode

  • /roboy/brain/middleware/MotorConfig

The ControlMode service requires the following values in the request:

  • control_mode the control mode to change to

  • set_points a list of new setpoints for each motor, the setpoint will be applied directly after changing to the new control mode

  • motor_id a list of global motor ids of which to change the control mode

The MotorConfig service provides a more detailed control over the controller parameters to be used:

  • update_frequency the new update frequency to be used to talk to each motor on one bus

  • motor a list of global motor ids of which to change the control mode

  • control_mode the control mode to change to

  • PWMLimit controller pwm threshold

  • IntegralLimit controller I-term limit

  • Kp controller P-gain

  • Ki controller I-gain

  • Kd controller D-gain

  • deadband controller deadband

  • setpoint a list of new setpoints for each motor, the setpoint will be applied directly after changing to the new control mode