Phidgets Motor Controller Test

From wikidb
Jump to: navigation, search

References

Test Run Summary

We get the following for free. Enter eac command in their own window. Details follow

 roscore
 rosrun phidgets motor_control_hc
 rostopic pub -1 /cmd_vel geometry_msgs/Twist '[5,0,0]' '[0,0,0]'

Start up the ROS file system and command line tools

Open a terminal and enter the roscore command. It should be executed only one time at the beginning a ROS session.

eepp@tabor:~$ roscore
... logging to /home/eepp/.ros/log/96800156-9b2c-11e1-93df-0001c005f78e/roslaunch-tabor-1424.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://tabor:33832/
ros_comm version 1.6.5

SUMMARY
========

PARAMETERS
 * /rosversion
 * /rosdistro

NODES

auto-starting new master
process[master]: started with pid [1438]
ROS_MASTER_URI=http://tabor:11311/

setting /run_id to 96800156-9b2c-11e1-93df-0001c005f78e
process[rosout-1]: started with pid [1451]
started core service [/rosout]

Minimise the terminal. ^C in that terminal when you are done with ROS.

Motor test commands

See Motor Controller Set-up for a hardware example.

The motor_control_hc command will start up a motor command subscriber.

eepp@tabor:~$ rosrun phidgets motor_control_hc
[ INFO] [1336715294.113275237]: Waiting for Motor Control HC Phidget to be attached....
[ INFO] [1336715294.197436931]: Phidget High Current Motor Controller 2-motor Serial number 147489 attached!
[ INFO] [1336715294.199334490]: PhidgetMotorControl
[ INFO] [1336715294.199616510]: Serial Number: 147489
[ INFO] [1336715294.199908593]: Version: 102
[ INFO] [1336715294.200205147]: Number of motors 2
[ INFO] [1336715294.200468720]: Number of inputs 0

Set this terminal session aside. Additional info messages will be displayed when motor_control_cd captures published messages.

Publish a command to the motor controller. The robot will move forward for 3 seconds.

eepp@tabor:~$ rostopic pub -1 /cmd_vel geometry_msgs/Twist '[5,0,0]' '[0,0,0]'
publishing and latching message for 3.0 seconds

rostopic Command

ROS Command Cheat Sheet

rostopic documentation page

  • rostopic - A tool for displaying debug information about ROS topics: publishers, subscribers etc
  • pub - publish to a topic - in our example the topic is /cmd_vel
  • pub -1 - publish once
  • pub -r 10 - publish at the rate of 10 Hz.
  • see below for how to construct Twist messages.

The following will keep the robot moving forward until you do a ^C.

eepp@tabor:~$ rostopic pub -r 10 /cmd_vel geometry_msgs/Twist '[5,0,0]' '[0,0,0]'

Twist Message Coordinate System Convention

Xyz.jpg Twist.jpg from ROS by Example, Volume 1, R. Patrick Goebel, p29.


The twist message has linear and angular components in three space. See twist answer on the ROS Q&A blog. The twist coordinates break down as follows:

[linear.x, linear.y, linear.z] [angular.x, angular.y, angular.z]

The positive x axis point out of the front of the robot. Y points out of a side and z point up. The only permitted linear direction for a two wheeled robot is forward or backward along the x axis. Supplying linear y and z value are ignored. Thus,

  • '[5,0,0]' '[0,0,0]' is full speed forward.
  • '[4,0,0]' '[0,0,0]' is a slower speed forward.
  • '[-5,0,0]' '[0,0,0]' is full speed in reverse.
  • '[0,0,0]' '[0,0,0]' is stop - of course.
  • '[0,5,0]' '[0,0,0]' the 5 is ignored.

Angular motions occurs along the z axis. Therefore:

  • '[0,0,0]' '[0,0,5]' is rotate clockwise.
  • '[0,0,0]' '[0,0,-5]' is rotate counter clockwise.

X and y rotation don't make sense.

Linear and angular can be combined.

  • '[2.5,0,0]' '[0,0,2.5]' left wheel full forward (2.5 + 2.5 = 5), right wheel stopped (2.5 - 2.5 = 0).
  • '[-2.5,0,0]' '[0,0,-2.5]' left wheel full reverse, right wheel stopped.
  • '[2.5,0,0]' '[0,0,-2.5]' right wheel full forward, left wheel stopped.

Anything over roughly 5 or that adds up to over 5 is stop. Don't ask me why.

  • '[3,0,0]' '[0,0,3]' stop.