Skip to main content

MyActuator Xシリーズモーター入門ガイド

この記事では、MyActuatorシリーズモーターの使い方と、reComputer Mini Jetson OrinでC++およびPythonを使用する方法について紹介します。

仕様

以下は、すべてのモーターモデルのパラメータを記載した完成版の表です:

パラメータX2-7X4-10X4-36X8-120X12-320X15-450
ギア比28.1712.63619.612020.25
入力電圧 (V)242424484872
無負荷速度 (RPM)178317111158125108
無負荷入力電流 (A)110.91.62.73.5
定格速度 (RPM)1422388312710098
定格トルク (N.m)2.5410.54385145
定格出力 (W)371001005749001480
定格相電流 A(rms)37.86.117.63025
ピークトルク (N.m)71034120320450
ピーク相電流 A(rms)8.119.521.543.810069.2
効率 (%)6369.563.1797582.4
モータ逆起電力定数 (Vdc/Krpm)4.36619.217.929.9
モジュールトルク定数 (N.m/A)0.80.81.92.43.35.8
モータ相抵抗 (Ω)0.610.320.350.180.120.08
モータ相インダクタンス (mH)0.130.140.170.310.050.14
極対数131313102020
3相接続Y
バックドライブトルク (N.m)0.40.81.143.213.84
バックラッシュ (Arcmin)121010101010
出力ベアリングタイプ深溝玉軸受クロスローラベアリング
軸方向耐荷重 (KN)0.251.21.344.55.4
軸方向応力 (KN)0.251.21.314.55.4
ラジアル荷重 (KN)11.21.54.556
慣性モーメント (Kg.cm²)0.170.250.31.512.931.6
エンコーダタイプ・インターフェースデュアルエンコーダ ABS-17BIT (入力) / 17-18BIT (出力)
制御精度 (度)<0.01
通信CAN BUS / EtherCAT
重量 (Kg)0.260.330.361.402.373.50
絶縁等級F

RMD-X V4 シリーズ命名規則

  • RMD: ブランド名 R-Reducer M-Motor D-Drive
  • X2: X はシリーズ名を表す:統合プラネタリアクチュエータ、2 はモーターモデル番号を表す 例:X2 X4 X6 X8 など
  • P28: プラネタリギア比 例:P12 P28 P32 など
  • 7: ピークトルク 7N.m
  • E: 通信 E: CAN BUS & EtherCAT

主な特徴

  1. CAN BUS & EtherCAT
  2. クロスローラーベアリング
  3. デュアルエンコーダ
  4. 高トルク密度
  5. 高精度
  6. 中空設計

はじめに

使用前の環境準備

PC の Windows システム

  • 対応する製品マニュアルをダウンロードしてください。

  • MYACTUATOR_Setup Software_V4.0.zip をダウンロードしてください

  • MYACTUATOR_Setup Software_V4.0.zip を展開し、以下をインストールしてください:

    • Required Runtime Environment\ZLGUSBCAN_Driver ディレクトリにある USBCAN_AllInOne_x86_x64_2.0.0.1.exe
    • Required Microsoft Runtime Libraries ディレクトリにある MSVBCRT.AIO.2019.10.19.X86 X64.exe

回路の接続

ここでは X4-36 モーターを選択しており、そのインターフェース図を以下に示します。

ポート定義ポート説明
① VCC電源正極
② GND電源負極
③ CAN_HCAN_H ネットワーク信号端子
④ CAN_LCAN_L ネットワーク信号端子
⑤ EtherCAT_INEtherCAT 入力端子
⑥ EtherCAT_OUTEtherCAT 出力端子
⑦ T+マスターがモジュールに制御コマンドを送信
⑧ T-モジュールがマスターにステータスフィードバックを送信
⑨ R+マスターがモジュールステータスデータを反映
⑩ R-モジュールがマスター制御コマンドを反映

ここでは、CAN通信方式を使用します。これにはWindows上位機でのデバッグ用に追加のUSB-CANインターフェースが必要です。

ここでは、モーター用に別途24V電源を提供し、USBをコンピューターに接続する必要があります。

MYACTUATOR Setup Software 250206.exeを使用してモーターをテストする

