View unanswered posts | View active topics It is currently Thu Sep 24, 2020 9:44 pm

 Page 2 of 3 [ 37 posts ] Go to page Previous  1, 2, 3  Next
 Print view Previous topic | Next topic
Autonomous Turning using HiTechnic Gyro
Author Message
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
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.0task main(){    while (true)    {        float irDir = IRGetACDir(leftIR) + IRGetACDir(rightIR);        float error = irDir - 10.0;        motor[leftMotor] = Kp*error;        motor[rightMotor] = -Kp*error;        wait1Msec(20);    }}

Wed Jan 14, 2015 2:44 am
Novice

Joined: Tue Dec 16, 2014 10:25 am
Posts: 81
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?

_________________
Thanks!

Wed Jan 14, 2015 10:46 am
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
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.

Wed Jan 14, 2015 1:41 pm
Novice

Joined: Tue Dec 16, 2014 10:25 am
Posts: 81
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?

_________________
Thanks!

Wed Jan 14, 2015 6:32 pm
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
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.

Wed Jan 14, 2015 7:55 pm
Novice

Joined: Tue Dec 16, 2014 10:25 am
Posts: 81
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?

_________________
Thanks!

Sun Jan 25, 2015 10:20 pm
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
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.

Mon Jan 26, 2015 3:26 am
Novice

Joined: Tue Dec 16, 2014 10:25 am
Posts: 81
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?

_________________
Thanks!

Fri Jan 30, 2015 12:38 am
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
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.

Fri Jan 30, 2015 2:16 am
Novice

Joined: Tue Dec 16, 2014 10:25 am
Posts: 81
Re: Autonomous Turning using HiTechnic Gyro
Ah Ok. Also, what do you mean by triangulation? Just turning until both seekers see a specific value?

_________________
Thanks!

Fri Jan 30, 2015 10:06 am
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
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?

Fri Jan 30, 2015 3:38 pm
Novice

Joined: Tue Dec 16, 2014 10:25 am
Posts: 81
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?

_________________
Thanks!

Fri Jan 30, 2015 3:55 pm
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
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.

Fri Jan 30, 2015 4:33 pm
Rookie

Joined: Sun Feb 01, 2015 2:27 am
Posts: 3
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...

Sun Feb 01, 2015 1:34 pm
Novice

Joined: Tue Dec 16, 2014 10:25 am
Posts: 81
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?

_________________
Thanks!

Mon Feb 02, 2015 10:46 am
Display posts from previous:  Sort by
 Page 2 of 3 [ 37 posts ] Go to page Previous  1, 2, 3  Next

#### Who is online

Users browsing this forum: No registered users and 2 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ ROBOTC Applications    ROBOTC for LEGO MINDSTORMS       Third-party sensors    ROBOTC for CORTEX & PIC    ROBOTC for VEX IQ    ROBOTC for Arduino    Robot Virtual Worlds    Multi-Robot Communications    Issues and Bugs Competitions & Partners    Mini Urban Challenge    CS2N Robot Virtual Worlds Competitions       VEX Skyrise Competition 2014-2015       VEX Toss Up 2013-2014       FTC Block Party! 2013-2014    Competitions using VEX - BEST, TSA, VEX, and RoboFest!    FTC Programming    RoboCup Junior and Other ROBOT Competitions Virtual Brick Robotics Discussions    General Discussions    Project Discussions Off-Topic ROBOTC Forum & ROBOTC.net Suggestions/Feedback    ROBOTC Forums Suggestions/Comments    ROBOTC.net Suggestions/Comments       NXT Programming: Tips for Beginning with ROBOTC       VEX Programming: Tips for Beginning with ROBOTC    2013 Robotics Summer Of Learning       VEX Toss Up Programming Challenge       FTC Ring It Up! Programming Challenge    International Forums       Spanish Forums          ROBOTC for MINDSTORMS          ROBOTC for VEX       French Forums          ROBOTC pour Mindstorms          ROBOTC pour IFI VEX       Japanese Forums （日本語のフォーラム）       German Forums    2015 Spring Carnival Event    PLTW (Project Lead The Way)    Robotics Merit Badge    2014 Robotics Academy Summer of Learning