|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Encoder questions - using DIO ports
We are attempting to use different encoders through the DIO ports on our roboRIO for both our teleop and auto programs. We have never used these in the past. When we run our code the motor runs without stopping once it reaches the set value. Any help or examples are appreciated.
Thank you, Team 2906 |
|
#2
|
|||
|
|||
|
Re: Encoder questions - using DIO ports
It sounds like you are not setting your motor input back to zero when the target has been reached. You would need to post your code to say for sure.
|
|
#3
|
|||
|
|||
|
Re: Encoder questions - using DIO ports
Agreed, assuming you can tell that the encoders are working and being read properly. Code?
|
|
#4
|
||||
|
||||
|
Re: Encoder questions - using DIO ports
We have attempted to print the encoder values to the drivers station but they always return as 0, does bot matter if the motor is running or not.
Link to code: https://github.com/FRC2906/Practice Please take a look and see what you can find asap! |
|
#5
|
||||||
|
||||||
|
Re: Encoder questions - using DIO ports
I don't see where you are outputting the encoder value, at first glance
|
|
#6
|
||||
|
||||
|
Re: Encoder questions - using DIO ports
I believe that is located on line 136 and 142 of our robot map
|
|
#7
|
||||||
|
||||||
|
Quote:
Robot Map is only called once. You should output the data in something called periodically, like a command. |
|
#8
|
||||
|
||||
|
Re: Encoder questions - using DIO ports
Ok thanks. So now we can see the values in the smart dashboard but how do we use it? If we want to run an auto command that does something like: "drive strait until the encoder value is gresater than 1000. What would it look like? A while, if or something else?
|
|
#9
|
|||
|
|||
|
Re: Encoder questions - using DIO ports
Take a look at File -> new -> Example Robot projects... -> GearsBot.
The relevant code is within the ...team...commands package, namely DriveStraight.java and the team-subsystem methods added to support it. |
|
#10
|
||||
|
||||
|
Re: Encoder questions - using DIO ports
Relevant PSA: https://github.com/Open-RIO/.gitignore
|
|
#11
|
|||
|
|||
|
Re: Encoder questions - using DIO ports
Quote:
Unlike that gitignore though, we do keep our IDE files so it's easier to import into other Eclipse instances. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|