IDの設定と接続モーター情報の読み取りモーターのキャリブレーションモーターのキャリブレーションモーター回転テストの実行
fig1fig2fig3fig4fig5
デフォルトのモーターIDは1です。IDに1を入力し、「Connect」をクリックします。接続後、「Read」をクリックしてモーターの現在の情報を取得します。初回使用時は、「Calibrate Motor」をクリックしてキャリブレーションを実行します。キャリブレーション後、「Read」と「Save」をクリックします。Motor Runningセクションで異なるモーター制御モードをテストできるようになります。

より詳細な機能については、MYACTUATOR_Setup Software_V4.0.zip ファイルに含まれている Setup Software Instruction Manual - V3.0.pdf を参照してください。

reComputer Mini Jetson Orin を使用してモーターを制御する

現在、市場でモーター用の最も一般的なCAN通信インターフェースは XT30 (2+2)JST コネクタ を使用しています。私たちの reComputer Mini Jetson OrinreComputer Robotics デバイスは デュアル XT30 (2+2) ポートJST ベースの CAN インターフェース を搭載しており、シームレスな互換性を提供します。

reComputer Mini:

reComputer Robotics

CAN使用の詳細については、このwikiを参照してください。

CANインターフェースを有効にする

Step1: CAN0とCAN1を使用する前に、底面カバーを取り外し、両方の120Ω終端抵抗をON位置に設定してください。

Step2: XT30 (2+2) インターフェースを介してモーターを reComputer Mini CAN0 に直接接続します。

これは reComputer Mini の CAN0 インターフェースです

danger

この電源は単一モーターの学習とテスト用のみです。複数のモーターの場合は、別途電源ボードを設計し、Jetsonの電源をモーター電源から分離して、高電流がJetsonを直接通過することを避けてください。

Jetson CAN通信を有効にする

ターミナルを開き、以下のコマンドを入力してGPIOピンをハイにし、CAN0を有効にします:

gpioset --mode=wait 0 43=0

JST インターフェース CAN1 を使用している場合は、ピン 106 をハイにプルしてください。

gpioset --mode=wait 0 106=0

このターミナルを開いたままにして、新しいターミナルを起動し、CAN0を設定します。

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

PythonとC++環境の構築

ステップ1: SDKをGitクローンします。

git clone https://github.com/ZhuYaoHui1998/myactuator_rmd.git

ステップ2: このドライバーSDKには以下の依存関係のインストールが必要です。Debian Linuxでは、以下のようにaptを通じてインストールできます:

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

Python バインディングを使用したい場合は、追加で Python 3、pip、pybind11 をインストールする必要があります:

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

依存関係をインストールした後、以下の手順で説明するように、ドライバーSDKをC++ライブラリまたはPythonパッケージとしてインストールする必要があります。どちらもCMakeを使用してC++コードをコンパイルします。

C++ライブラリのビルド

C++ドライバーSDKをビルドするには、このフォルダ内で新しいターミナルを開き、以下のコマンドを実行してください。古いバージョンのLinuxでは、ビルドが error: 'const struct can_frame' has no member named 'len' というエラーメッセージで失敗する場合があり、その場合はissue 5で議論されているコード修正を適用する必要があります。

cd ~/myactuator_rmd
mkdir build
cd build
cmake .. -D PYTHON_BINDINGS=on
make -j $(nproc)
sudo make install

フラグ PYTHON_BINDINGS(デフォルトはオフ)は、C++ライブラリに加えてPythonバインディングをビルドします。C++ライブラリの使用のみに興味がある場合は、オフのままにしておいて構いません。このようにPythonバインディングをビルドする場合、共有ライブラリとしてコンパイルされますが、インストールはされません。これは、ライブラリを手動でインストールするか、ビルドフォルダ内でローカルにのみインポートできることを意味します。

パッケージを再度アンインストールするには、次のコマンドを使用できます:xargs rm < install_manifest.txt

Pythonライブラリのビルド

このSDKのPythonバインディングをビルドしてインストールするには、メインフォルダ内で新しいターミナルを開き、次のコマンドを実行してください:

