ROS and Arduino Motor Control

976 views
Skip to first unread message

William Garrido

unread,
Oct 18, 2013, 11:27:51 AM10/18/13
to hbrob...@googlegroups.com
Hi,

My new robot design has lead me down the ROS path. I am trying to decide how to handle motor control between ROS(BeagleBone Black) and an Arduino Due. 

For you guys who have more experience what would be the way to go?

1. ROS sends high level commands, like move forward 3 feet and such

2. ROS sends low level commands motor 1 forward at speed and so forth 

3. Or I could do left and right side since I am using a tank like system with 4 motors? But if ROS can control each motor then stuff like slippage can be detected as well as tension on the track can be adjusted. 

Or I am thinking too much into this.

The Arduino Due has plenty of CPU power and its dedicated to motor control and encoder input. Maybe a few sensors but nothing for avoidance, that would be directly connected to ROS on the BBB.

Right now I have ROS running on the BBB with ROSSerial receiving temp and humidity from the Arduino Due. So my base code is working.

I will be posting soon how I got ROS running on the BBB on my blog www.mobilewill.us

Thanks,
-- 

anfederman@comcast

unread,
Oct 18, 2013, 12:51:22 PM10/18/13
to hbrob...@googlegroups.com
Use Patrick's ROS Arduino bridge.  I have tested this with both the Rpi and BeagleBone.
--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+...@googlegroups.com.
To post to this group, send email to hbrob...@googlegroups.com.
Visit this group at http://groups.google.com/group/hbrobotics.
For more options, visit https://groups.google.com/groups/opt_out.

William Garrido

unread,
Oct 18, 2013, 12:59:38 PM10/18/13
to hbrob...@googlegroups.com
I found that too after I setup ROSSerial. I haven't looked in depth with that one. I guess it wouldn't take much to modify it for my motor controller and encoders which I have a library for already.

I am using the Rover 5 and the 4 channel motor controller for it as a deve platform till I get the basics down and upgrade from that.

Did you run ROS has a host on the BB? I am not use a PC at all. The BBB is doing everything or rather will be.

Have you setup web control on the BB? I want to be completely stand alone, so other PC needed. 

anfederman@comcast

unread,
Oct 18, 2013, 3:53:16 PM10/18/13
to hbrob...@googlegroups.com
That was done using Groovy and the master node on the BB or Rpi.   We used WiFi to run things like Rviz or Teleop on a laptop off the robot.
 

William Garrido

unread,
Oct 18, 2013, 5:18:28 PM10/18/13
to hbrob...@googlegroups.com
Thanks I will check it out.

I am probably going to write a web front it so that you can use any device. Then probably have a c++\python app on the BBB to take care of all the autonomous control. I also plan to have it interface with other robots and other non-robotic systems.




--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+...@googlegroups.com.
To post to this group, send email to hbrob...@googlegroups.com.
Visit this group at http://groups.google.com/group/hbrobotics.
For more options, visit https://groups.google.com/groups/opt_out.

Patrick Goebel

unread,
Oct 18, 2013, 9:31:37 PM10/18/13
to hbrob...@googlegroups.com
Hi William,

Feel free to fork a copy of the ros_arduino_bridge repository and modify it for your motor controller and encoders.  If you like the result, send back a pull request and we can incorporate your hardware support into the package.

--patrick

http://www.pirobot.org

William Garrido

unread,
Oct 21, 2013, 11:42:36 AM10/21/13
to hbrob...@googlegroups.com
Thanks, I think that is what I am going to do. 

Here is the controller I am using


I already have a library for it, I wrote last year. SFE is acutally using it now ;)

Now for the encoders do you think I should just use two of the 4 or try to include all 4?


--
You received this message because you are subscribed to the Google Groups "HomeBrew Robotics Club" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hbrobotics+...@googlegroups.com.
To post to this group, send email to hbrob...@googlegroups.com.
Visit this group at http://groups.google.com/group/hbrobotics.
For more options, visit https://groups.google.com/groups/opt_out.

William Garrido

unread,
Oct 21, 2013, 3:47:39 PM10/21/13
to hbrob...@googlegroups.com
Maybe you guys can help that have more experience with the ros arduino bridge

I forked it and added most of the code for the Dagu 4 Channel Motor Controller, but I having a problem compiling.

Here is my version of it. 



encoder_driver.ino: In function 'long int readEncoder(int)':
encoder_driver:39: error: 'motor1' was not declared in this scope


But this is called after the motors are defined so not sure why its doing this. Not sure where to go from here.

William Garrido

unread,
Oct 21, 2013, 4:35:52 PM10/21/13
to hbrob...@googlegroups.com
I found some other bugs in the library and fixed another thing for compiling on the Arduino Due.

If I get the one issue with the encoder function I can do a pull request for everything. 




James Nugen

unread,
Oct 21, 2013, 5:25:57 PM10/21/13
to hbrob...@googlegroups.com
It's due to the order the IDE concatenates the source files together.  'encoder_driver.ino' is added before 'motor_driver.ino', so 'motor1' doesn't exist when you reference it.

I'm not sure of the best way to fix this issue.  Apparently, you can't pre-declare an object in C++:

A quick fix, that I almost hate to mention, is to rename either 'motor_driver.ino' or 'encoder_driver.ino' so that the motor file comes first alphabetically.  Though using 'qencoder_driver.ino' actually makes sense!

-James Nugen



On Mon, Oct 21, 2013 at 12:47 PM, William Garrido <blacksp...@gmail.com> wrote:

William Garrido

unread,
Oct 21, 2013, 5:33:28 PM10/21/13
to hbrob...@googlegroups.com
I ended up moving the encoder functions to motor_driver.ino since its the same library anyway.

Hmm maybe I will give that a try. I have had this happen before now that I think about it. 

Other than testing on the actual robot it compiles. But I am only using 2 of the 4 encoders.
Reply all
Reply to author
Forward
0 new messages