Issue with Robotpy Tests

Hello, I am a programmer from team 8024. This is our second year using robotpy for our programming, but we seem to be having issues this year.

Originally, we were having issues with our code deploying but not being able to run the robot, but currently the more pressing matter is that when we attempt to test our code it fails with what seems to be a python error.

For context, I had wiped our old version of robotpy to attempt to fix issue 1 (couldn’t run motors/robot), and installed a fresh version. This is when we began running into the issue. The pictures of the error will be attached to this post, if anyone could provide guidance that would be great!

Please post the output of py -m pip list.

Is your source code available somewhere that I can take a look? If not, can you DM it to me?

Also, are you using any rev devices? They crash if you give them invalid parameters. One way you can tell is by running py -m robotpy sim, and if it’s the rev device crashing then you’ll see the output on the console (which you don’t see in tests by default).

Yes, we are using rev devices currently. Previously, we were using victorSPXs and we could not get the motors to run via code installed on the robot. I will get you the source code shortly

Our source code can be found at Github Repo; it is the Drivebase_2024.py file.

Seems like it’s private? You can share it with @virtuald

Apologies, that should be amended now

Yeah, the parameters for your rev devices are incorrect.

$ python -m robotpy --main Drivebase_2024.py test -- -s

[CAN SPARK] IDs: 1, Parameter type mismatch for parameter id Getting Product ID parameter failed. Unable to account for device-specific behavior differences.

[CAN SPARK] IDs: 1, Error Invalid Cannot set motor type to kBrushed for SPARK without a dock connected.

terminate called without an active exception
Fatal Python error: Aborted

Thread 0x00007f65fb7fe6c0 (most recent call first):
<no Python frame>

See [BUG]: Creating a brushed Spark Max aborts in sim · Issue #55 · robotpy/robotpy-rev · GitHub. Please (a) fix your parameters and it should work and (b) send an email to REV support asking them to fix this.

Ah, my apologies, you are correct. It is supposed to be rev.CANSparkLowLevel.MotorType instead of rev.CANSparkMax.MotorType.kBrushed. Thank you for your help!

It appears we still get the same error code after changing the parameter. The python -m pip list command does the following:

rev.CANSparkMax.MotorType.kBrushless?

We are using 4” CIM Motors currently, not the NEOs.

Then why is your code creating rev.CANSparkMax objects?

Because we are using the Sparks to control the CIMs. Have their compatibility been removed?

Are you using a SPARK or a SparkMax? If you’re using a spark via PWM, use PWMSparkMax — RobotPy API documentation instead.

SparkMAX, sorry, I mistyped. Essentially, we were having trouble with the VictorSPXs, and switched over to the SparkMAXs in our troubleshooting efforts

I don’t believe you can use a SparkMAX to control a CIM. Referring to https://docs.revrobotics.com/sparkmax/operating-modes/motor-type-brushed-brushless-mode:

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. At the moment, the NEO Brushless Motor and the NEO 550 Brushless Motor are the only FRC-legal brushless motors compatible with the SPARK MAX, so choosing the correct operating mode should be straightforward.