cd ~/myactuator_rmd
pip3 install .

これにより、setup.py を使用して CMake を呼び出し、バインディングを C++ ライブラリとしてインストールします。再度削除したい場合は、単純に pip3 uninstall myactuator-rmd-py を実行してください。

C++ を使用した制御

  1. プロジェクトディレクトリ構造の作成
    コードの src ディレクトリの下にプロジェクトディレクトリを作成します。例えば、myactuator_example という名前にして、サブディレクトリの下に src フォルダを作成します。
cd ~/myactuator_rmd
mkdir -p ~/myactuator_rmd/src/myactuator_example/src
cd ~/myactuator_rmd/src/myactuator_example
  1. CMakeLists.txtを書く
    ~/myactuator_rmd/src/myactuator_example/CMakeLists.txtファイルに、以下の内容を書きます:
touch CMakeLists.txt
cmake_minimum_required(VERSION 3.20)  
project(myactuator_example)

# Find the myactuator_rmd library
find_package(myactuator_rmd REQUIRED)

# Create executable
add_executable(myactuator_node
src/main.cpp
)

# Use C++17 standard
target_compile_features(myactuator_node PUBLIC
cxx_std_17
)

# Link the myactuator_rmd library
target_link_libraries(myactuator_node PUBLIC
myactuator_rmd::myactuator_rmd
)
  1. main.cpp を作成する
    ~/myactuator_rmd/src/myactuator_example/src/main.cpp ファイルに、以下のコードを記述します:
touch src/main.cpp
#include <cstdlib>
#include <iostream>
#include <myactuator_rmd/myactuator_rmd.hpp>

int main() {
myactuator_rmd::CanDriver driver {"can0"};
myactuator_rmd::ActuatorInterface actuator {driver, 1};

std::cout << actuator.getVersionDate() << std::endl;
std::cout << actuator.sendPositionAbsoluteSetpoint(180.0, 500.0) << std::endl;
actuator.shutdownMotor();
return EXIT_SUCCESS;
}
  1. Build the project
cd ~/myactuator_rmd/src/myactuator_example
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make
  1. プログラムを実行する
sudo ./myactuator_node

前提条件

  • CANインターフェース can0 が適切に設定されている必要があります(モーターとCANバスが正しく接続されていることを確認してください)。
  • myactuator_rmd ライブラリが適切にインストールされている必要があります(インストールされていない場合は、まずインストールしてください)。

C++実装の詳細については、myactuator_rmd.hpp のすべての内容を参照してください。Pythonの使用方法について詳細に紹介します。

Pythonを使用した制御

~/myactuator_rmd/src/myactuator_example ディレクトリの下に scripts という名前のフォルダを作成し、Pythonスクリプトを保存します。

cd ~/myactuator_rmd/src/myactuator_example
mkdir scripts

バージョン番号を取得

scriptsディレクトリの下にtest.pyという名前のカスタムPythonスクリプトを作成し、以下のコードを記入してください。

import myactuator_rmd_py as rmd
import time

# Initialize CAN driver and actuator interface
driver = rmd.CanDriver("can0") # Using can0
actuator = rmd.ActuatorInterface(driver, 1) # CAN ID set to 1

# Get version number
print("Version number:", actuator.getVersionDate())

ライブラリを読み込み、特定のネットワークインターフェース(ここではcan0)とドライブ(ここでは1、CAN-アドレス0x140 + 1 = 0x141に対応)のドライバーを作成し続けます。

モーターステータスの取得

# -*- coding: gbk -*-
import myactuator_rmd_py as rmd
import time
driver = rmd.CanDriver("can0")
actuator = rmd.ActuatorInterface(driver, 1)

# Motor Status 1
status1 = actuator.getMotorStatus1()
print(f"""
Motor Status 1:
Temperature: {status1.temperature}°C
Brake Status: {'Released' if status1.is_brake_released else 'Locked'}
Voltage: {status1.voltage}V
Error Code: {status1.error_code}
""")

# Motor Status 2
status2 = actuator.getMotorStatus2()
print(f"""
Motor Status 2:
Temperature: {status2.temperature}°C
Current: {status2.current}A
Shaft Speed: {status2.shaft_speed} RPM
Shaft Angle: {status2.shaft_angle}°
""")

