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

Your robot can be more than a simple automated machine with the power of ARC Pro!

Netherlands
#17  

Well, the main reason is speed & costs. I want to make my robot travel at, atleast 20km/h (prefferably more)and keep the costs low(better sensors cost more). So if we add some math to this idea and the sensors I'm using, the following comes up:

Desired speed: 20km/h = 5.56m/s. Max range of the pings = 4.5m. Number of sensors I'm using = 5. (having one or more that turns to read at different angles would not be fast enough). Max read speed, about 100ms (via EZ-B) per sensor to prevent channel flooding.

Time to read out all sensors: 5 * 100ms = 500ms = 0.5s

Distance traveled within reading time: 5.56 * 0.5 = 2.78m

So this means that my robot will have travelled almost 3 meters before the next reading. And this is asuming these sensors dont give false readings. This is also without taking other processes in to account. E.g. reading out compass, controlling servo's/kangaroo, etc.

Now with an arduino, I can do the same, but the read outs are much faster as I don't have to keep in mind any channel that will be flooded. It can read out a ping sensor every 29ms(faster would cause interferrance between sensors). And don't have any delays with processing the sensor results(from EZ-B to pc and back). Meaning with 5 sensors the max read time would be 145ms. Making the distance traveled within reading time is about 0.8 meters thus leaving more time for other tasks.

It's pretty much the same reason as to why you should always keep 2 seconds of distance while driving a car between you and the car in front of you. If your sensors (your eyes) notice that the car in front of you brakes suddenly then on avarage it would take your EZ-B (nerves) and pc(brain) about 1 second to notice and react other second to brake.

My last reason is because I can and learn from it.

PRO
Portugal
#18  

That is very fast robot. So what you are saying is that the data from the ping sensors is not sent to EZB and that the arduino controls the motors. If that is the case then you are right, its faster. I saw your video and the reaction time of the motors is very slow. As i said, i have my sensors wired to the EZB and the reaction is instant. So i wonder what is causing that delay. Regards.

#19  

Sounds like a very cleaver and needed change. Nice thought process. It's fortunate you're talented in writing the needed code to do all this.

Netherlands
#20  

@Proteusy Thats exactly what I'm going for.

As for the delay, I can't get a faster response time between Pc > EZ-B > Arduino and back than 1000~1100ms. My first solution was to have the Arduino read out the pings and relay that to the EZ-B which didn't help. So now I'm going to try it this way.

@Dave Thank you for the complement. But it's more like a lot of elbow grease rather than talent:D. When ever I try to make something, I split it up into small steps, so I can focus on smaller problems and not get blinded by the whole.

For example for this project I want to achieve object avoidance and navigation. Thinking about it, just like it is, I would have no idea where to start, but if you "zoom" in further and think about it in smaller parts you can make a list of on what you need to achieve this goal:

  • Reading ping sensors
  • Controlling kangaroo X2 via serial
  • Controlling servo's
  • Splitting up serial data into separate variables
  • etc.

Once I have a list either in my mind or actually on paper I start at the top. First I need my robot to know when something is in the way, so I started searching on how to achieve this, starting with 1 sensor. Once I found out for the first one I started looking on how to add more and reverse engineer it to my own needs.

Second step I made was motor control, from experience with the EZ-B I already knew I would need serial commands to control the Kangaroo X2, so I started looking for a way to send and read serial commands and reverse engineer that aswell to my needs. i.e. making loops for Accelerating, decellerating and stopping.

etc.

I try to apply this to every small part which together make this project, step by step, problem after problem and test after test. I try to make a part of the code every week or every few weeks and hopefully when I get to the end it works. If it doesn't I'll look for a different approach.

Netherlands
#21  

I finished rewiring my robot to have all movement controlled by an arduino mega. I also finished the first part of the firmware for the arduino. It now does basic object avoidance, based on objects in front or on the sides.

Static test:

Freeroam test:

So far so good. Next up is adding compass to the navigation system. And reworking the plugin to also include robot control with arduino only.

PRO
Portugal
#22  

That does not seem to be 20km/h or faster. Also the turn angle is very low.

Netherlands
#23  

@Proteusy If I drive something... It doesn't even matter what... With 20km/h in my house, if something goes wrong, I will have to scrape whatever is going 20km/h from whatever it crashed in to. As this was one of it's very first tests on the ground to drive at higher speeds indoors would be dangerous and irresponsable. Besides it being unsafe, with 20 km/h it would cross my living room in 2-3 seconds, so there's not even a point in trying.

This was just one of my first tests after rewriting the code for the arduino... It took me 2 weeks to get it working without a hitch and I thought I would share it. So far it drives forwards until it finds something, then it'll either stear away or backup and then stear away after which it will continue on it's marry way until it finds something else.

If I were to test my robot at full speed it will either be a static test, where my robot will stand on blocks, or outside, which will not happen until I can command the arduino with the EZ-B and I'm confident it will function propperly.

#24  

@ budel0, you have come a long way and it looks real great. I look forward to more videos and hope that you might share with the community when finished.

Nice work.