I’m a rookie programmer for team 3381. I’m trying to get a swere drive functioning this summer. I do have the rev sample code and I’m attempting to convert the Spark Maxs motor controllers to Talon motors. My question is how to convert the Absolute Encoder to the Encoder in the Talon Motor.
does pheniox library have an equivalent to getPIDcontorller.
Can you describe your drivetrain setup? What swerve modules, and which motors/motor controllers?
Edit: I see you’re using TalonSRX motors–I wouldn’t use the REV base as a starting point. What are your modules?
The Modules consist of two Talon motors which have built in motor controllers and encoders. One for turning and one for driving the wheel and we have 4 of them in each corner of our base.
Are these SDS modules, WCP modules, or custom?
I believe they are mark 4 SDS modules
When you say Talon motors that have built in motor controllers and encoders, do you mean this motor?
https://www.vexrobotics.com/217-6515.html
Elliot’s question is important as well–many if not all purchaseable swerve modules have code bases already set up to get them working relatively quickly, and some teams/community members have made their own libraries as well. Depending on what you have, we can help you find a better place to start from.
Yes
Also, what kind of gyro do you have? Pigeon, Pigeon 2, NavX, etc?
We have a Pigeon that is not installed on the drive base yet
I’d start here, then:
It sounds like you are set up (or will be) to more or less follow the instructions on here. Falcons on MK4 modules and a pigeon is exactly the setup you need for this. We used this on 6574 for this past season and last year’s offseason and it worked splendidly.
Feel free to ask any questions if you have them/as they come up!
Thanks
You don’t have to have the correct absolute encoder for swerve but you’d have to do a painful “calibration” every time you started it up if you don’t have one (four total, actually) and you lose some accuracy in measuring direction.
You may or may not have the correct encoder but the Falcon 500 internal absolute encoder isn’t it and does you no good for steering. Something like a CanCoder mounted in the correct location does the trick right.
From the SDS documents: The steering gear ratio of the MK4 is 12.8:1
Explanation on CDChief Delphi:
You don’t have to have a gyro, either, but you lose field orientation and likely lose precision on your robot’s location.
I would highly recommend you take a look at the work done in YAGSL .
It seems you may be missing some critical hardware pieces as well. You will need 4 absolute encoders otherwise you will lose your wheel orientation measurements every time the robot powers off. This is generally done with CANCODERs. The built in encoders in falcons / neos don’t retain their position when the power is removed so you’d never know what your wheels are doing accurately. The absolute encoders are used to set the internal encoders on the turning motors. Additionally you do need a gyro ( there is a few you can use , some better than others ). The YAGSL library has a few you can use out of the box.
The YAGSL library should be pretty plug and play. You simply tell it what hardware you have in the config files found in the deploy folder.
The original post can be found here : Yet Another Generic Swerve Library (YAGSL) Beta
YAGSL Example Project - https://github.com/BroncBotz3481/YAGSL-Example
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.