Swerve with Max and SPX help

Hello. My team and I are trying to work on a swerve drive. Unfortunately we only have 4 Spark Maxes so we are forced to use Victor SPXs. With that we don’t know how to even start. We have code for a Spark Max swerve drive, but how would we go about making the Victors work with the swerve.

I think understanding the hardware is going to help here.

What motors are you using where?

What motor and motor controller is doing the steering?

What motor and motor controller is doing the driving?

And what encoder is tracking the rotation of the module. How is it wired?

Also, what module kit are you using? AM swerve and steer still?

1 Like

1: Neos for driving and PG-71(its a discontinued module)
2: PG-71 is for steering. If you’re looking at it from the PDP then it goes PDP, victor SPX, PG-71, from the PG motor’s encoder its wired directly to the DIO ports on the RoboRIO
3: Neos are the drive motors
4: incremental encoder, its built into the back of the PG-71 motor
5: I believe its the AM swerve and steer

Do you think you still have an understanding. If so I would love to hear it.

Yeah. I’ve got some programming students/mentors who can digest a bit more next week.

To confirm, the code you posted worked with 8 Spark Maxs correct?

If you have it working with Spark Maxs, it’s not going to be very different in this config. I’d start with just making them spin. I think you need the CTRE tools to make that happen. Welcome to Phoenix’s documentation! — Phoenix documentation

Do you have an absolute encoder, or just the relative? You can make it work with relative encoders, but have to do a bit of work on each startup.

I think we might only have a relative encoder. The code should work with 8 Spark Maxes, correct.

1 Like

You will need to wire the encoder (guessing steer encoders) to the spark maxs to use the built in PID.

The code that was posted used the Neo’s relative encoder and built in PID. You are using a brushed motor and external encoder. My team has code for these modules

I recommend this video. It is a very good intro to programming swerve. Many modern modules provide “library” SwerveModule classes, but in this video they create their own. It will vary from yours, but the concepts are the same. I don’t believe you have an absolute turn encoder, so you will need to align the wheels manually at start. We used some AM modules (about a decade ago) and used long Allen keys to align the modules (with ribbons to make sure they were pulled out before the match started). Also odometry has changed to using positions instead of velocities.

Thank you, I’ll be sure to look into this.

Hi, sorry just checking in. You said you had more people who could help.

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