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でのPC上でのデバッグ用に追加の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インターフェースの有効化

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

ステップ2: 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. プロジェクトのビルド
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...