WPI Lib Swerve CMD Based

Greetings,

We are working on our swerve program, and have eliminated most errors, but still have no input from our controller to the modules, our encoders aren’t reading values, and for some reason, our CAN channels 2,4,6, and 8 aren’t seen by the program despite being configured in REV hardware and visible there.

We are using Swerve Drive Specialties Mk3 with Neos and an SRX mag encoder connected to the turning motor’s 10 pin data port, alternate encoder mode enabled in REV, running in brushed mode - which I believe is correct.

Any help is greatly appreciated.

Our program can be found here:https://colab.research.google.com/drive/1rsLZ8qSqvtYnCjZcGFOWoisV49rKjj7h?usp=sharing

Neos are brushless motors, not brushed. This would cause issues for the motors not running.

I understand that, but from what I have read, you have to run them in brushed mode to use the alternate encoder - is that correct? We have tried them in brushless mode, as well, and still have no control over them.

From what I remember you can call the Alternate encoder through the API. But the data pins on the SRX are different that the Spark Max data port iirc. So you would have to change the wiring to get correct readings. I think REV has a break out board for this.

I found this on CD:

"dyanoshakREV Robotics

Feb '20

Hopefully we can get you up and running quickly, but first a question:

Are you running the SPARK MAX in Brushless (NEO/NEO 550) or Brushed Mode?

The SPARK MAX Data Port matches the same pinout as the SRX, so the encoder should work with the default ribbon connection in Brushed Mode only.

In Brushless Mode, the default encoder pins are shared with the NEO hall sensor lines so you cannot use an external encoder in the default configuration. This is the purpose of Alternate Encoder Mode . There are instructions on which pins and how to connect to them on the page I linked to."

From my understanding Brushless Motors need the internal encoder to operate which is why brushed doesn’t work. The author also states instructions on which pins are needed.

From Motor Type - Brushed/Brushless Mode - SPARK MAX

Brushed and brushless DC motors require different motor control schemes based on the differences in their technology. It is possible to damage the SPARK MAX, the motor, or both if the appropriate motor type isn’t configured properly.

5 Likes

The data port pinout is identical to the SRX one only in Brushed Mode. To use the data port in Brushless Mode, you need to use Alternate Encoder Mode that has a slightly different pinout. Do NOT try to control a NEO in brushed mode, it will destroy the motor. You will need to rewire the data cable to fit the Alternate Encoder Mode pinout.

3 Likes

I believe you misunderstand this section. This is saying you cannot use the “regular” encoder pins with a brushless motor, however the “Alternate Encoder” mode exists to allow an external encoder while using a brushless motor, but you will need to make a custom “connector harness” to connect the encoder to the proper “alternate” pins.

You should NEVER run the Spark MAX in Brushed Mode with a Brushless motor attached as it can damage the motor very quickly… Also pay attention to the warnings on the “Alternate Encoder Mode” page about writing your config to the motor controller BEFORE connecting a 5v encoder to the alternate pins, or again you can damage something.

Thank you!