A command-line interface for controlling the 42AIM15 FOC (Field-Oriented Control) integrated servo motor via CANopen over SocketCAN.
Before running the CLI, you need to configure your CAN interface. This assumes your CAN interface is named can0.
- Load the CAN kernel modules (if not already loaded):
sudo modprobe can
sudo modprobe can_raw
sudo modprobe vcan- Bring up the CAN interface:
# Set the bitrate to 500kbps (standard for CANopen)
sudo ip link set can0 type can bitrate 500000
# Bring the interface up
sudo ip link set can0 up- Verify the interface is up:
ip link show can0You should see output showing can0 is UP and has state ERROR-ACTIVE.
# Install dependencies
go mod download
# Build the executable
go build -o aim15-cli
# Or use go run for development
go run main.goThe CLI can run in interactive mode or execute single commands.
./aim15-cliThis starts an interactive prompt where you can type commands:
aim15> connect
aim15> enable
aim15> status
aim15> position 10000
aim15> exit
The CLI uses these default settings:
- CAN Interface:
can0 - Node ID:
1 - Bitrate: 500 kbps
- SDO Timeout: 500ms
- Heartbeat Interval: 1 second
To modify these, edit the configuration in the source code or use environment variables (if implemented).
This program was 99% created by Claude Code using the manufacturer provided documentation files. I needed a quick reliable way to talk to the 42AIM15 Motor and explore its capabilities. I don't plan on further development. Just putting it out there in case someone finds it useful.