Skip to main content

Stackforce X Series Motors Getting Start

This article will introduce how to get started with Stackforce series motors and how to use them with C++ and Python on the reComputer Jetson Super.

Specification

Here's the completed table with all parameters filled in for all motor models:

Parameter60108108
Rated Voltage24V24V
Rated Current10.5A7.5A
Rated Power240W180W
Rated Torque5 Nm7.5 Nm
Peak Torque11 Nm22 Nm
Rated Speed120 RPM110 RPM
Maximum Speed270 RPM320 RPM
Gear Ratio8:18:1
Communication protocolMIT ProtocolMIT Protocol
Control ModesPosition, Velocity, Torque ControlPosition, Velocity, Torque Control
Outer Diameter80 mm97 mm
Thickness47 mm46 mm
Weight392 g ±10%395 g ±5%
Phase Resistance0.48 Ω ±10%0.439 Ω ±10%
Phase Inductance368 μH ±10%403 μH ±10%

Main Features

  1. High Torque Output
  2. MIT Mode Control
  3. Magnetic Encoder Feedback
  4. Compact and Lightweight Design
  5. Support for High-Speed CAN Bus Communication
  6. Versatile Applications

Getting Started Guide

Preparations Before Use

On a PC with Windows System

The motor’s CANID and CANMode are both modified via serial port. The motor is shipped with a default CANID of 0x01 and CANMode of CAN2.0 at 1Mbps.

Serial Port Wiring

Connect V, G, T, R to the VCC (3.3V), GND, RX, TX of the serial communication module respectively (RX and TX should be cross-connected). As shown in the figure below:

Modifying CANID

Set the serial port baud rate to 1Mbps.

The CANID to be sent is 0x**, and the set ID is 0x**, with a maximum limit of 0x7F. After successfully setting the CANID, the following log will be printed:

Modifying CAN Mode

Send CANMODE:0 or CANMODE:1 via the serial port.

CANMODE:0 represents CAN2.0 mode (1Mbps), while CANMODE:1 represents CANFD mode (5Mbps).

Successful modification of CAN mode is shown in the figures below:

Using reComputer Mini Jetson Orin to Control Motors

The most common CAN communication interfaces for motors on the market are XT30 (2+2) and JST connectors. Our reComputer Mini Jetson Orin and reComputer Robotics devices are equipped with dual XT30 (2+2) interfaces and CAN interfaces based on JST, providing seamless compatibility.

reComputer Mini:

reComputer Robotics

For more detailed information on CAN usage, please refer to this wiki.

Enabling CAN Interface

Step 1: Before using CAN0 and CAN1, please remove the bottom cover and set the two 120Ω terminal resistors to the ON position.

Turn off the toggle switch of the 120Ω CAN communication terminal resistor integrated on the motor.

tip

If the Recomputer Mini has not set the 120Ω terminal resistor to ON, you can choose to turn on the toggle switch of the motor's CAN communication terminal resistor.

Step 2: Connect the motor directly to the CAN0 of the reComputer Mini via the XT30 (2+2) interface.

tip

Since the CAN interface design of the reComputer Mini is opposite to that of the motor’s CAN interface, manual soldering is required to reverse the data lines.

Considering the high voltage and current required by the motor, it is recommended to purchase a 24V 300W power adapter to power the reComputer Mini for driving a single motor. If more motors need to be connected, a higher-power power adapter can be purchased according to the requirement.

danger

This power supply is only for single-motor learning and testing. For multiple motors, please design a separate power board and isolate the power supply of Jetson from the motor power supply to avoid high current passing directly through Jetson.

Enabling Jetson CAN Communication

Open a terminal and enter the following command to pull the GPIO pin high to activate CAN0:

gpioset --mode=wait 0 43=0

If using CAN1 with the JST interface, pull pin 106 high.

gpioset --mode=wait 0 106=0

Keep this terminal open, start a new terminal, and configure CAN0.

sudo modprobe mttcan
sudo ip link set can0 type can bitrate 1000000
sudo ip link set can0 up

Setting Up Python and C++ Environment

Step 1: Clone the SDK.

git clone https://github.com/Seeed-Projects/Stackforce-Motor-SDK.git 

Step 2: The driver SDK requires the following dependencies. For Debian Linux, they can be installed via the following commands:

sudo apt-get install -y build-essential cmake
sudo apt install linux-modules-extra-5.15.0-1025-nvidia-tegra # For Jetson Jetpack 6.0

If Python bindings are needed, additionally install Python 3, pip, and pybind11:

sudo apt-get install -y python3 python3-pip python3-pybind11 python3-setuptools

After installing the dependencies, follow the steps below to install the driver SDK as a C++ library or a Python package. Both will use CMake to compile the C++ code.

Using C++ for Control

cd build
cmake ..
make

The compiled executable will be located at build/sfmotor_control. Run the program:

./sfmotor_control

The program defaults to controlling the motor with ID 0x01. During operation, you can input the target angle value (in radians) via the keyboard. It also receives feedback data on the motor’s angle and angular velocity.

Using Python for Control

The Python script is located in the script/ directory and can be run directly without compilation.

python main.py 

The program defaults to controlling the motor with ID 0x01. During operation, you can input the target angle value (in radians) via the keyboard. It also receives feedback data on the motor’s angle and angular velocity.

Tech Support & Product Discussion

Thank you for choosing our products! We are here to provide you with different support to ensure that your experience with our products is as smooth as possible. We offer several communication channels to cater to different preferences and needs.

Loading Comments...