Search This Blog

Thursday, August 25, 2016

Ros Tutorials: Getting started, again!

Let's dive right in.

The first step in our master plan is to program the Arduino to communicate with the robot base, so we can move. To interface between the motors and the Arduino, I am using a Sabertooth 2x12 motor controller. I configured it to run with mixed steering RC inputs using the DIP switch wizard here. My DIP switches were set to 011110. To connect the Arduino to the Sabertooth, connect wires from ground, S1, and S2 on the Sabertooth to the GND, P5 and P6 pins on the Arduino. The Sabertooth will act like a pair of servos, so it makes it a snap to program. Here is a basic program to test the base with(NOTE: make sure that either the robot is on blocks or the motors are set to freewheel so it can't go anywhere.):

A quick note about code: all code from this project will be going into the GitHub repository where you can download the latest repository as I work on it.

Back to work. Now try running the code. The robot should move forward and left. Here are a few troubleshooting points:
If the robot is...
  • moving backwards: the polarities on your motors are reversed. 
  • moving right: the motors are swapped in the ports.
  • not moving at all: check your power, circuit breakers, and make sure that the Sabertooth is on. 
If you are having problems, feel free to leave a comment and I'll see if I can help.
My time to write is getting short, so I'm going to wrap it up here. We covered how to hook up the Sabertooth to the Arduino and how to test the motors. Till next time...

Wednesday, August 24, 2016

Ros Tutorials: I'm back!

Let's just say that I got distracted with other things, but I'm back, for a while(I hope)... The major problem I was encountering when I began this project was that I couldn't figure out how to use encoders to publish to /odom(Note: until I get around to adding a code formatter, I will be using bold to denounce code).

After over a year in the corner, I brought the project back out, and I think I found the solution. I had been looking at using RGBD-Slam for publishing odom, but according to this answer on ROS Answers, it is overkill, instead the author suggested using laser_scan_matcher. I'm going to give that a try.

I have slightly refined my hardware and software setup, as the available items have improved. This is not set in stone, but I'm thinking of using a Odroid XU-4 as the computer on board, with the Arduino Mega interfacing to the motors. I'm still using the Sabertooth motor controller.

Let me outline where I think this project will be headed:
  • Use Python to write a node that communicates with the Arduino, and incorporate sufficient failsafes. 
  • Map the values that Python uses with the Arduino to the velocities used in ROS(specifically cmd_vel)
  • Test the Kinect to make sure that it works on the Odroid.
  • Setup the transforms and setup pointcloud_to_laserscan.
  • Make a package with a launch file to run all the needed nodes.
  • Test everything up to here.
  • Make a map.
  • Setup navigation stack.
  • Have fun!
 So, to make each post easy for me to complete and write, I will probably make each one of the above topics into a post or two.

I need your help! You, the reader, showing interest, keeps me motivated to continue. If you would like to help with software, feel free to comment and I'll get back to you. Thank you for your continued support and (I know, it's cheesy) remember to follow and comment.

Edit: I forgot to include the first, most basic, thing: setup the Arduino to run the robot base. This will be the topic of discussion for my first post.