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