Rose-Hulman Robotics Team

igvc/motor-control

Motor Control (New Roboteq)

Describes the motor controllers used on Moxom's Master

We have the  Roboteq MDC2250 motor controllers. The MDC2250 was chosen for its dual-channel nature and built-in encoder input (although the AX2550, turns out, does support encoders with an addon), and the good support/documentation and ROS compatibility.

We decided to use  existing open-source AX2550 drivers. Note that the serial commands are slightly different. The user manuals (attached to this page) were used for detailed descriptions of the relevant serial commands when adapting the AX2550 drivers for the newer MDC2250.

Our new modified code lives on SVN and (temporarily) GitHub; you should be able to just get it and compile without following most of the below directions.  https://github.com/natem345/au_automow_drivers

Getting & Compiling MDC2250 Drivers

  1. Create a ROS workspace (which is just any old folder that is listed in your $ROS_PACKAGE_PATH, likely by a setup.sh script; you could user rosws init to do so, a later revision of these directions probably should do so). We'll call it rosws.
  2. Download or clone our MC driver code. Currently the  official AX2550 one, and copy the ax2550 folder into rosws.
  3. Now we'll install the necessary  Serial package. These instructions are based on theirs but modified; use these.
    1. Create a .rosinstall file containing (assuming you're on Ubuntu with default ROS install dirs. rosinstall prefers they be listed):
      - git: {local-name: serial, uri: 'https://github.com/wjwwood/serial.git', version: master}
      - other: {local-name: /opt/ros/electric/ros}
      - other: {local-name: /opt/ros/electric/stacks}
      
    2. Copy your setup.sh somewhere, it'll get overwritten
    3. Run all these to install & make the serial code:
         rosinstall .
         source setup.bash
         rosmake serial --rosdep-install
      
    4. Change the setup.sh script such that the path points to your rosws, not the new serial folder (as your old one did). And ensure you are replacing your path, not adding to it (there shouldn't be two $ROS_PACKAGE_PATHs basically), as we don't want ROS to get confused by multiple ax2550's.
  4. Run changed setup.sh, then rosmake ax2550 should work! Should have ~39 successes, 0 failures.
  5. Running will require the motor controller serial device be named /dev/motor_controller. A quick & dirty way to do this is:
    1. Find current device it's at (perhaps with dmesg|grep tty), perhaps /dev/ttyUSB0
    2. Run sudo mv /dev/ttyUSB0 /dev/motor_controller
  6. To actually run it, open a few terminal tabs with all these (start in order). Roslaunch should be used in the future.
    1. roscore
    2. rosrun ax2550 ax2550_node
    3. rostopic pub /cmd_vel geometry_msgs/Twist '[99, 0, 0]' '[0, 0, 79]'
    4. (optional) rostopic echo /cmd_vel

Misc tech info

AX2250 9600 bits/s, 7-bit data, 1 Stop bit, Even Parity
MDC2250 115200 bits/s, 8-bit data, 1 Stop bit, No Parity
Cutecom or minicom may be useful for checking serial com

Interfacing with ROS & todo

We need to implement the interfaces used by the ROS  navigation stack. This means publishing  odometry information (being an "odometry source") and subscribing to the cmd_vel topic for velocity messages (" base controller"). Since our motor controllers are responsible for both of these things, we will be implementing these functions in a single ROS package. The code we started modifying does so, although some parameters will need to be tweaked for Moxom, and encoder querying was not modified for our model. We were also going to try using closed-loop speed control mode (set via the roborun tool) on the motor controller to mitigate the need for speed corrections by ROS. This requires setting PID parameters on the motor controller though.

Attachments