# Motor Status 3
status3 = actuator.getMotorStatus3()
print(f"""
Motor Status 3:
Temperature: {status3.temperature}°C
Phase A Current: {status3.current_phase_a}A
Phase B Current: {status3.current_phase_b}A
Phase C Current: {status3.current_phase_c}A
""")

## Torque Calculation

import myactuator_rmd_py as rmd
from myactuator_rmd_py.actuator_constants import X4_24 # Import according to your motor model

def get_normalized_torque(actuator):
"""Calculate normalized torque from current"""
# Get current value
status = actuator.getMotorStatus2()
current = status.current

# Calculate normalized torque (current/rated)
torque_ratio = current / X4_24.rated_current
actual_torque = torque_ratio * X4_24.rated_torque
return actual_torque

# Usage example
driver = rmd.CanDriver("can0")
actuator = rmd.ActuatorInterface(driver, 1)

try:
while True:
torque = get_normalized_torque(actuator)
print(f"Current Torque: {torque:.3f} Nm (Rated: {X4_24.rated_torque} Nm)", end='\r')
time.sleep(0.1)
except KeyboardInterrupt:
actuator.shutdownMotor()

制御モード

  • 現在の制御モードを取得
# -*- coding: gbk -*-
import myactuator_rmd_py as rmd
import time
driver = rmd.CanDriver("can0")
actuator = rmd.ActuatorInterface(driver, 1)
mode = actuator.getControlMode()
print(f"Current Control Mode: {mode}")
  • 絶対位置制御
# -*- coding: gbk -*-
import myactuator_rmd_py as rmd
import time
driver = rmd.CanDriver("can0")
actuator = rmd.ActuatorInterface(driver, 1)

# Move to 180 degree position at 100 deg/s
actuator.sendPositionAbsoluteSetpoint(180.0, 300.0)
time.sleep(5) # Wait for motor to reach target position

# Get current position
angle = actuator.getMultiTurnAngle()
print(f"Current position: {angle}°")

time.sleep(5)
mode = actuator.getControlMode()
print(f"Current control mode: {mode}")
actuator.shutdownMotor()

モーターが180度の位置に回転するのを確認できます。

  • 相対位置制御
import myactuator_rmd_py as rmd
import time
driver = rmd.CanDriver("can0")
actuator = rmd.ActuatorInterface(driver, 1)

# Move an additional 90 degrees from current position
current_angle = actuator.getMultiTurnAngle()
target_angle = current_angle + 90.0
actuator.sendPositionAbsoluteSetpoint(target_angle, 50.0)
time.sleep(3)
angle = actuator.getMultiTurnAngle()
print(f"Current position: {angle}°")
mode = actuator.getControlMode()
print(f"Current control mode: {mode}")
actuator.shutdownMotor()

モーターが反時計回りに90度回転するのを観察できます。

  • 速度制御
# -*- coding: gbk -*-
import myactuator_rmd_py as rmd
import time
driver = rmd.CanDriver("can0")
actuator = rmd.ActuatorInterface(driver, 1)

# Continuous rotation at 500 RPM
actuator.sendVelocitySetpoint(500.0)
time.sleep(15)

# Stop motor
actuator.stopMotor()

# Get current position
angle = actuator.getMultiTurnAngle()
print(f"Current position: {angle}°")

mode = actuator.getControlMode()
print(f"Current control mode: {mode}")
  • トルク制御
# -*- coding: gbk -*-
import myactuator_rmd_py as rmd
import time
driver = rmd.CanDriver("can0")
actuator = rmd.ActuatorInterface(driver, 1)

# Apply 0.5A current (torque)
actuator.sendCurrentSetpoint(0.5)
time.sleep(2)

# Stop torque output
actuator.stopMotor()

# Get current position
angle = actuator.getMultiTurnAngle()
print(f"Current position: {angle}°")

mode = actuator.getControlMode()
print(f"Current control mode: {mode}")
  • クローズドループモーション制御
# -*- coding: gbk -*-
import myactuator_rmd_py as rmd
import time

