Skip to content

A CLI for controlling the 42AIM15 FOC (Field-Oriented Control) integrated servo motor via CANopen over SocketCAN.

License

Notifications You must be signed in to change notification settings

waerhert/42aim15-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

42AIM15 Motor Control CLI

A command-line interface for controlling the 42AIM15 FOC (Field-Oriented Control) integrated servo motor via CANopen over SocketCAN.

CAN Bus Setup

Before running the CLI, you need to configure your CAN interface. This assumes your CAN interface is named can0.

One-Time Setup

  1. Load the CAN kernel modules (if not already loaded):
sudo modprobe can
sudo modprobe can_raw
sudo modprobe vcan
  1. 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
  1. Verify the interface is up:
ip link show can0

You should see output showing can0 is UP and has state ERROR-ACTIVE.

Building

# Install dependencies
go mod download

# Build the executable
go build -o aim15-cli

# Or use go run for development
go run main.go

Running

The CLI can run in interactive mode or execute single commands.

Interactive Mode (Default)

./aim15-cli

This starts an interactive prompt where you can type commands:

aim15> connect
aim15> enable
aim15> status
aim15> position 10000
aim15> exit

Configuration

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).

Documentation

Claude Code

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.

About

A CLI for controlling the 42AIM15 FOC (Field-Oriented Control) integrated servo motor via CANopen over SocketCAN.

Topics

Resources

License

Stars

Watchers

Forks

Languages