ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Is there a ROS wrapper for Pololu SMC-04B servomotor?

asked 2011-06-22 04:21:35 -0600

Khiya gravatar image

updated 2014-01-28 17:09:54 -0600

ngrennan gravatar image

Hello all,

I'm putting a robot together (from scratch) and I've decided to make use of ROS's programming tools because it's excellent for mixing and matching several different sensors that can't necessarily be bought together from any robotics companies. My problem is that I have an excellent base with servomotor wheels already installed, but I can't find a ROS driver for the chip (Pololu SMC-04B). I'm even having trouble finding any documentation at all for these chips online.

So I need some advice:

  1. Does a wrapper for Pololu chips exist in ROS?

  2. Is it possible for me to write my own driver, say in Python, or perhaps C++, by modifying driver code from some other robotic navigation system. For example, could I find the navigation code for an iRobot Create and modify it somehow for my Pololu chips? (I have no idea how quite to do this, just general ideas, so pointers would be appreciated).

  3. If none of the above are feasible for a beginner like me, would it just be better to invest in something like an ArbotiX RoboController and just use the servomotor capabilities?

Thanks, and if I ought to explain anything more clearly, please let me know. -Khiya

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2011-06-23 04:09:02 -0600

updated 2011-06-23 05:38:26 -0600

The SMC-04B has a great guide here. Your best bet is the serial interface (page 8). Seems like a pretty simple and straight forward protocol. You'll want to send serial data in the following form (from the guide):

[start byte, device type, motor # and direction, speed]

so for example sending the bytes:

[0x80,0x00,0x03,0x7F]

will result in full speed of motor #1

pyserial is your friend. if you'd like to see python serial code for example, checkout the IMU driver using python's serial interface here.

Here's some example code to get you started:

import serial
...
s = serial.Serial('/dev/ttyUSB0', 
                         baudrate=9600, 
                         bytesize=8, parity='N', 
                         stopbits=1, timeout=None)
s.write(chr(0x80))
s.write(chr(0x00))
s.write(chr(0x03))
s.write(chr(0x7F))

Once you have a basic driver written for the SMC-04B you'll have to write a node that subscribes to ~cmd_vel (geometry/Twist) and outputs the corresponding driver commands to achieve the correct linear and angular velocities--that's where code from the irobot create driver may come in handy (if you have a 2-wheel diff drive with caster style robot it'll use the same math).

I'd recommend creating two nodes: smc04b_driver and YOUR_ROBOT_NAME_node which makes use of the smc04b_driver--the idea being that others could reuse smc04b_driver, while the YOUR_ROBOT_NAME_node will be specific to your homebrew platform.

PS I think you're confusing terms when you say you have servo motors attached the the SMC-04B. The SMC-04B can accept RC servo commands (it has 3 modes: analog, RC, and serial) but is actually designed for driving standard DC motors in any case.

edit flag offensive delete link more

Comments

Thanks a lot! This was really helpful. Just one more question that I hope you could explain: I'm using a Windows machine - does that mean that my port name, instead of being '/dev/ttyUSB0' would be something like 'COM1'? Or whichever COM number my device manager says is connected? Thanks,
Khiya gravatar image Khiya  ( 2011-06-23 08:01:08 -0600 )edit
pyserial in windows just takes an integer # for the com port instead of a string so for "COM1" you'd just pass 0 (its an com # - 1 for some reason, hence the 0 instead of 1) as the first argument for serial.Serial()... http://pyserial.sourceforge.net/shortintro.html#opening-serial-ports
JeffRousseau gravatar image JeffRousseau  ( 2011-06-23 08:10:21 -0600 )edit
As a side note, developing the driver-side stuff in windows is fine (in fact I did that for my IMU driver)... but once you get involved with the ROS side you'll probably want to switch over to Ubuntu. ROS + Windows is still in its infancy. Good luck
JeffRousseau gravatar image JeffRousseau  ( 2011-06-23 08:12:53 -0600 )edit
1

answered 2011-06-22 22:58:27 -0600

KoenBuys gravatar image
  1. Not that I'm aware of
  2. You could have a look at our SSC32 package that controls servo motors. It also works on serial communication so it could be (a not ideal) example.
  3. It is feasible but it depends on motivation, willing to learn, previous coding experience, ... You should also look at it in the scope of deadlines etc.
edit flag offensive delete link more

Comments

Thanks, it's good to know how much work it could take. I'm free to work on this at will til the end of the summer, and I'm out to gain as much programming experience as possible. The guidelines posted below look manageable enough, so I'll try that direction next. Best, Khiya
Khiya gravatar image Khiya  ( 2011-06-23 08:26:17 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2011-06-22 04:21:35 -0600

Seen: 1,488 times

Last updated: Jun 23 '11