Hi!
Turning the magnet on/off should be relatively easy, as long as you have a device that supports connecting CAN devices to your computer through USB.
Instructions on Ubuntu: FluxGrip: Quickstart Guide
Instructions on Windows: https://www.youtube.com/watch?v=ePTtF7so8Ec
(If you don’t have such a device, you can use CanFace1 and a CAN bus splitter)
If you’re planning to use an STM32 to control the magnet, this will require implementing Cyphal/CAN driver, so this will take a bit longer. If you want I can try to help with that too.
BTW are you using ROS?
Is there a short list of CAN messages that can (pun intended) setup
Good one