REV ThroughBore encoder

Hey guys!
I’m from FRC team 1294 and we are working on a wrist subsystem for the shooter of our robot. We need some help regarding how to get the rotational velocity readings from the REV ThroughBore encoders to use in our Wrist’s Feed Forward Controller (it needs the current rot velocity). So far, I have been unable to find a getvelocity() method in the throughbore encoder class. If there isn’t a getvelocity() method is there a way to manually get the velocity by finding the change in position and change in time? We are using Java/WPILib btw.

Any help would be greatly appreciated. Thanks!

How do you have it wired? To the roborio, or into the dataport of a spark max? Is it in relative or absolute mode?

If you are using something like ProfiledPIDController (recommended for controlling an arm), it takes periodic samples of position and calculates velocity internally. In this case, you wouldn’t need to supply velocity yourself. While (oddly enough), there’s no GetVelocity() for this class, there is a GetVelocityError() – so if you know the target velocity you’ve requested (very often zero), you should be able to easily compute the velocity using this function.

If you plan to connect the encoder to a REV motor controller, you’d get an encoder object from the motor controller (and possibly also a controller object) and then get the velocity by calling a function on one of these objects.

At the end of the day, these sensors just supply position information. Somewhere, this data is sampled and timestamped, and this position over time data is used to derive velocity.

1 Like

Right now it’s going to be wired to the RIO (but can be changed if necessary) and is going to be running in absolute mode.

Assuming youre trying to use the WPILib DutyCycleEncoder class with the REV Throughbore encoder connected to a DIO port, then you found that class doesn’t have a getVelocity() method. I’m not sure there’s much usefulness in getting the velocity of a non-continuous absolute encoder, but that’s a different conversation.

If you can wire it to a SparkMax controller, you would be able to get the velocity natively (i.e. without manually differentiating with respect to time).

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.