Cubemars - 17 Year Motor Manufacturer info@cubemars.com +86 13755649079
English
English
中文简体
日本語
Deutsch
Français
한국어
Español
Pусский
Quick Registration
Create your CubeMars account

 

Video Center
TABLE OF CONTENTS
Preparation
Step 1: Understand the Core Logic of MIT Mode
Step 2: Hardware Connection and Initial Motor Configuration
Step 3: Understanding the Core C++ Control Logic
Step 4: Run the Test and Observe the Results
Frequently Asked Questions (FAQ)
Get Resources and Explore More Drive Solutions

Tutorial: Setup CubeMars AK60-6 (KV80) for MIT Mode in C++

CubeMars / Jul 03,2026

In the development of quadruped robots, humanoid robots, or high-performance robotic arms, traditional independent position/velocity/torque control modes are often unable to meet the demands of high-frequency whole-body dynamic control due to communication frame rate limitations. As a result, MIT Mode has become the preferred control method for developers.


This tutorial will guide you step by step through configuring and controlling the CubeMars AK60-6 (KV80) Robotic Actuator in MIT Mode using C++ over a CAN bus. By following this guide, you will master the core logic of the underlying communication protocol and unlock the actuator's high-response, low-latency control performance.


Preparation


Before writing your C++ code, please make sure you have prepared the following hardware and software environment:


  1. Core Hardware: CubeMars AK60-6 (KV80) Robotic Actuator, a reliable CAN communication interface (such as a USB-to-CAN adapter, CANoe, or a development board with a CAN interface).

  2. Software Environment: A C++ compiler (such as GCC or MSVC), along with a third-party CAN communication library (such as PCAN-Basic, SocketCAN, etc.).

  3. Utility Software: CubeMars official configuration software (used for initial parameter configuration).


Step 1: Understand the Core Logic of MIT Mode


Before writing any code, it's important to understand why MIT Mode is used. Traditional control modes can only send one parameter at a time (such as position or velocity). In contrast, MIT Mode allows the following five key parameters to be packed into a single standard 8-byte CAN frame:


  • Target Position

  • Target Velocity

  • Target Torque (Torque / Kt × I)

  • Position PD Gain (Kp)

  • Velocity PD Gain (Kd)


This unified message structure greatly reduces communication latency and serves as the foundation for high-frequency robot locomotion control and compliant force control.


Step 2: Hardware Connection and Initial Motor Configuration


Before running the code, make sure the actuator is properly connected and configured:


  1. Hardware Wiring: Connect the CAN_H and CAN_L terminals of your CAN interface to the CAN_H and CAN_L terminals of the AK60-6 actuator respectively. Make sure all devices share a common ground.

  2. Configuration via CubeMars Software: Connect to the actuator using the CubeMars configuration software. Set the actuator's CAN ID to your desired value (for example, 0x01) and remember it, as it will be used in your C++ program. Set the Baud Rate to 1 Mbps (1000 kbps), which is the recommended baud rate for MIT Mode. Click the "Enter MIT Mode" button. Once enabled successfully, the actuator shaft will exhibit noticeable electromagnetic resistance when rotated by hand.


Step 3: Understanding the Core C++ Control Logic


In a C++ environment, the control logic for the AK60-6 can be divided into the following three key steps (please download the attachment below for the complete project code and data conversion functions):


  1. Send the Enable Command: After entering MIT Mode, the actuator remains in a protected state by default. Before sending any control commands, you must first send a dedicated Enable frame (typically an 8-byte frame filled with 0x00, or another protocol-defined Enable frame) to unlock the actuator. Only after hearing the confirmation beep is the actuator successfully enabled.

  2. Floating-Point to Unsigned Integer Data Packing: This is the most important algorithm in the MIT Mode C++ implementation. Since CAN frames can only transmit integer bytes, physical values (such as a target position of -12.5 rad) must be mapped into 16-bit or 12-bit unsigned integers.


    Logic: Use the linear mapping function float_to_uint(x, x_min, x_max, bits).

    Operation: Clamp the target position, velocity, torque, Kp, and Kd within the actuator's allowable range, then convert them proportionally into the corresponding hexadecimal values.


  3. Assemble and Send the 8-Byte CAN Frame: Pack the five integer parameters obtained in the previous step into an 8-byte (64-bit) array according to the bit layout specified by the CubeMars communication protocol. Finally, use your CAN library to send the frame to the actuator using the configured CAN ID. Upon receiving the frame, the actuator immediately parses and executes the command.


Step 4: Run the Test and Observe the Results


After compiling and flashing/running your C++ program, power on the AK60-6 actuator. Run your C++ application, and you should see the actuator respond smoothly and rapidly according to the target position, velocity, and torque values specified in your code. You can also dynamically adjust the values of Kp and Kd to directly experience changes in actuator stiffness and compliance.


Frequently Asked Questions (FAQ)


Q1: The actuator doesn't respond or reports an error after sending CAN frames?


A: Please check the following:

  1. Has the Enable command been successfully sent?

  2. Does the CAN ID in your C++ code exactly match the actuator's configured CAN ID?

  3. Are the command values within the limits defined by the protocol (such as P_MAX and V_MAX)? Values outside the allowed range will cause the actuator to reject the command.


Q2: How should byte order (Byte Order) be handled in the code?


A: The CubeMars CAN protocol typically uses Big-Endian byte order. When constructing the 8-byte CAN frame in C++, pay close attention to the order of the most significant byte (MSB) and least significant byte (LSB). Incorrect byte ordering will result in incorrect position and torque values. Please strictly follow the byte layout specified in the Communication Protocol Manual.


Q3: How do I calibrate the Zero Position of the actuator?


A: In MIT Mode, send the dedicated CAN command for Set Current Position as Zero (refer to the Communication Protocol Manual for the specific CAN ID and data frame). The actuator will record the current rotor position as the mechanical zero position. It is recommended to perform this calibration during every system initialization after power-up.


Get Resources and Explore More Drive Solutions


With its compact 60 mm flange size and outstanding dynamic performance, the AK60-6 (KV80) is an ideal choice for lightweight robotic arms, gimbal systems, and quadruped robot leg joints.


[Learn more about the CubeMars AK60-6 (KV80), including detailed specifications and dimensions.]

Related Articles
How to install the AKE driver board
How to install the AKE driver board
1.Fix the front cover to the motor body.2.Solder the three-phase wires and the temperature sensor wires onto the driver board..
Nov 14,2025
CubeMars RI80 Powers Transgrid's Transmission Line Inspection Robot
CubeMars RI80 Powers Transgrid's Transmission Line Inspection Robot
See how Transgrid uses CubeMars RI80 motors and NASA-inspired bogie systems to master power line obstacle climbing. Delivering high load capacity and stable motion for safer grid maintenance.
Jun 29,2026
AK Series Facing a motor problem? Let's restore it!
AK Series Facing a motor problem? Let's restore it!
AK Series Facing a motor problem? Let's restore it!
Oct 22,2024
Leave Message
User name
Anonymous
E-mail *
Name *
Phone
Comments
Verification code
captcha
Warm prompt
Warm prompt
Please Sign In
Sign In
Sign Up
Forgot Password?
Warm prompt