![]() |
Finding the position of the robot
I'm trying to find out the angle a robot (holonomic) is traveling relative to the side walls of the field. I'm pretty sure that, when using field centric steering, the angle the robot should be traveling is represented by
Code:
theta = atan2(X,Y) * (180/pi); |
Re: Finding the position of the robot
Quote:
from Gyro.java in WPILib: Code:
/** |
Re: Finding the position of the robot
Thanks I knew that, though. The reason I need to figure out the angle relative to the sides is so that I can calculate the reflection angle off of any one or two walls. I was hoping it could be done computationally using just rangefinders and not the servo or accelerometer, but I think that might take some experimentation to get right. I know it would be easy to do if the robot was always facing the same direction, but it could be facing any direction when it's near a wall. Thanks for your reply
|
Re: Finding the position of the robot
Quote:
The gyro gives you the angle the robot is facing relative to its starting position. So if you start with the robot parallel to the sides then the gyro will give you the angle relative to the sides, which is what you said above you are looking for. |
Re: Finding the position of the robot
Quote:
You COULD do it with rangefinders, two to a side (one at each corner on each side of the robot)--"snap" a measurement and take the difference, which will give you two sides of the triangle, repeat to make sure you aren't bouncing off another robot--but that's probably more trouble than it's worth. However, I think there's another way to do it, provided that you have a camera onboard that can track a vision target. If you can see the target, you can use the size to find how far away you are and the distortion from square (or circular) to find out your angle. If you think about it, this will also enable you to determine such items as whether you are in range to fire, your exact location on the field, and other things about position that you may desire to know. The problem? It might take a bit to figure out how to work it. |
Re: Finding the position of the robot
Quote:
|
Re: Finding the position of the robot
Quote:
|
Re: Finding the position of the robot
We found the accelerometer to be not as useful as we thought, but others might have had different experiences.
If you use Java, you can simply call 'gyro.reset;' ("gyro" being whatever variable is assigned to the Gyro) to "zero" the Gyro. I would think that the easiest way would be to drive into any of the walls and assign a button to zero the Gyro. Just drive into the wall, zero the Gyro, and then you can tell the angle relative to the side. |
| All times are GMT -5. The time now is 03:04. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi