Search This Blog

Wednesday, June 17, 2015

ROS Tutorials: Configuring your robot

Welcome back to part 3 of our series on getting started in ROS. Today we will setup the robot that we will be using. For beginners I reccomend a 2 motor platform such as a electric wheelchair(That is what I am using) or a Roomba base. If you want to shell out the cash and get a premade kit, just get a turtlebot. They are pricey but they work out of the box with as little work on your part as possible. If you choose the turtlebot you have all the code done for you. It is preferable that the platform is large enough to hold a laptop and, if you choose, a Microsoft Kinect. We will use the Kinect later for SLAM(Simultaneous Localization And Mapping). My setup uses an electric wheelchair with custom control circuitry, some scrap wood, and a nightstand bolted onto the chair as a platform. I admit that is crude but it works for me.

My base started out like this:
(Sorry for the bad photo)

After a lot of modifying(See here) I got to something that was at least usable.



I have a power inverter for the laptop and Kinect and 12V, 5V, and 24V for all of my low voltage needs. Due to my blowing one of the fuses by reversing polarity, I am currently using just an extension cord  for power.

To start hack your motors.
First figure out how it gets powered. In my case the motors got 24V.

Then hack the safety measures(if any). On my robot I have brakes on the motors that will not disengage until they get 24V applied to them.

Once you've done that, figure out your batteries. The wheelchair I bought had dead batteries so I was able to choose what batteries I wanted. I settled on two 35AH 12V AGM batteries(Click links for definition of terms). The frame had Powerpole connectors on all of the electrical connections so I kept those and just soldered jumpers to them. The batteries are wired in series to produce 24V and each battery has a circuit breaker on the positive lead. A 20 Amp DPDT Switch disconnects both batteries from the circuit and I use a terminal block to route all of the connections.

Now enough of my bragging and showing off, let's get back to your robot. It really doesn't matter how you wire up your 'bot as long as your use the Sabertooth to run the motors. Oh yeah, I almost forgot. No really, I'm not kidding...

A word about encoders: Encoders are the heart of your robot. Without them you cannot drive your robot with ROS... I reccomend starting simple and working your way up. I have photointerrupters, which are as simple as can be. It is, in a nutshell, a light on one side and a light sensor on the other that senses when a toothed disc turns. It produces one pulse for every tooth on the wheel regardless of direction. It requires more coding than some other methods such as SPI drivers because you need to know the direction of rotation of the motors. I pulled my encoders from an old HP printer and used laminated paper wheels that I printed off the internet. I then attached the wheels directly to the wheels and made a wood boom to hold the encoders on the edge of the laminated wheel. You can just barely see them on both sides of the robot in the image above.

Enough of that, configure your Sabertooth with the tool I mentioned in a previous post to use microcontroller simple serial mode.

Now it's time to wire it all up! Connect the S1 port on the Sabertooth to pin TX2 on the Arduino Mega and connect the signal pins of your photo-interrupters to pins D2 and D3 for the right and left wheels respectively.

Now your robot is ready to roll!

Monday, June 15, 2015

Ros Tutorials: Beginning...

Welcome Back!
Pre reqs for this tutorial:
 A computer running Ubuntu 14.04LTS
An Internet connection

Today we will start with setting up our computer and doing some tutorials. The ROS Wiki has great instructions on how to do that. To install ROS follow the instructions here:  http://wiki.ros.org/indigo/Installation/Ubuntu We will be working in ROS Indigo. A newer version(ROS Jade) has been released but there is not sufficient support yet to make it easy for beginners. Once you have done that go through as many of these tutorials as you can. Tutorials 1.1 through 1.9 are mandatory, but optionally if you want to make it easier on yourself do all of the tutorials. All the tutorials are listed here: http://wiki.ros.org/ROS/Tutorials Just make sure that you choose Indigo for your distribution.

Note: I because I am lazy took the hard route and a. did not do all of the tutorials and b. did not learn python or c++ before starting. I highly reccomend that you don't make the same mistake I did and go through all of the tutorials and learn one of those languages.

Thats all for now...

ROS and Arduino: A Beginner's Guide

As you may have read earlier in this blog, I have started implementing ROS on my wheelchair robot. It has definetely been an uphill struggle but it's going, there is no doubt about that. Between my lack of focus and my not understanding the concepts, I estimate that the project will be "done" in less than 10 years. Just kidding ;-). As I said in a previous post: "Robots are never done".

Back to the topic. As I research more about ROS and the resources for beginners, I see one tiny problem(very tiny): most of the material is geared towards collegiate students and engineers, not as much toward your average hobbyist. So I think I can fix that... I am going to try put down some tutorials here for the people that are just starting out in ROS and trying to make their very own ROS bot. I might as well start here:

If you don't know what ROS(Robot Operating System) is I would highly reccomend that you read the following pages:
1. http://wiki.ros.org/ROS/Introduction
2. https://en.wikipedia.org/wiki/Robot_Operating_System

Here is the hardware that I will be using for my robot(note: all the code and files written will be tailored to this particular setup you may need to change stuff...):

1x Jazzy electric wheelchair(similar to this)
1x Sabertooth 2x12
1x Arduino Mega 2560
2x photointerrupters (I pulled mine from an old printer)
2x 35ah 12V AGM batteries
1x Microsoft Kinect for Windows Note: I am not sure about the new Kinects compatibility with ROS so in this set of tutorials I will be using the old Kinect which now retail for less than $60, such as here.
custom power wiring (a word about this later...)
1x Laptop running Ubuntu
1x Power inverter 120W

All of the sample code will be stored in my wheelchair_info repository on github, which is accessible here: https://github.com/kk6axq/wheelchair_info For now the ROS package and Arduino firmware is here: https://github.com/kk6axq/ros_arduino_bridge/tree/indigo-devel

The custom wiring I used was basically a switch, a terminal block, and two circuit breakers. I have one circuit breaker per battery on the positive line and I have wired the batteries in series as the brakes on my motors only turn off at 24V and I also get more wattage to the motors.

For connections to the Arduino Mega I have connected the S1 line to the sabertooth(see note below) to TX2 on the Mega and I have the signal line of the encoders connected to digital pins 2 and 3 on the Mega. I almost forgot, don't forget to connect the ground pin on the sabertooth to the GND pin on the Mega.

Note on the care and feeding of your Sabertooth motor controller: This controller is feature filled and therefore requires some setup. To set the DIP switches, Dimension Engineering has made a handy wizard that will ask you a few questions and show you the proper diagram. It is available here: https://www.dimensionengineering.com/datasheets/SabertoothDIPWizard/start.htm. Also DO put circuit breakers rated for a less than 12 amps as without an additional heatsink, the Sabertooth will literally be toast(ed). Not good...


Thats all for now.