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;
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
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
Love it. Keep up the good work man. Thanks
Oh Boy! You are so good at this. Can't wait to see this.
Mel
Thankyou for sharing it
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.
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.
Great work Rich! Can't wait for the video.
" Rich and sweet " nice work! I bet there will be a lot more scripts rewritten now!
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
How is this coming?
:)