So I’m a slightly experienced coder and have been working on this Swerve Drive Code for a while. I have been able to successfully set up all the required code using this video and modifying as needed (https://www.youtube.com/watch?v=0Xi9yb1IMyA&t=310s&pp=ygUSaG93IHRvIGNvZGUgc3dlcnZl). I’m still having the issues of the modules not aligning though and I am not sure what I am doing wrong. I am using the PG71 motors with TalonFX for the modules. The PG71 motors are the turning motors and are hooked up to the spark max breakout board in alternate encoder mode. I’ve been struggling with this code for about a month and would be very appreciative if someone could help me figure this out.
to get started, I’d suggest ignoring the alternate encoder, you don’t need it. we’ve had trouble with absolute encoder calibration using the talon srx, which is similar to the FX, so outboard closed loop positon control might never work. I’d also suggest using a profiled pid controller for steering, so you can control the profile shape and the controller firmness separately.
This is the configuration we are using for the spark max. The only issue is I believe we have to use the alternate encoder with the way the breakout board is setup.
so, spark max with 775 with quadrature encoder on pg71 gears? one thing to check is the encoder output, which you can check by hooking it to the Rio DIO directly. it’s also possible to connect the encoder board backwards. what’s the exact symptom?
I believe I am having trouble understanding what you are asking, there does not seem to be any issues with the encoders currently. Normally the wires would hook up to the dio ports on the roborio, but we decided it would probably be easier and more manageable if we used the breakout out board on the maxes. We are using the spark maxes in brushed mode because we the pg71 motors are brushed. I was just questioning what you meant by ignoring the alternate encoders. Now that I am looking closer at the documentation, it may have just be better to go with the dio ports instead of the breakout boards.
the steering control can use the analog encoder alone for feedback. if you’re having trouble then it’s a good start to simplify.
Oh ok, I apologize, so we do not actually have analog encoders on the robot and I am not sure why I did not see that before, we only have the encoders that that the pg71 motor came with hooked up to the breakout board and the built in talon motors. I wasn’t thinking very clearly while coding this at the time obviously and I was pretty much just following along with the video
Here is the module we purchased, I need to check if we have some MA3 analog in our shop, if not we are going to need to order them
Alright, thanks for your help, Ill definitely need to look for those MA3 analog encoders, I can’t believe I looked past that for so long and didn’t even noticed we where missing them
ah, yeah, without an analog encoder you need to zero the modules manually which is pretty painful. the ma3 setup is kinda expensive; you could rig some 3d.printed gears and cheaper encoders if you’re price sensitive.
I believe the modules we bought where suppose to come with these encoders, so I am definitely going to have to look around for them, if not I’ll figure out what to do from there.
https://www.amazon.com/Elegoo-EL-CP-004-Multicolored-Breadboard-arduino/dp/B01EV70C78/ref=asc_df_B01EV70C78/?tag=hyprod-20&linkCode=df0&hvadid=222785939698&hvpos=&hvnetw=g&hvrand=17899063111834045045&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=1021329&hvtargid=pla-362913641420&mcid=270035ab72073766b59f7e601f919640&gclid=Cj0KCQjwncWvBhD_ARIsAEb2HW9EJz6tJimZ78wFj4OIxts6jkC2rBCcK7-xQyROjnoh6jvz25LktpwaAigDEALw_wcB&th=1
We where unable to get swerve ready for this year, but I plan on working on it once we are at the end of the season. We did end up getting the ma3 encoders, I was thinking of just soldering clipped elegoo wires to the end of the encoder wires since they do not come with one to connect to the Robo Rio.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.