Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
United Kingdom
Asked — Edited

Ping Roam 1.2.0 (In Progress)

I guess this could be classed as a blog type of topic. The idea is to show some insight in to how I work, how I go about updating the scripts etc.

I decided to totally scrap everything I had done on Ping Roam 1.2.0 a couple of days ago when the ControlCommand ScriptStartWait was brought to my attention. I wanted to use this, I knew it could be a better way of doing the whole Ping Roam script so out went what was done (despite it being around 98% complete).

So, since I was starting again on 1.2.0 the best thing to do was to print out all 10 pages (510 lines) of Ping Roam script and start to make some notes (this was while fighting the flu and spending any moment not at work in bed).

A couple of days later I ended up with a bunch of paper which looked exactly like this;

User-inserted image


User-inserted image


User-inserted image


User-inserted image


User-inserted image


User-inserted image


User-inserted image


User-inserted image


User-inserted image


User-inserted image


Now it's ready to start plugging in to ARC in it's new, modular, individual scripts. What better control for that than the Script Manager, aptly renamed as PingRoam

User-inserted image



Next post I will be posting up all of the sub routine scripts in their current state (untested) along with notes etc.

Hopefully this (and future posts) will help you understand how I tackle the process of turning ideas into reality and take an old script and add in new functions, refine it and make it run better. If not then it's at least a record for me:D

AI Support Bot
Related Content
Synthiam
Canada
#1  
Love it. Keep up the good work man. Thanks
#2  
Oh Boy! You are so good at this. Can't wait to see this.

Mel ;)
United Kingdom
#4  
19th November 2013

After rewriting all of the sub routines I wanted to check I had gone about everything the best way, removed anything that was now redundant and had no bugs or errors. Again, the easiest way to me is to print it all out and mark it up with my scribbles...

So, 13 pages of code later I end up with this little lot. Some needed a lot of changing, others needed very little.

User-inserted image


User-inserted image


User-inserted image


User-inserted image


User-inserted image


User-inserted image


User-inserted image


User-inserted image


User-inserted image


User-inserted image


User-inserted image


User-inserted image


User-inserted image



If you read through the notes made on each of the scripts you can see a few major changes were made that I hadn't thought of first time round.

Firstly, the intelligent turning was changed from an IF loop to use Ping_Wait, it's less code and more efficient. Rather than having to check the sensor value against the set value looping around the if statement the code simply waits until the ping value is higher than the set value. The results are practically the same but Ping_Wait is a command for a reason so it should be used.

The other major change was with the intelligent turning there was no need for any kind of boxed in checks, escape code or left, right, left, right loop checks. So all of those routines were removed entirely.

So now it's just a case of updating the code in ARC, re-building a test robot and getting it all tested out to make sure it performs as planned. Basically it's now back to where it was before I scrapped the original update for the individual scripts.
#5  
Great work Rich! Can't wait for the video.
#6  
" Rich and sweet " nice work! I bet there will be a lot more scripts rewritten now!
United Kingdom
#7  
The great thing about doing it this way, with the sub routines as individual scripts and started with control commands is that to change this to use 3 fixed sensors rather than a sweeping sensor is very easy to do. Or to add in an IR sensor with the ping, do some fancy math and combine the readings for a more accurate detection can all be added in to the GetPing routine. The possibilities are endless and the effort required to add new things in or change old things is minimal.

All scripts have been rewritten and added to the ARC project now:) All that's left is to test it... and make a robot to test it on first. Ideally something small so I can mock up a small course in my house for it to navigate itself around, since I have lots of large open areas but not large enough to make a course for anything the size of Melvin or Jarvis.

Video & tests will come as soon as I find something with 2 motorised wheels, a space for the servo and sensor and the EZ-B... which doesn't cost a lot... I guess I'm going to the toy shop this weekend:)
United Kingdom
#9  
Still need to find a suitable test platform. The code is all written but I've not had chance to run any tests.

I may use Jarvis' base and do some quick tests but he is too big, I need something small so I can test come complex navigation in like a maze of sorts. (my house is far too open and straight, I need lots of small corners etc. to really test the smart turning and boxed in).
United Kingdom
#11  
Due to life I'm kinda running behind with a lot of things to do with my robots and scripts so I've decided to throw this up as an Alpha release. What this means is I have not actually tried to run the code on a physical robot (since I don't have a suitable robot platform yet - ordered one today which should be here this week though).


The changes for Version 1.2.0 are;

1. Changed escape return to use else therefore avoiding reversing and turning after an escape.
2. Added in stop and sleep before any forward or reverse movements.
3. Added emergency stop script.
4. All ports are now constants, use ports specified in the head of the code or port summary or adjust the code to suit your ports.
5. Smart turning for avoidance. Robot only turns the amount it needs to in order to miss the obstruction.
6. Rewritten in Script Manager named PingRoam with Control Commands and ScriptStartWait.
7. Removed all instances of Halt() (there was a compatibility issue previously however they are redundant anyway.


The (attempted) improvements;

1. Better, smart turning which should remove the requirement for any boxed in or escape code. The robot will turn until the path is clear rather than turning for a fixed amount as previously written. This should also avoid constant "bumping" in to the same wall.
2. Script manager used with ScriptStartWait to separate the different portions of the code for easier alterations and improvements in the future.


The project;
Download it from the EZ-Cloud or click here


How to use
You can either merge the project with your own and import the Ping Roam Script Manager (check each script for required ports for Ping Sensor, servo etc)
User-inserted image


Or you can open the project and build yours around it, or just try it unaltered.


Please, if you choose to try it out, let me know any feedback, comments, bugs, problems etc.


I should be testing it on a physical robot just as soon as I build one suitable:)

Full explanation of the code, walking through each step of how it was written, what it does, why it's there etc. will also be coming as a tutorial on EZ-Script in the near future.

And finally, please feel free to adapt the scripts however you wish. All I ask is that you share it if you make something awesome and give credit where it's due if you make something that earns you fame and fortune:D
United Kingdom
#12  
Update for today...

My small 4wd robot platform turned up yesterday so I immediately built it. It's nothing special, just a Dagu 4wd plastic thingy...

User-inserted image


However, the problem was, I was running it on a 2S LiPo (fully charged) and let's just say it went from one end of my house to the other end of my road in around 3 seconds!.. It's faster than my Audi S5!.. Well, nearly... Suffice to say, it couldn't react fast enough to avoid anything so I ended up with a slightly damaged skirting board and had to put the bluetooth module back in the header.

I just found out the recommended voltage for the motors is 3v, so that's the problem, I was feeding them with around 8v:D So I guess some regulation of the voltage or using PWM to restrict the speed is required before I can test this again but it's certainly progressing again.

Hopefully I'll have time tonight to play again and give it a good test though:)
#13  
Tested this tonight works awesome. Running 1 ping sensor does a really good job of avoiding for the most part. There was a few times he boxed himself in and couldn't get out. Other times he would get boxed in and make his way out . Going to keep playing with it
United Kingdom
#14  
Awesome:) It's great to see the new turning script looks like it works for the most part, I assume the times he was boxed in could be down to the sensor but we will see - I have a plan for that (although it may be at the cost of a slower response).

I'm back home now although it's 3am but tomorrow (which is technically today) I'll hopefully have chance to have a play with the rover and get it working at a suitable speed for testing and refining.