StackChan + micro-ROS + Arduino
- Ubuntu 24.04 LTS
- ROS 2 Jazzy
- Docker 29.5.0
- Arduino IDE 2.3.8, 2.3.9
- micro_ros_arduino 2.0.7-humble, 3.0.0-iron
- M5StackChan 1.0.1
- M5Stack_Avatar 0.10.0
- ROS 2 Jazzy Installation
- StackChan Arduino Sample Program Build and Flash
- micro-ROS/micro_ros_arduino
- stack-chan/m5stack-avatar
- Clone this repository.
git clone https://github.com/YusukeKato/stack-chan_micro-ros_arduino.git- Copy
config.h.exampletoconfig.hand edit it to match your environment. - Upload the program to your StackChan.
- Start micro-ROS Agent.
docker run -it --rm --net=host microros/micro-ros-agent:jazzy udp4 --port 8888 -v6- Press the reset button on your StackChan to restart it.
Displays the m5avatar::Expression:::Neutral face.
Control the motor by specifying the angle.
ros2 topic pub --once /stackchan/joint_commands std_msgs/msg/Int32MultiArray "{data: [200, 500]}"
Get the current motor angle.
ros2 topic echo /stackchan/joint_states# output
layout:
dim: []
data_offset: 0
data:
- 331
- 300
Get the publish rate of the camera image topic.
ros2 topic hz /stackchan/camera/image/compressedView the camera image topic.
ros2 run rqt_image_view rqt_image_viewNote: If
rqt_image_viewdoesn't work properly on Wayland, please switch to Xorg.
Get the battery voltage, remaining level (%), and charging status.
ros2 topic echo /stackchan/battery_state# output
header:
stamp:
sec: 1778980809
nanosec: 0
frame_id: base_link
voltage: 4.205999851226807 # Voltage [V]
temperature: 0.0
current: 0.0
charge: 0.0
capacity: 0.0
design_capacity: 0.0
percentage: 0.9300000071525574 # remaining level [0.0-1.0]
power_supply_status: 1 # 1:charging, 2:discharging
power_supply_health: 0
power_supply_technology: 0
present: false
cell_voltage: []
cell_temperature: []
location: ''
serial_number: ''Send text, and StackChan will speak.
ros2 topic pub --once /stackchan/speech_text std_msgs/msg/String "{data: 'ohayou gozaimasu'}"YouTube↓
Get touch sensor values.
ros2 topic echo /stackchan/touch_intensities# output
---
layout:
dim: []
data_offset: 0
data:
- 3 # Front
- 0 # Middle
- 1 # Back
---
Get the IMU data.
Note1: M5StackChan(X-right, Y-down, Z-backward) -> ROS 2(X-forward, Y-left, Z-up)
Note2: Same axis mapping for linear and angular, but different sign inversions.
ros2 topic echo /stackchan/imu# output
header:
stamp:
sec: 1780211663
nanosec: 838000000
frame_id: imu_link
orientation:
...
orientation_covariance:
...
angular_velocity:
x: 0.059654808417774936
y: 0.08096009713840883
z: -0.0010652644360316954
angular_velocity_covariance:
...
linear_acceleration:
x: -0.3208230137825012
y: 0.1412578970193863
z: -9.68694019317627
linear_acceleration_covariance:
...
- You can check the debug logs in the Arduino IDE Serial Monitor.
clang-format -i -style=file *.ino *.h