Go to Post One of the cultural concepts that has emerged from the teams participating in FIRST is that ideas are worth sharing. - Alan Anderson [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 15-02-2014, 16:19
geomapguy's Avatar
geomapguy geomapguy is offline
Centenary '18
AKA: Graham Maxwell
FRC #1818
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Alexandria, LA
Posts: 535
geomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud of
Gyro with Labview to drive straight

Hello all,


We are in need of help for implementing a gyro to drive our robot straight for a certain amount of time. (in auto mode)

Any ideas/help?
__________________
The Cowboys - FIRST Robotics Team #1818 2015-
The Bolton Bear Bots - FIRST Robotics Team #3666 2011-204 (30-26-0)
2014 Oklahoma Regional - 20/62 (6-4-0), 5/62 in OPR
2014 Arkansas Regional - 14/39 (8-7-0, Quarterfinalists with 1706 and 1939), 24/39 in OPR
2013 Lone Star Regional Dean's List Finalist!
2013 Lone Star Regional - 22/57 (6-5-0), 17/57 in OPR
2012 Bayou Regional - 16/49 (6-5-0)
2011 Dallas Regional - 10/52 (4-2-5, #6 Alliance Captain, Quarterfinalists with 2948 and 3350)
  #2   Spotlight this post!  
Unread 15-02-2014, 16:36
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,125
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Gyro with Labview to drive straight

Quote:
Originally Posted by geomapguy View Post
We are in need of help for implementing a gyro to drive our robot straight for a certain amount of time. (in auto mode)
Zero the gyro when the bot is facing in the desired direction.

Then,

If the gyro says that your bot is facing slightly clockwise from the desired direction you need to increase the speed of the right wheels and decrease the speed of the left wheels.

If the gyro says that your bot is facing slightly counterclockwise from the desired direction you need to increase the speed of the left wheels and decrease the speed of the right wheels.


There are many different ways to do this. You can either invent your own or search around for ideas.

Here's one way to do it with a skid-steer vehicle.

Here's one way to do it with a 3DoF vehicle.




Last edited by Ether : 15-02-2014 at 16:41.
  #3   Spotlight this post!  
Unread 15-02-2014, 16:39
geomapguy's Avatar
geomapguy geomapguy is offline
Centenary '18
AKA: Graham Maxwell
FRC #1818
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Alexandria, LA
Posts: 535
geomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud of
Re: Gyro with Labview to drive straight

Quote:
Originally Posted by Ether View Post
Zero the gyro when the bot is facing in the desired direction.

Then,

If the gyro says that your bot is facing slightly clockwise from the desired direction you need to increase the speed of the right wheels and decrease the speed of the left wheels.

If the gyro says that your bot is facing slightly ounterclockwise from the desired direction you need to increase the speed of the left wheels and decrease the speed of the right wheels.

There are many different ways to do this. You can either invent your own or search around for ideas.


Would a PID be something we'd use?
__________________
The Cowboys - FIRST Robotics Team #1818 2015-
The Bolton Bear Bots - FIRST Robotics Team #3666 2011-204 (30-26-0)
2014 Oklahoma Regional - 20/62 (6-4-0), 5/62 in OPR
2014 Arkansas Regional - 14/39 (8-7-0, Quarterfinalists with 1706 and 1939), 24/39 in OPR
2013 Lone Star Regional Dean's List Finalist!
2013 Lone Star Regional - 22/57 (6-5-0), 17/57 in OPR
2012 Bayou Regional - 16/49 (6-5-0)
2011 Dallas Regional - 10/52 (4-2-5, #6 Alliance Captain, Quarterfinalists with 2948 and 3350)
  #4   Spotlight this post!  
Unread 15-02-2014, 16:45
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,125
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Gyro with Labview to drive straight

Quote:
Originally Posted by geomapguy View Post
Would a PID be something we'd use?
A PID would be something you could use.

Other closed-loop control methods might work too. Has anyone tried Take Back Half for this application?

http://www.chiefdelphi.com/forums/sh....php?p=1247916

http://electronicdesign.com/analog/t...trol-algorithm

http://www.chiefdelphi.com/media/papers/2674

http://www.chiefdelphi.com/media/papers/2876




Last edited by Ether : 15-02-2014 at 16:51.
  #5   Spotlight this post!  
Unread 15-02-2014, 19:48
nyaculak nyaculak is offline
Registered User
FRC #0053 (Area 53)
Team Role: Programmer
 
Join Date: Oct 2011
Rookie Year: 2011
Location: Maryland
Posts: 28
nyaculak will become famous soon enough
Re: Gyro with Labview to drive straight

From my experience, a simple proportional control system is adequate to drive a robot straight, at least in an FRC application.
__________________
2013 MUC DC 3rd Place, FRC DC Regional, FRC Chesapeake Regional
2012 FRC DC Regional, FRC Chesapeake Regional
ERHS Robotics Club
- FRC Team 53 "Area 53"
www.erhsroboticsclub.org
  #6   Spotlight this post!  
Unread 15-02-2014, 19:53
nyaculak nyaculak is offline
Registered User
FRC #0053 (Area 53)
Team Role: Programmer
 
Join Date: Oct 2011
Rookie Year: 2011
Location: Maryland
Posts: 28
nyaculak will become famous soon enough
Re: Gyro with Labview to drive straight

Quote:
Originally Posted by Ether View Post
A PID would be something you could use.

Other closed-loop control methods might work too. Has anyone tried Take Back Half for this application?

http://www.chiefdelphi.com/forums/sh....php?p=1247916

http://electronicdesign.com/analog/t...trol-algorithm

http://www.chiefdelphi.com/media/papers/2674

http://www.chiefdelphi.com/media/papers/2876



I've written the code to drive a robot straight with a TBH Controller. Unfortunately I haven't had time to test it on an actual robot.
__________________
2013 MUC DC 3rd Place, FRC DC Regional, FRC Chesapeake Regional
2012 FRC DC Regional, FRC Chesapeake Regional
ERHS Robotics Club
- FRC Team 53 "Area 53"
www.erhsroboticsclub.org
  #7   Spotlight this post!  
Unread 15-02-2014, 23:35
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,125
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Gyro with Labview to drive straight

Quote:
Originally Posted by nyaculak View Post
I've written the code to drive a robot straight with a TBH Controller. Unfortunately I haven't had time to test it on an actual robot.
If you could remember to come back and post your results when you have had a chance to test it, I think that would be useful info.


  #8   Spotlight this post!  
Unread 15-02-2014, 23:48
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Gyro with Labview to drive straight

We usually use an I controller for straight driving. It's essentially an 'adaptive drift constant' in our application, as it finds a 'drift bias' between the two sides but it's treated as a constant to the rest of the distance based controls.

The integral eventually finds a happy place which causes the robot to drive straight, and holds it indefinitely. We also have some speed adaption of the output, so the same integral keeps the drive straight at various output speeds, and we inhibit the control loop (but latch the integral) at low speeds. We also hold the integral between runs of the function, so multiple drive steps can keep the integral. If we were really smart we would store the integral over power cycles, but we don't.

If the gain is good, it can come out of a turn with quite a lot of error (I tested it to around 15 degrees), and come back to the correct heading very quickly. Past a certain error the control loop was unstable, we did not worry about it because our turns were more reliable than the unstable threshold. But, you should take up turn error in the turn function, not the straight function.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
  #9   Spotlight this post!  
Unread 16-02-2014, 08:23
MrRoboSteve MrRoboSteve is offline
Mentor
AKA: Steve Peterson
FRC #3081 (Kennedy RoboEagles)
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2011
Location: Bloomington, MN
Posts: 582
MrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond repute
Re: Gyro with Labview to drive straight

In our 2012 robot, we used a simple proportional control system to turn the robot on heading. It uses a higher power level to turn close to the desired heading, and then lowers the power to avoid overrunning the desired heading. We also had a tolerance around the desired heading of a couple degrees where we considered the robot to be on heading.

All of the constants here are values you will need to determine experimentally.

Initialize at start of turn:

start_heading = current gyro heading
goal_heading = desired heading (calculated from your desired turn and the start heading)

Each loop:

turn_rate = 0 (this ranges from -1 to 1 and is the desired power to drive train)
current_heading = current gyro heading
angle_difference = current_heading - goal_heading

// angle_difference here might be positive or negative, indicating a turn in either direction

If (abs(angle_difference) > 10) then
turn_rate = .7
// when the angle difference is > 10 degrees, turn at .7 power.
Else if (abs(angle_difference) > 3 and abs(angle_difference) < 10)
turn_rate = .6
// when you are within 10 degrees of desired heading, turn at lower
// power to prevent overrunning the desired heading
Else
// Consider heading within 3 degrees of desired heading to be on heading
turn_rate = 0
End

// Motor inputs

// Depending on your motor configuration and how the gyro is mounted, you may need to reverse the motor controls.

If (angle_difference > 0) then
turn_left(turn_rate)
Else
turn_right(turn rate)
end
__________________
2016-17 events: 10000 Lakes Regional, Northern Lights Regional, FTC Burnsville Qualifying Tournament

2011 - present · FRC 3081 Kennedy RoboEagles mentor
2013 - present · event volunteer at 10000 Lakes Regional, Northern Lights Regional, North Star Regional, Lake Superior Regional, Minnesota State Tournament, PNW District 4 Glacier Peak, MN FTC, CMP
http://twitter.com/MrRoboSteve · www.linkedin.com/in/speterson
  #10   Spotlight this post!  
Unread 16-02-2014, 09:36
nyaculak nyaculak is offline
Registered User
FRC #0053 (Area 53)
Team Role: Programmer
 
Join Date: Oct 2011
Rookie Year: 2011
Location: Maryland
Posts: 28
nyaculak will become famous soon enough
Re: Gyro with Labview to drive straight

Quote:
Originally Posted by apalrd View Post
We usually use an I controller for straight driving. It's essentially an 'adaptive drift constant' in our application, as it finds a 'drift bias' between the two sides but it's treated as a constant to the rest of the distance based controls.

The integral eventually finds a happy place which causes the robot to drive straight, and holds it indefinitely. We also have some speed adaption of the output, so the same integral keeps the drive straight at various output speeds, and we inhibit the control loop (but latch the integral) at low speeds. We also hold the integral between runs of the function, so multiple drive steps can keep the integral. If we were really smart we would store the integral over power cycles, but we don't.

If the gain is good, it can come out of a turn with quite a lot of error (I tested it to around 15 degrees), and come back to the correct heading very quickly. Past a certain error the control loop was unstable, we did not worry about it because our turns were more reliable than the unstable threshold. But, you should take up turn error in the turn function, not the straight function.
That's actually really interesting. The Take-Back-Half (TBH) algorithm is actually a form of Integral control, so it may work well for this application.
__________________
2013 MUC DC 3rd Place, FRC DC Regional, FRC Chesapeake Regional
2012 FRC DC Regional, FRC Chesapeake Regional
ERHS Robotics Club
- FRC Team 53 "Area 53"
www.erhsroboticsclub.org
  #11   Spotlight this post!  
Unread 16-02-2014, 19:19
geomapguy's Avatar
geomapguy geomapguy is offline
Centenary '18
AKA: Graham Maxwell
FRC #1818
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Alexandria, LA
Posts: 535
geomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud ofgeomapguy has much to be proud of
Re: Gyro with Labview to drive straight

Quote:
Originally Posted by MrRoboSteve View Post
In our 2012 robot, we used a simple proportional control system to turn the robot on heading. It uses a higher power level to turn close to the desired heading, and then lowers the power to avoid overrunning the desired heading. We also had a tolerance around the desired heading of a couple degrees where we considered the robot to be on heading.

All of the constants here are values you will need to determine experimentally.

Initialize at start of turn:

start_heading = current gyro heading
goal_heading = desired heading (calculated from your desired turn and the start heading)

Each loop:

turn_rate = 0 (this ranges from -1 to 1 and is the desired power to drive train)
current_heading = current gyro heading
angle_difference = current_heading - goal_heading

// angle_difference here might be positive or negative, indicating a turn in either direction

If (abs(angle_difference) > 10) then
turn_rate = .7
// when the angle difference is > 10 degrees, turn at .7 power.
Else if (abs(angle_difference) > 3 and abs(angle_difference) < 10)
turn_rate = .6
// when you are within 10 degrees of desired heading, turn at lower
// power to prevent overrunning the desired heading
Else
// Consider heading within 3 degrees of desired heading to be on heading
turn_rate = 0
End

// Motor inputs

// Depending on your motor configuration and how the gyro is mounted, you may need to reverse the motor controls.

If (angle_difference > 0) then
turn_left(turn_rate)
Else
turn_right(turn rate)
end

Ended up using this method but adapted for LabVIEW....works great.

We did this since we aren't using encoders
__________________
The Cowboys - FIRST Robotics Team #1818 2015-
The Bolton Bear Bots - FIRST Robotics Team #3666 2011-204 (30-26-0)
2014 Oklahoma Regional - 20/62 (6-4-0), 5/62 in OPR
2014 Arkansas Regional - 14/39 (8-7-0, Quarterfinalists with 1706 and 1939), 24/39 in OPR
2013 Lone Star Regional Dean's List Finalist!
2013 Lone Star Regional - 22/57 (6-5-0), 17/57 in OPR
2012 Bayou Regional - 16/49 (6-5-0)
2011 Dallas Regional - 10/52 (4-2-5, #6 Alliance Captain, Quarterfinalists with 2948 and 3350)
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 02:45.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi