(If you dont want to read all of this at least skip the bottom)
I’m a little new to programming and others that I’ve asked don’t know how to solve this issue, if it is one. We have MK4i swerve modules with one CANcoder on top and in all the programming examples that I’ve seen about swerve there are three encoders, 2 through bore and an aboslute on. I get how the absolute encoder is supposed to tell the code the position of the wheels regardless of the robot being on or not and applying the offset. and I get how you use it alongside with though bore. We had this with our old swerve but now wit the MK4i’s we dont have through bore encoders and just 1 absolute. So am i supposed to only use the values on the absolute encoder?
(Skip to here)
Additionally, if I’m trying to call for this encoder, being the through bores or the absolute, how do I find their port/id. Because for the through bore, they are connected to the spark max’s, expect… how do I find this port number from the spark max’s???
I have some examples showing two number like that for te encoder ports, and then others with just one number… how do I refer to the encoder when plugged into the Spark Max… I have the spark max can id but I dont think they are the same thing… help
Hey, so we just finished trying to wire our things and we got power to the encoders and supposedly have a complete CAN daisy chain. We are using CAN coders so according to documentation you souldnt just connect to to the spark max directly. Your supposed to daisy chain it with the rest of the motor controllers, I saw no documentation on this (if you know any please slide) and all I saw was some wiring diagrams posted from other teams, showing that they connected they can coders straight to the Daisy train with the rest of the motor controllers
we did this, and I’m not sure what the status lights were indicating on the encoders, but I also Don’t remember the color, but they were red, then turn green for sometime and then the rest of the time we were trying to test I don’t know what they were. Apart from that when we tried deploy code, and just using the code that was already on there, and the driver station, we were getting a system log saying that the CAN id’s one through eight we’re not being found/identified.
I see that you define the drive and turning motor can ids, I don’t see where you define the cancoder can ids (it is these ids that need to be fed into the swerve code as the absolute encoder). BTW as a best practice we avoid having anything with canid 0 as this is often the default of most devices so easy to have conflicts, and our swerve modules are all configured as:
Module Location Drive Motor Can ID Azimuth Motor Can ID Encoder Can ID
Front Left 1 11 21
Front Right 2 12 22
Back Left 3 13 23
Back Right 4 14 24
This allows us to easily identify problems based on the 1’s 10’s 20’s value and we preset all of these same values on our spare swerve modules so we can hot swap them at events if needed and then only have to change the offset value for the absolute encoder an we are back on the field. We have our modules wired such that we have a can wire in and can wire out to make the module swapping simple.
It sounds like you are using NEOs for your motors if you had the opportunity to use Falcon/Kraken then CTRE has an amazing tool for setup of an all CTRE swerve drivetrain.
Once they have valid can ids you will need to align the swerve modules and capture the offset from each cancoder to provide to your swerve code, so it will know how to align all the modules at startup (the whole purpose of the absolute encoder - I remember our first implementation where we had mag encoders and would have to manually align the modules before every match… )
For some reason, I thought you were using REV products. Wiring is a bit different over there. We still daisy chain. You could think of the CAN network (in the code side) as sending a message and knowing that there is a subscriber to that message in the network. There may be some differences from REV to CTRE, so I will slowly back into the nearby bushes… Sorry I couldn’t help!