ROBOTC.net forums
http://www.robotc.net/forums/

Autonomous Turning using HiTechnic Gyro
http://www.robotc.net/forums/viewtopic.php?f=52&t=10169
Page 2 of 3

Author:  MHTS [ Wed Jan 14, 2015 2:44 am ]
Post subject:  Re: Autonomous Turning using HiTechnic Gyro

Here is an example showing how that function is used in conjunction with PID control to accurately seek the IR beacon. Assuming you have mounted two IR seekers facing each other, one called leftIR and the other called rightIR for triangulation. If you run the following program holding the IR beacon in front of the robot and walk around, the robot should turn to face you wherever you are walking.
Code:
#define Kp              10.0
task main()
{
    while (true)
    {
        float irDir = IRGetACDir(leftIR) + IRGetACDir(rightIR);
        float error = irDir - 10.0;
        motor[leftMotor] = Kp*error;
        motor[rightMotor] = -Kp*error;
        wait1Msec(20);
    }
}

Author:  akash329dsouza [ Wed Jan 14, 2015 10:46 am ]
Post subject:  Re: Autonomous Turning using HiTechnic Gyro

Ah ok thanks for explaining it. It makes a lot more sense now.
But why zone 5 for the ir seekers? If they were facing each other shouldn't it be zone 2 as its directly in front?

Author:  MHTS [ Wed Jan 14, 2015 1:41 pm ]
Post subject:  Re: Autonomous Turning using HiTechnic Gyro

Yes, zone 2 of the left IR is facing front and so is zone 8 of the right IR. So together, they will be 10. When the IR beacon is far away, you get 2 and 8. When it gets closer, you get 3 and 7, even closer you get 4 and 6. So if you take the difference (i.e. rightIR - leftIR), it will tell you approx. how far.

Author:  akash329dsouza [ Wed Jan 14, 2015 6:32 pm ]
Post subject:  Re: Autonomous Turning using HiTechnic Gyro

Ok that makes sense. Also in FTC would you call that a PID loop? I was wondering because it does not have the integral and derivative functions so if its just proportional do you still call it a PID loop?

Author:  MHTS [ Wed Jan 14, 2015 7:55 pm ]
Post subject:  Re: Autonomous Turning using HiTechnic Gyro

akash329dsouza wrote:
Ok that makes sense. Also in FTC would you call that a PID loop? I was wondering because it does not have the integral and derivative functions so if its just proportional do you still call it a PID loop?

Technically speaking, you are right. This is a proportional-only control loop. In our library, we have a PID controller module that implemented the full bloom PID control. However, for simplicity of tuning we always set Ki and Kd to 0.0. So in effect, we are also using proportional-only PID control. But the code fully implemented PID. It is just that the integral and derivative terms are zero. We still call it PID.

Author:  akash329dsouza [ Sun Jan 25, 2015 10:20 pm ]
Post subject:  Re: Autonomous Turning using HiTechnic Gyro

Is it possible to do this with one IR seeker and still be centered on the goal? We want to be able to score reliably in autonomous and we are trying to put in as many failsafes as possible. We tried your code for the IR and it would give 5 and then jump to 6. Then it would go from 6.1 - 6.2 - 7. Is there any way to fix this or make it more reliable?

Author:  MHTS [ Mon Jan 26, 2015 3:26 am ]
Post subject:  Re: Autonomous Turning using HiTechnic Gyro

If you want more accurate code, don't use zone 5 as your target zone, turn the seeker sideway and use 2 or 8. That gives you much narrower zone.

Author:  akash329dsouza [ Fri Jan 30, 2015 12:38 am ]
Post subject:  Re: Autonomous Turning using HiTechnic Gyro

In doing this, is there a large difference in accuracy between using 2 or 1 IR Seeker? Or is there another reason you would use 2 ir seekers?

Author:  MHTS [ Fri Jan 30, 2015 2:16 am ]
Post subject:  Re: Autonomous Turning using HiTechnic Gyro

If you turn the IR seeker sideway either pointing to the left or to the right, you lose a major part of the other side. With 2 IR seekers pointing towards each other, there are two benefits:
1. Not only you get the full front range back, you pretty much get 360-degree.
2. You can do triangulation with 2 seekers.

Author:  akash329dsouza [ Fri Jan 30, 2015 10:06 am ]
Post subject:  Re: Autonomous Turning using HiTechnic Gyro

Ah Ok. Also, what do you mean by triangulation? Just turning until both seekers see a specific value?

Author:  MHTS [ Fri Jan 30, 2015 3:38 pm ]
Post subject:  Re: Autonomous Turning using HiTechnic Gyro

akash329dsouza wrote:
Ah Ok. Also, what do you mean by triangulation? Just turning until both seekers see a specific value?

Just read 8th reply back.

Author:  akash329dsouza [ Fri Jan 30, 2015 3:55 pm ]
Post subject:  Re: Autonomous Turning using HiTechnic Gyro

Oh Ok sorry. So your using the signal strength to find the distance from the beacon and using the zones/signal strength to like up?

Author:  MHTS [ Fri Jan 30, 2015 4:33 pm ]
Post subject:  Re: Autonomous Turning using HiTechnic Gyro

akash329dsouza wrote:
Oh Ok sorry. So your using the signal strength to find the distance from the beacon and using the zones/signal strength to like up?

The triangulation gave us the accuracy in terms of direction. However, we decided that the strength of the IR signal or even triangulation will only give us approx. distance and not accurate enough for our purpose. So we actually use a ultrasonic sensor to get the distance info.

Author:  robofan785 [ Sun Feb 01, 2015 1:34 pm ]
Post subject:  Re: Autonomous Turning using HiTechnic Gyro

I am trying to move a linear slide up to a certain level when a button is pressed. The linear slide should move to another level when another button is pressed. However the robot should know it's already at a certain level and move up or down to the next level of height accordingly. How do I do this? Some suggested using stacks...

Author:  akash329dsouza [ Mon Feb 02, 2015 10:46 am ]
Post subject:  Re: Autonomous Turning using HiTechnic Gyro

I would recommend using a variable to store which position your linear slide should be in and then make the variable go up/down when a button is pressed. Also, MHTS if I understood this correctly , you should be able to get the same amount of accuracy with just 1 IR Seeker but the only difference would be that we wouldn't get full 360 degree vision. So for example, if the robot went on the path shown on the image, and then turned right until it saw the beacon. Would we get the same amount of accuracy as if we had 2 seekers? We are trying to decide if it is worth it to buy another IR Seeker. Another way we thought to do this is to drive up and turn right until the ultrasonic saw nothing, then turn left until the untrasonic saw nothing and then go half the distance inbetween them. Do you think either of these ideas would be as accurate as using 2 IR seekers?
Image

Page 2 of 3 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/