|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Best way to drive straight using a gyro?
This is the code as updated at our last meeting before our regional. We'd really like to get an idea of how well it'd work before we get there:
package edu.wpi.first.ReboundRumble.subsystems; mport edu.wpi.first.ReboundRumble.OI; import edu.wpi.first.ReboundRumble.RobotMap; import edu.wpi.first.ReboundRumble.commands.DriveWithJoys ticks; import edu.wpi.first.wpilibj.Gyro; import edu.wpi.first.wpilibj.RobotDrive; import edu.wpi.first.wpilibj.command.PIDSubsystem; import edu.wpi.first.ReboundRumble.commands.CommandBase; /** * * @author Developer */ public class DriveSystem extends PIDSubsystem { private static final double Kp = 3;} Last edited by ProjectZero : 01-03-2012 at 10:47. |
|
#2
|
||||
|
||||
|
Re: Best way to drive straight using a gyro?
Quote:
Code:
/** * Return the actual angle in degrees that the robot is currently facing. * * The angle is based on the current accumulator value corrected by the oversampling rate, the * gyro type and the A/D calibration values. * The angle is continuous, that is can go beyond 360 degrees. This make algorithms that wouldn't * want to see a discontinuity in the gyro output as it sweeps past 0 on the second time around. * * @return the current heading of the robot in degrees. This heading is based on integration * of the returned rate from the gyro. */ float Gyro::GetAngle( void ) |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|