Netherlands
Asked — Edited

Ping Navigation Plugin

Hey everyone,

For the last 4 weeks I've been working on my own navigation plugin, that uses ping sensors for it's distance sensing and I ran in to a few problems... Mainly that I'm not a very good programmer... Last time I made a program was in college and that was still in visual studio 2006... and about 2 years ago... But I started with full conviction and dedication that with the power of the internet everything is possible. And so far I find it kind of addictive eek ...

The Goal The goal of this project is to make a plugin that makes my robot and other robots semi autonomous in their navigation. The idea is to have a window with a picture of a robot in the middle and where you click it will go to, both on the screen and in reallife.

The robot will use atleast 5 ping sensors on the front, a Kangaroo for positioning and a compass for determining the direction. Also I will use an arduino to read out the ping sensors and possible others aswell. It reduces the amount of ports required on the EZ-B by a lot.

Short term goals Making all base functions work. By this I mean:

  • Drive controls: steering, backward & forwards, position & speed control.
  • Reading out sensors: ping sensors, compass.
  • More pretty gui features.

Long term goals

  • Static object avoidance.
  • Applying a tangent bug algorithm for navigation or similar.

When it works Goals

  • GPS for outdoors.
  • Mapping(possibly a sharp IR sensor that scans).

Current state So far I've been working on a config panel in which one can add all the required data and test features on the robot. This is both for testing and for me to learn how to make each feature so I can I apply that later on in the project.

Some images: Mainform

User-inserted image

Config General Settings:

User-inserted image

Config Distance Sensor settings:

User-inserted image

Config Drive control settings:

User-inserted image

So what's working so far...

  • It remembers stuff... So all variables are saved and loaded.
  • It calculates positions based on set angles and set max range.
  • It controls servo's.

My current issue: I have not been able to get the UART working... It does nothing... I have no idea what the problem is. I tried reverse engineering it from the EZ-SDK and the Dynamixel plugin that DJ made without any luck. I usually get a long way with a clear example, those got me so far my entire plugin.

I want to use the UART to control the kangaroo and the arduino. For the kangaroo I need to:

  • Initialize the baudrate at 9600.
  • Initialize the motors by sending: "1, Start, 0x0d" and with a delay(250ms works) "2, start, 0x0d".
  • Set the motor speed by sending: "1, s-30, 0x0d" and with the same delay "2, s-30, 0x0d".

It's a work in progress, any help would be much appriciated, I will upload it once I complete the long term goals.

Also a many thank you's out to DJ and CochranRobotics for their plugins without I would have probably ran a ground way sooner:D


ARC Pro

Upgrade to ARC Pro

Unleash your creativity with the power of easy robot programming using Synthiam ARC Pro

#25  

This is undeniably a very smooth, quick and nicely working avoidance system. I really like the quick responce and the way it maneuvers it's self back into the open.

Am I right to assume that you've totally removed the EZB from the navigation part of this system and given it all over to the arduino mega using your code? Getting that code right and working on it for that long must have been mind numbing. However I'm sure you have a huge satisfaction factor. I'm amazed at what people with your coding skills can do. I wish I had the time and ambition to learn coding to your level. Nice work! ;)

Netherlands
#26  

merne Thank you for your nice comment, the goal is to improve it and add more features to the arduino and my plugin. Once it's been completed or if requested I can share what I made. I'm trying to make my plugin as "neutral" as possible so others have a use for it aswell, however I will first make everything so it works for me and then I'll expand on it and make it work for others. The arduino part can be modified to fit every robot.

Dave Thank you for the kind complements:D. You guessed it right, I moved all of the robot controlls (kangaroo & servo's) and sensors(ping & compass) to the arduino. The communication over wifi made the processing too slow and the best way to increase the speed was to take out the wifi and process it locally, making it about 40 times faster:D.

However it was rather frustrating getting the object avoidance to work... It used to have this problem if you would block the front and either one of the sides that it would crash the arduino, causing it to drive back and forth while constantly turning left and right... But the problem was that I based the object avoidance on objects being on either the left or right side instead of basing it on objects in front of it. Once I based it on that it worked like a charm with out crashing:D.

My current hurdle is the compass part. I want to have to possibility to send a heading and make it navigate towards that heading while avoiding obstacles. This way I could use the EZ-B to send the heading(maybe in the future coördinates) to the arduino from the pc and also control it manually. But as it was yesterday it kept on driving in circles... And it wouldn't stop going in circles:P. But I'll solve it at some point, one step at a time.

Netherlands
#27  

Another week another succes with the programming. I managed to combine obstacle avoidance with compass navigation. Now it's possible to set a certain heading and the robot will stear towards that heading within 1 degree accuracy. It can be placed towards any angle and it will correct autonomously to the set heading. While this is happening it will also check if there are no objects in it's way. If it finds an object it will disable the compass course corrections until it passed the objects that are in it's way. After which it will enable it again and return to the set heading.

The next step in this project will be reworking the plugin to include controlls which are used when all robot controlls are controlled by the arduino.

#28  

Sweet! :) You guys up north are truly geniuses. So much cool and stuff coming from the Netherlands and Canada. Must be all that cold weather.

