インストール
方法 1.
sudo apt-get install ros-noetic-arbotix
方法 2.
cd ~/catkin_ws/src/
git clone https://github.com/vanadiumlabs/arbotix_ros.git
cd ~/catkin_ws/
catkin_make
使用
ArbotiXはROSのインターフェイス(ドライバー)を提供している汎用的なモーターコントローラー。モーター駆動のロボットの制御ハードとして使える便利な部品。
ROSのパッケージも提供しているため、ROS上で簡単にシミュレーションをできるので、実験として試して見る。
1.インストール終わったら、ArbotiXのPython実行ファイルに実行権限を付与する。じゃないと、シミュレーションで使えない
2.ロボットのモデルが用意されている前提だが、ロボットのlaunchファイルにArbotiXのノードを追加する。※pkg名は自分のものに書き換える。arbotix.yamlは次のステップで作る。
<node name="arbotix" pkg="arbotix_python" type="arbotix_driver" output="screen">
<rosparam file="$(find pkg名)/config/arbotix.yaml" command="load" />
<param name="sim" value="true" />
</node>
3.arbotixに必要なコンフィグファイルarbotix.yamlファイルを作る。pkgの下のconfigフォルダ内に入れる。
#パラメータ設定
controllers: {
base_controller: {
#タイプ設定:差動コントローラ
type: diff_controller,
#進行座標
base_frame_id: base_footprint,
#駆動輪の距離(m)
base_width: 0.2,
#制御timer(Hz)
ticks_meter: 2000,
#PID車速制御
Kp: 12,
Ki: 0,
Kd: 12,
Ko: 50,
#加速制限
accel_limit: 1.0
}
}
注意
動かしたら下記warningが出た、これはLobotのLink名とAbotixが制御したいLink名が異なることによる問題。
[ WARN] [1620731067.801481542]: Joint state with name: "base_l_wheel_joint" was received but not found in URDF
テスト
ターミナル1
roscore
ターミナル2
runlaunch pkg名 **.launch
参考Launchファイル
<launch>
<!-- robotbody -->
<arg name="model" default="$(find xacro)/xacro --inorder '$(find mrobot_description)/urdf/mrobot_with_kinect.urdf.xacro'" />
<arg name="gui" default="true" />
<param name="robot_description" command="$(arg model)" />
<!-- arbotix -->
<node name="arbotix" pkg="arbotix_python" type="arbotix_driver" output="screen">
<rosparam file="$(find mrobot_description)/config/fake_mrobot_arbotix.yaml" command="load" />
<param name="sim" value="true"/>
</node>
<!-- GUI設定 -->
<param name="use_gui" value="$(arg gui)"/>
<!-- ロボットのjoint_state_publisher -->
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
<!-- ロボットのrobot_state_publisher -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
<!-- rviz -->
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find mrobot_description)/config/mrobot.rviz" required="true" />
</launch>
ターミナル3(キーボード操作の情報をrosに出してくれるlaunch)
roslaunch mrobot_teleop mrobot_teleop.launch
これでRviz上でキーボード操作→arbotix→ロボット走行のシミュレーションができた。