ROBOTC.net forums http://www.robotc.net/forums/ |
|
Heuristic algorithm http://www.robotc.net/forums/viewtopic.php?f=15&t=5616 |
Page 2 of 3 |
Author: | Ernest3.14 [ Thu Jul 18, 2013 12:07 am ] | |||||||||||||||||||||||||||
Post subject: | Re: Heuristic algorithm | |||||||||||||||||||||||||||
That's interesting. Using the code you provided, I got these errors:
They are both on line 105, in `void PrintWavefrontMap()`:
On my machine it seems like RobotC doesn't like it when you chain two operators (something to do with overloading behind the scenes?). Changing the aforementioned conditional to this made the code compile for me.
|
Author: | Ernest3.14 [ Thu Jul 18, 2013 12:24 am ] | |||||||||
Post subject: | Re: Heuristic algorithm | |||||||||
The motors aren't very accurate (surprisingly accurate, really, given the size), and there's just a tiny bit of deviation, which eventually accumulates into a large error. |
Author: | Azhari [ Thu Jul 18, 2013 12:25 am ] | ||||||||||||||||||||||||||||||||||||
Post subject: | Re: Heuristic algorithm | ||||||||||||||||||||||||||||||||||||
why we got different error? |
Author: | Azhari [ Thu Jul 18, 2013 12:39 am ] | ||||||||||||||||||
Post subject: | Re: Heuristic algorithm | ||||||||||||||||||
it the surface also affected the movement? Is the battery level also affected? any suggestion? 4/10 try only success... |
Author: | Azhari [ Thu Jul 18, 2013 10:39 pm ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Post subject: | Re: Heuristic algorithm | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
i'm already solved it. tfriez says,
thanks for your help, now i can focus on using A* algorithm that i'm not sure how to coding it yet... ![]() i will share my coding after i'm complete as contribution for other ![]() |
Author: | Azhari [ Thu Jul 18, 2013 10:55 pm ] | |||||||||||||||||||||
Post subject: | Re: Heuristic algorithm | |||||||||||||||||||||
why the display output come out different?
and
|
Author: | Ernest3.14 [ Fri Jul 19, 2013 3:22 pm ] | |||||||||
Post subject: | Re: Heuristic algorithm | |||||||||
Looks as if the output is sideways? Try switching your x and y and see what happens.
|
Author: | Azhari [ Mon Jul 22, 2013 10:34 pm ] | ||||||||||||||||||
Post subject: | Re: Heuristic algorithm | ||||||||||||||||||
i'm already change and it become more confusing then before ![]() don't know which path it take. ![]() |
Author: | Ernest3.14 [ Tue Jul 23, 2013 12:36 am ] | ||||||||||||||||||
Post subject: | Re: Heuristic algorithm | ||||||||||||||||||
Sorry about the last post--my machine didn't have RobotC, so I kinda just glanced at your code ![]() I ran your code through the debugger. It's really handy. ![]()
Are you sure you want to assign `printRow` to `buffer` again? Take a closer look at what is inside `buffer` when you do this. |
Author: | Ernest3.14 [ Tue Jul 23, 2013 12:39 am ] |
Post subject: | Re: Heuristic algorithm |
Another hint: you check first whether the number is less than 10. But later on, you check if it is 1 or 2. If you run this through the debugger it will be very clear; if the number is indeed a 1 or 2, then it never reaches the bottom of that logic. You'll have to check those first, and then do an `if... else...` at the end to include everything else. |
Author: | Azhari [ Tue Jul 23, 2013 5:41 am ] | |||||||||||
Post subject: | Re: Heuristic algorithm | |||||||||||
maybe you should see for yourself..
|
Author: | Ernest3.14 [ Tue Jul 23, 2013 2:28 pm ] | |||||||||
Post subject: | Re: Heuristic algorithm | |||||||||
Interesting. Try switching out the `for` loop in your `PrintWavefrontMap()` for this:
|
Author: | Azhari [ Wed Jul 24, 2013 12:47 am ] | ||||||||||||||||||
Post subject: | Re: Heuristic algorithm | ||||||||||||||||||
THANKS! It work like magic ![]() ![]() |
Author: | Azhari [ Wed Jul 24, 2013 12:54 am ] | |||||||||||
Post subject: | Re: Heuristic algorithm | |||||||||||
Here the work coding
|
Author: | Azhari [ Wed Jul 24, 2013 1:49 am ] |
Post subject: | Re: Heuristic algorithm |
Next task is if there a sudden new an obstacle in the path how the bot should react, The concept would be like this. if they a new obstacle in front when the coding run. * * * * * R # 5 6 * x x 7 6 5 4 3 4 5 * S x 6 5 4 3 G 3 4 12 x x 7 6 5 4 3 4 6 11 10 9 8 7 6 5 4 5 6 * = path that been taken X = Obstacle S = Starting Point R = Robot # = New Obstacle the new obstacle will be updated to the map and the calculation will be reset again. 11 10 9 8 7 6 R X 5 6 12 x x 7 6 5 * 3 4 5 13 S x 6 5 4 * * 3 4 12 x x 7 6 5 4 3 4 6 11 10 9 8 7 6 5 4 5 6 i will share the coding if i'm already success |
Page 2 of 3 | All times are UTC - 5 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |