|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Autonomous calculations
How exactly can I implement my formula to calculate distance into my autonomous code? I want the robot to move forward while the distance is greater than a certain number. If I use a while loop the rc crashes and does nothing. This is the code I have so far:
Quote:
|
|
#2
|
|||||
|
|||||
|
Re: Autonomous calculations
The User_Autonomous_Code() function is a while loop. Put your calculation in the middle of it, where it will be executed every time through the loop.
Do you want the calculation to be made only when the camera is locked on the light? If so, put it inside the first if. |
|
#3
|
|||
|
|||
|
Re: Autonomous calculations
We use the value of tilt servo to tell us when we want to stop. As we get closer to the light the camera must look up higher. Tilt servo value decreases the higher we look. When we get below a certain value we stop.
Determine different tilt servo values associated with different distances from the target to create a ranging system..OR create a formula to convert tilt servo value to distance from light. BC |
|
#4
|
||||
|
||||
|
Re: Autonomous calculations
Quote:
That's what I'm doing, the problem is, we made an auto-pan routine that takes us near the target, but sometimes we get there diagonally. We're still looking for the perfect routine, unfortunately it seems to be very far... |
|
#5
|
|||
|
|||
|
Re: Autonomous calculations
Thanks for the help. Just for testing, we tried using the tilt servo value to get it to stop. This is our code:
Quote:
Last edited by Tz0m : 20-02-2007 at 16:21. |
|
#6
|
|||||
|
|||||
|
Re: Autonomous calculations
hmmm...mabye you should try with angles? take the calculation of the tilt angle from terminal.c and find what is your requested tilt angle where the robot will stop in your opinion and then do the tilt angle in relation to the distance(too far, go forward. too close, stop.).
Shouldn't be too complicated and it worked for us, but if you prefer to use your own function like that, I have no idea what the problem can be... ![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Motor Calculations | John Gutmann | Motors | 3 | 25-06-2006 08:39 |
| Volume/Weight Calculations in Inventor | =Martin=Taylor= | Inventor | 2 | 08-04-2006 10:21 |
| Distance calculations | Max Brin | Programming | 3 | 22-02-2006 21:38 |
| Autonomous | danielkitchener | Rumor Mill | 3 | 03-01-2004 01:08 |
| Seeding Calculations | archiver | 2000 | 50 | 23-06-2002 21:57 |