# Initialization
driver = rmd.CanDriver("can0")
actuator = rmd.ActuatorInterface(driver, 1)

# Position control with feedback
feedback = actuator.sendPositionAbsoluteSetpoint(180.0, 100.0)
time.sleep(5)
print(feedback)


# Velocity control with feedback
feedback = actuator.sendVelocitySetpoint(20.0)
time.sleep(5)
print(feedback)

# Torque control with feedback
torque_constant = 0.32 # Set according to motor model
feedback = actuator.sendTorqueSetpoint(1.5, torque_constant)
time.sleep(5)
print(feedback)

actuator.stopMotor()

モーターブレーキ制御

# -*- coding: gbk -*-
import myactuator_rmd_py as rmd
import time
driver = rmd.CanDriver("can0")
actuator = rmd.ActuatorInterface(driver, 1)

# Engage brake
actuator.lockBrake()
print("Brake engaged")

# Release brake
actuator.releaseBrake()
print("Brake released")

モーター電源制御

# -*- coding: gbk -*-
import myactuator_rmd_py as rmd
import time
driver = rmd.CanDriver("can0")
actuator = rmd.ActuatorInterface(driver, 1)

# Power off motor
actuator.shutdownMotor()
print("Motor powered off")

エンコーダー機能

  • マルチターンエンコーダー位置を取得
# -*- coding: gbk -*-
import myactuator_rmd_py as rmd
import time
driver = rmd.CanDriver("can0")
actuator = rmd.ActuatorInterface(driver, 1)
encoder_pos = actuator.getMultiTurnEncoderPosition()
print(f"Multi-turn encoder position: {encoder_pos}")
  • 現在位置をゼロ点として設定(再起動が必要)
# -*- coding: gbk -*-
import myactuator_rmd_py as rmd
import time
driver = rmd.CanDriver("can0")
actuator = rmd.ActuatorInterface(driver, 1)
actuator.setCurrentPositionAsEncoderZero()
print("Current position set as encoder zero point")
  • カスタムゼロ点の設定(再起動が必要)
# -*- coding: gbk -*-
import myactuator_rmd_py as rmd
import time

driver = rmd.CanDriver("can0")
actuator = rmd.ActuatorInterface(driver, 1)

# Get current position as zero point
current_pos = actuator.getMultiTurnEncoderOriginalPosition()
print(f"Raw encoder position: {current_pos}")

# Set zero offset
actuator.setEncoderZero(current_pos)
print(f"Encoder zero point set to: {current_pos}")

# Reboot to apply settings
actuator.shutdownMotor()
time.sleep(1) # Wait for shutdown
actuator = rmd.ActuatorInterface(driver, 1) # Reinitialize

# Verify
new_pos = actuator.getMultiTurnEncoderPosition()
print(f"Post-reboot position (should be near 0): {new_pos}")

加速度設定

# -*- coding: gbk -*-
import myactuator_rmd_py as rmd
import time
from myactuator_rmd_py.actuator_state import AccelerationType

# Initialization
driver = rmd.CanDriver("can0")
actuator = rmd.ActuatorInterface(driver, 1)

## Get initial acceleration
print(f"Initial acceleration: {actuator.getAcceleration()}")

actuator.setAcceleration(5000, AccelerationType.POSITION_PLANNING_ACCELERATION)

## Get modified acceleration
print(f"Modified acceleration: {actuator.getAcceleration()}")

# Set different acceleration types
actuator.setAcceleration(1000, AccelerationType.POSITION_PLANNING_ACCELERATION)
actuator.setAcceleration(800, AccelerationType.POSITION_PLANNING_DECELERATION)
actuator.setAcceleration(1200, AccelerationType.VELOCITY_PLANNING_ACCELERATION)
actuator.setAcceleration(1000, AccelerationType.VELOCITY_PLANNING_DECELERATION)

技術サポート & 製品ディスカッション

弊社製品をお選びいただき、ありがとうございます!お客様の製品体験が可能な限りスムーズになるよう、さまざまなサポートを提供いたします。異なる好みやニーズに対応するため、複数のコミュニケーションチャネルをご用意しています。

Loading Comments...