Netherlands
#29  

So instead of doing what I said I was going to do I kind of did it, but did something compleetly different aswell... I made the foundation in the plug in where you can select a radiobutton to control the general robot controls via arduino, it doesn't do much more. I'll continue with that later, what I instead did was I scored myself an Adafruit GPS Ultimate v3 breakout board. Which is a GPS receiver.

For the last 4 days I've been playing around with it, got it working on an Arduino UNO, but then... The struggle began... What ever I tried I could not get it to work on the Arduino Mega 2560 thats currently in my robot... It wouldn't return anything no time, no latitude, no longitude... Not even NMEA sentences... Which was really frustrating... And even worse the solution was ridiculously simple... As always... I had to change one word and two signs in the sample code and it worked... Took me 5 days to find which ones but it works!

User-inserted image

So what does this mean, well after reverse enginering the sample code in to the code for the robot I can now request it's GPS position. This means that once I've figured out how, you'll be able to send waypoints and the robot will navigate there, combined with obstacle avoidance. My main reason for adding something like GPS is that it makes it easier to go from A to B with objects in between.

Going from point A to point B in a straight line is easy, set out a heading and the distance that needs to be coverd and you're set. However once an object is detected the robot will have to navigate around it, but continuing behind the object in the exact heading and spot compared to where you started navigating around it is very very hard. Its not impossible, but to achieve that you will need accurate motors, accurate encoders and a very good system which keeps track of the changes in position and actions so the robot will end up in the right spot. Because keep in mind your robot doesn't know where it is in this case. It only knows it's heading, the distance it needs to travel and if there's something in front of it.

By adding GPS, the robot will know where it is, knowing its destination and its own position, it will know what actions are required to reach its destination. It won't be accurate, the box says 1.8m radius(still quite accurate, for it's price) but 1.8m is still more accurate than nothing.

Next step is to make a system which stores waypoints and a system which calculates the heading based on latitude and longitude. The last one will be the hardest as it requires a lot of math, based on the curvature of the Earth and geometry. (Geometry wasn't my strongest course in school, give me algebra any day:D)

Netherlands
#30  

Time for a small project update. Since I got the GPS module working I've managed to find the correct formula's to calculate the bearing and distance between two GPS positions. I combined this with the compass course correction code I made earlier and started a 4 week long period of testing.

Lets just say it was a very frustrating 4 weeks in which I only yesterday at 2 am fixed the last problem... The main problems I had were that the robot wasn't driving in the correct direction...

The first problem was that certain sequences in the code were wrong, which didn't take too long to find each of these. My biggest problem was that the compass I was using didn't give the correct heading, mainly caused by not being calibrated and Adafruit the manufacturer not giving support on how to calibrate it... In the end I fixed it by using the libraries from Pololu...

The last problem was that the calculated heading was off by 360 degrees... Which is a rather interessting problem... Eg. the actual heading is 50 degrees, but it will calculate 310 degrees... With a simple tweek that problem was solved.

And finally today I could place my robot on the ground, set a gps position and it would go there and then stop at the set position. Which is great.

But it's not perfect yet. I have found new problems:

  • The compass is getting EMI, when the motor's are running the compass heading fluctuates ±40 degrees... It gets to the desired location, but not very smoothly.
  • Object avoidance: the real world is harder to evade that my living room... The robot got stuck in a lot of corners were it ended up going back and forth until I turned it off...

But in conclusion of this short update it works:

  • Object avoidance, it works but corners are hard.
  • Compass navigation, flawless. It changes course based on compass data, though the actual compass needs some attention, to remove/reduce the interferrence.
  • GPS navigation, as planned. It calculates the heading and distance between two GPS coordinates within 0.5% and navigates to the calculated position within 1 meter. (Higher accuracy would require a beter GPS receiver with ground station and way way way way complexer formula's to calculate the data based on the Earth not
    being a perfect ball, then you can calculate up to 1 nanometer accuracy with a fixed referance. In short too much work and not necessary.)

Next goal will be to compensate or reduce the interferrence on the compass and improve the object avoidance.

#31  

How fast will your robot be when fully functional? If moving greater than 1km you could switch your heading from compass to gps to eliminate the EMI issue. Other than that, shielding and distance. Maybe put the compass on a poll. You shouldn't need to move it far to dramatically reduce the emi (inverse square law).

Alan

Netherlands
#32  

@Alan The goal is to run it at about 20km/h, as for the distance, didn't really think about it. Though I am going to look into the gps compass. The only thing I dislike about the compass of the GPS is that it has a fixed update rate, which I currently set to 5Hz and the LSM303(compass module) has up to 100kHz.

But I do like the idea of a combination of the two, mostlikely the EMI will increase on higher speeds, so it might be a work around to reduce speed when using the magnetic compass and at higher speeds the gps compass. Though if the EMI actually reduces at slower speeds is something I will have to test. I will also test it at higher speeds, because it's currently running at 1/15th of the planned speed.

As for the pole, unfortunatly it's already on a pole, which is about 20cm long and I thought that would be enough. But I'm going to try and see what happens when I wrap it in aluminum foil and other search for some other EMI insulation solutions.