Rosanswers logo

I am trying to use the standard servo control example found here: http://www.ros.org/wiki/rosserial_arduino/Tutorials/Servo%20Controller . The program works fine, but only once. When I try to give it a new servo position it never updates. I have to close all of my terminal windows and reset my Arduino before I can try again. I am wondering if there is a way to actually reset the PWM to neutral in between commands. I have tested my servo and it works fine with a normal RC transmitter and receiver.

I am using Ubuntu 10.04 with ROS Electric and an Arduino MEGA 2560.

Originally posted by shakingatoms on ROS Answers with karma: 31 on 2012-04-18

Post score: 2


1 Answer 1


Rosanswers logo

Yep, I'm having the same problem. It looks like what's happening is that when we update the servo command with a new command, it simply ORs the bits together.

In other words, if your first command was 5, which is 00000101 in binary, and you send over 3 as your next command, which is 00000011 in binary, the next value will be 7, which is 00000111 in binary.

It looks like this problem has already been solved here


but I don't know how to apply it.

I've removed the old copy of rosserial in /opt/ros/electric/stacks and added the new version from the trunk into my ROS package path, but I still get the same error.

Any thoughts?

(I'm also running Electric.)

UPDATE: Whoop--it looks like I've discovered the answer! Here's what I did:

Note: I've only gotten this to work with electric.

  1. Remove the old version of rosserial.
  2. acquire the updated version of rosserial using mercurial here: https://kforge.ros.org/rosserial/hg/
  3. rosmake it and put the libraries folder in your Arduino sketchbook.
  4. Make sure you're using Arduino 1.0

(My problem was that I was still running version 022.)

Hope this helps!

(Thanks, Mike Ferguson!)

Originally posted by Poofjunior with karma: 88 on 2012-05-22

This answer was ACCEPTED on the original site

Post score: 1


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.