How does can work and how can I simulate it?

I am a programmer for my team and I want to be able to test my code without the robot but I have no idea how I can simulate can. is there a way to simulate can motors?

What are you hoping to simulate? Also, what language are you using?

Using WPILib’s Simulation API you can simulate robot code + motors without having to simulate the CAN line itself. The exact implementation will vary depending on what type of motor you are using and what features of the motor you are trying to simulate.

I want to see if my code will actually be able to run the motors without the actual robot

Then I’d take a look at the simulation API mentioned above. However, that will only work with Java/C++. I’m not sure what type of simulation options are available for LabVIEW. The thing to keep in mind is that you could still have issues with the motors running on the robot even if it works in the simulation API.

Several years ago, my sons team put a spare Rio on a panel the size of a clipboard. They also installed a PCM and a single (brushed D.C.) motor controller. They used a 12V laptop charger to power it. The programmers could stick it in a backpack and take it home. A DVM or an inexpensive panel meter can be used to measure the output voltage of the motor controller and to determine the direction a motor would turn (positive or negative voltage).

interesting would I be able to do something like that with can though?

1 Like

If you use a motor controller that is connected on the CAN bus. You would then want to install a PDP/PDH so you have teh 120 Ohm termination resistor. Alternatively, you can install a 120 Ohm resistor at the motor controller. You will have to set the motor controller ID to the various ID’s used, one at a time to test those parts of the code.