First Javascript post ever! Wohoooo… I guess…
Or not. I actually hate it, rather passionately too ( especially after trying typescript ).
http://barankahyaoglu.com/robotics/bug/
Anyway,
I’ve done this little simulation after the first day Robot Motion Control and Planning class. It simulates the behaviours of 3 different bug algorithms ; Bug 0, Bug 1 and Bug 2. Creative names indeed.
I’ll just copy paste the description here as well;
All robots ;
have tenticle sensor ( no range ).
have no information other than the relative position of the goal.
Bug 0
It moves towards the goal.
If it runs into an obstacle;
Turns left or right ( this should be fixed but kinda random in my implementation ),
Follows the obstacle until it can freely move towards the goal again.
Rinse repeat.
Bug 1
This one is a little smarter.
Non greedy, rather safe compared to Bug 0 and Bug 2.
It moves towards the goal.
If it runs into an obstacle;
Turns left or right ( this should be fixed but kinda random in my implementation ),
Follows the obstacle until it reaches the starting point again, ( so it travels all around the obstacle )
Keeps track of all points around the obstacle,
Goes back to the one closest to the goal,
Moves towards the goal.
Rinse repeat.
Bug 2
This one is also a bit smart, in a different way though.
It’s greedy.
Finds the shortest path to goal as if there are no obstacles ( going through obstacles ), let’s call it “direct path” It moves towards the goal.
If it runs into an obstacle;
Turns left or right ( this should be fixed but kinda random in my implementation ),
Follows the obstacle until it reaches a point on direct path
Now that it’s back on the direct path again, it just move towards the goal.
Rinse repeat.
It’s unstable though, gets confused or just simply break down on some occasions. By no means a full implementation, just the simple bareboneĀ algorithm, vulnerable to every corner case situation. Don’t even bother trying to use the javascript code for whatever, it’s horrible. ( again, first javascript project ever )
Oh and I used KineticJS for it. Actually using it for almost everything these days, works brilliant with typescript as well. One of the better libraries out there I guess ( not that I know anything about JS community but still )
Excuse me. I am doing a project on bug algorithms. Would you mind send me the source code of bug0,1 and 2 algorithms in matlab or C++.
Thank you very much.
Hey there,
Unfortunately I only have javascript code and it’s already there, embedded in the page.
Shouldn’t be hard to convert it to C++ I guess.
Cheers,
Baran
hi . I am doing a project on bug algorithms. Would you mind send me the source code of bug1 and 2 algorithms in matlab. please
Thank you very much
Hello!
I’m afraid I don’t have anything related to those projects at the moment. But they were all done in javascript (are demos even still alive?) so you can get them from the page. Other than that, I don’t even remember those algorithms anymore, I’m sorry š