Go to Post quick everyone find everything in the whole world that sells for $125 so we can get an edge on our building 2 days before kick off.....ready...go! - Greg Needel [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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: 581
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
 


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 22:03.

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