Saturday, June 29, 2013

Larger Arduino robot platform

I started to build a larger platform for my robot. The old platform has three levels and is quite packed with sensors and cables. Since most cables are connected to the Arduino board, I need to dismantle most of the robot when I make changes. Also I wanted to be able to make distance readings in all directions
The old robot is packed with sensors.
I made cardboard templates for most of the hardware to be able to play with layout a bit easier. I decided to make the robot round-ish but ended up making it an octagonal-ish. With centered wheels so it will turn around its center. 
The third wheel is placed on one side and weight is distributed accordingly.

Plywood with cutouts for wheels and cardboard templates for parts
Parts:
  • Plywood 30*30 cm
  • Raspberry Pi Model A
  • Arduino Duemilanove
  • LiPo battery
  • H-bridge 7.4V  3300
  • Power converter
  • 2 * 6V geared motors
  • Servo
  • 2 * IR Sensors Sharp GP2Y0A02YK0F
  • 2 * Ultrasonic sensors HC-SR04
  • Compass HMC5883L
  • Accelerometer and Gyro MPU6050
  • USB-Hub

Before dismantling the old robot 
Lots of parts and cables, My Raspberry Pi model A to the right
The old robot was dismantled in order to find more precise measurements for drilling.

Testing layout with real hardware instead of cardboard
I intend to make distance measurements in all directions. I have mounted two IR-distance sensors and two ultrasonic sensors on a piece of wood. It is going to be placed on top of a servo. An unsolved problem is that I must be able to shut the sensors on and off independently since I have noticed that they interfere with each other.
The new two directional sensor IR and ultrasonic
Most parts are assembled and I have glued the support for the third wheel as well as the servo.

Now waiting for the glue... to be continued...


Thursday, June 20, 2013

Odometry Sensor

Home made optical encoder odometry sensor.
I want to improve the dead reckoning ability of my robot and I intended to build my own odometry sensor for this. A rotary encoder seemed simplest and i bought a IR-cheap sensor for the purpose.


The sensor has been tuned so it senses the relative color of the backside of the wheel and I drew a black and white circle encoder for the backsides of the wheel.

Unfortunately I get very bad results. The sensor is not really intended for this. I have adjusted it so its very sensitive to the black and white color changes but I guess the motors interfere with the measurements.

I think I'm going to buy a better sensor and perhaps new motors.

I also found this resource giving a good overview of odometry sensors.

Wednesday, June 19, 2013

SLAM with imperfect sensors

SLAM from 5 positions joined into a best belief map. Red is particle filter position likelihood estimation.  Green lines are Sonar and yellow are IR distance readings. Rectangles + line shows old and current poses. Circles are 10 cm apart.
I have been very sparse with my blogging but I'm actually getting somewhere with my SLAM attempts. I can now combine sensor-readings from multiple location and the robot moves between poses.

The sensor-readings consists of IR and Ultrasonic distance sensors on a servo taking readings 1 degree apart. resulting in 170 distance readings per pose. I have a compass but I'm not using it right now. These sensor-readings are used to estimate the new position using a particle filter.
Robot with LiPo battery. IR-sensor and Ultrasonic sensor on a servo in the front.
My biggest problem right now is that the sensors behave a bit uncertainly, not just noisy but also depending on material, angle and size of the object you get different readings. I have tried to mediate this by combining the IR with the ultrasonic.

IR has small angle but is sensitive to reflective, transparent and luminescent materials. It also behaves badly on striped materials. And my IR sensor also works ok between 20 and 100 cm.

Ultrasonic sensor has wide angle 15-20 degrees, is quite precise, works on most materials that I know of but is sensitive to steep angles.

Saturday, May 25, 2013

Combining sensor input into maps

Combined heading from compass sensor with distance readings from ultrasonic (green) and IR  (red), black lines are robot headings
Today I started to try and combine several measurements from different sensors into a single picture. I scan the environment using the ultrasonic sonar and IR distance sensors and draw a picture of the robots environment. Currently I do not account for position.

The ultrasonic sensor has really wide angles of 15 degrees making it ideal to scan the environment fast. It also has better range than the IR sensors around 2 meters while the IR sensor starts to give inaccurate readings after a meter or so.

The compass gives really crappy values, but I started on an algorithm to correct it based on linear mapping. I measured 45 degree angles and it seems to work OK. All sensors have a lot of noise on them, some of which I can remove using multiple measurements and making sure to add delays after using servos and motors. I'm thinking of moving all sensor calibration to the Rpi board in order to better calculate noise distributions.

Compass Calibration 


Wednesday, May 8, 2013

Separate power-source for the motors solved the Rpi brownouts.

Background

I have had problems with my RPi rebooting when I run my motors. And I have been told the raspberry pi is very sensitive to power problems. The hypothesis is that the batteries cannot provide enough current to keep all components running. The

Experimental setup

Today I added a second power source directly connected to the H-bridge to test the hypothesis. I hooked up an a 9 Volt battery on the back of the robot. Not the optimal solution since the single battery will probably quickly run out of juice.

9v battery directly connected to the H-bridge

Results


The robot can drive at full speed without any brownouts. The accurracy of the turning is quite bad. The robot turns slightly when it should be driving forward. It also runs in an arc instead of turning on the spot.

Future Work

Next step is to work on improving the predictability of movements for dead reckoning.

Ideally I should give the robot an relative position in meters and the robot moves to that position or very close. For example: Go 0.5 m forward, turn 30 degrees to the right, Go 0.2 m forward.

One of the motors turns a little stiffer than the other. In order to improve the predictability I will first remove the motors and add some oil to the gears. Hopefully both motors will run better. After that I will do a series of tests to try and use PWM to get similar drive on both motors. When that is done another series of experiments to find the error distributions.





Tuesday, May 7, 2013

Finally driving my robot, but it reboots the raspberry pi!

Finally driving, remote controlling the driving through serial commands over wireless network.

Tonight I started to work on code that is driving the H-bridge. The Arduino board is controlling the H-Bridge and I program the Arduino using the Arduino IDE remotely on the robot using VNC. The intended approach is that a program on the Raspberry Pi sends commands to the Arduino over the serial port.

I wrote a little sketch that receives "aswd" letters and drives the H-bridge. The letter 'a' results in 200 milliseconds of turning left, the letter 'd' results in similar time of turning right,'w' is forward, and 's' is backwards.

A first problem is that when I run the motors for a little time the RPi is rebooting, I guess it must be due to current drop or something. I do run the robot directly from the same battery pack as all the other components. Maybe a large cap can solve this? Another solution would be to have another battery just for the motors. For now it seems I can run the robot with lower PWM...

A second problem is that the motors seem to have uneven resistance, this results in the robot turning slightly. I can adjust this by giving the different engines different PWM signals but in order to get good results this must be tuned by experiments. The third wheel also interfers, its a turn-able wheel so when it is in the wrong direction it requires more resistance to turn.

For this project I use github repository, Im not very used to the shell commands so here they are for documentation
git repo https://github.com/dntoll/robot/tree/master/H_bridge
cd sketchbook
git add H_bridge/*
git commit -m "some comment"
git push origin master

Tuesday, April 30, 2013

Order placed on Gyroscope + Accelerometer and new webcam

I just placed an order for a Gyroscope/Accelerometer chip. I intend to use it on my robot to provide better movement readings.

Gyroscope and Accelerometer chip(image src)
I also ordered a mini webcam, the one I currently sometimes produce distorted images when connected to the RPi. Not having my hopes so high on this one but you never know...