|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Howdy fellow robotic enthusiasts. I am in dire need of assistance programming our teams gyroscope. I am working with the iterative robot template and I am trying to instantiate my gyroscope. However, I always get the error, "Cannot instantiate the type Gyro." I have read that it has to do with instantiating interfaces. But I am bad at programming so I am unsure about this. Please help.
Here is a glimpse of what I am trying to accomplish. Gyro gyro = new Gyro(1); ![]() Last edited by curtis0gj : 11-01-2016 at 17:18. |
|
#2
|
|||
|
|||
|
Re: Gyroscope Programming
Quote:
Last edited by curtis0gj : 11-01-2016 at 17:19. |
|
#3
|
|||
|
|||
|
Re: Gyroscope Programming
Probably better to do `Gyro gyro = new AnalogGyro(1);`. You'll want to read up on interfaces and abstract classes.
|
|
#4
|
||||||
|
||||||
|
#5
|
||||
|
||||
|
Quote:
Why is it better? |
|
#6
|
|||
|
|||
|
Re: Gyroscope Programming
he doesnt mean its better, the Gyro class is simply a "template" to use so all 3000 teams that use gyros dont have to make their own classes...the class you are looking for is the analogGyro
|
|
#7
|
|||
|
|||
|
Re: Gyroscope Programming
Does anyone know where I find an example of a PID controller that turns the robot 90 degrees using the gyro. I was looking at the examples that came with the robot java development plugin and I learned a bit from the potentiometer PID example but I couldn't figure out how to apply it to the gyro.
|
|
#8
|
||||
|
||||
|
Re: Gyroscope Programming
To just turn 90 Deg, you just need to supply it to the PIDController where the encoder would normally go, as it is already a defined PID source. you would then use your drive motors as output. you would need to invert one motor, so that it turns, but that should be the extent if the mods. I'm not sure you need PID for this simple task though. It's likely easier to just stop after turning 90
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|