Coder Social home page Coder Social logo

robomaster_ros's Introduction

Robomaster-ROS

This repository contains a ROS2 driver for the DJI Robomaster family of robots (EP and S1) based on the official Python client library.

Full documentation available at https://jeguzzi.github.io/robomaster_ros.

Installation

Pre-requisites

ROS2

Install a currently supported version of ROS2 (foxy -- iron), following the official instructions. and then install colcon

sudo apt install python3-colcon-common-extensions

If you just install ROS2-base, add also the following packages:

xacro, launch-xml, cv-bridge, launch-testing-ament-cmake, robot-state-publisher, joint-state-publisher-gui, joy, joy-teleop
sudo apt install \
  ros-<ROS_DISTRO>-xacro \
  ros-<ROS_DISTRO>-launch-xml \
  ros-<ROS_DISTRO>-cv-bridge \
  ros-<ROS_DISTRO>-launch-testing-ament-cmake \
  ros-<ROS_DISTRO>-robot-state-publisher \
  ros-<ROS_DISTRO>-joint-state-publisher \
  ros-<ROS_DISTRO>-joint-state-publisher-gui \
  ros-<ROS_DISTRO>-joy \
  ros-<ROS_DISTRO>-joy-teleop \
  ros-<ROS_DISTRO>-joy-linux

Robomaster SDK

Install this fork of the official RoboMaster-SDK, which fixes some issues of the upstream repo.

First install its dependencies libopus-dev

sudo apt install libopus-dev python3-pip

and

python3 -m pip install -U numpy numpy-quaternion pyyaml

then install the RoboMaster-SDK

python3 -m pip install git+https://github.com/jeguzzi/RoboMaster-SDK.git
python3 -m pip install git+https://github.com/jeguzzi/RoboMaster-SDK.git#"egg=libmedia_codec&subdirectory=lib/libmedia_codec"

ROS2 package

Create a colcon package where you want to build the packages, clone this repository, and built the packages.

mkdir -p <ros2_ws>/src
git clone https://github.com/jeguzzi/robomaster_ros.git
cd <ros2_ws>
source /opt/ros/<ROS_DISTRO>/setup.bash
colcon build

Usage

Use one of the two launch files {s1|ep}.launch to launch the driver and the robot model.

cd <ros2_ws>
source install/setup.bash
ros2 launch robomaster_ros {s1|ep}.launch

We also provide docker images. Check the documentation for their usage.

Arguments

The launch files accept a list of arguments

ros2 launch robomaster_ros {s1|ep}.launch <key_1>:=<value_1> <key_2>:=<value_2> ...

Common Configurations

The two different robot models share some configuration.

key type valid values default description
name string valid ROS names '' a name used as ROS namespace
serial_number string 8 character ascii strings '' the serial number of the robot, leave empty to connect to the first robot found
conn_type string ap, rndis, sta sta the connection network type: managed/router (sta); robot's access point (ap); usb (rndis)
lib_log_level string DEBUG, INFO, WARN, ERROR ERROR the log-level used by the internal Robomaster API
video_resolution integer 360, 540, 720 360 the video [vertical] resolution: 640x360 (360); 960x540 (540); 1280x720 (720)
video_raw bool true whether to publish the raw [decompressed] images to the topic <name>/camera/image_raw
video_h264 bool false whether to publish the original h264 video stream to the topic <name>/camera/image_h264
video_compressed bool false whether to publish the compressed [jpeg] images to the topic <name>/camera/image_raw/compressed
audio_raw bool true whether to publish the raw [decompressed] audio to the topic <name>/camera/audio_raw
audio_opus bool true whether to publish the original [compressed] opus audio stream to the topic <name>/camera/audio_opus
chassis_rate int 1, 5, 10, 20, 50 10 the rate [Hz] at which to publish the odometry
joint_state_rate int 1, 5, 10, 20, 50 10 the rate [Hz] at which to publish aggregated joint states
sensor_adapter bool false Whether at least one sensor adapter (IO) is connected and should be published to <name>/...
sensor_adapter_rate int 1, 5, 10, 20, 50 10 the rate [Hz] at which to publish the sensor adapter values

S1-specific Configurations

Some configurations are specific for the Robomaster S1.

key type valid values default description
gimbal_rate integer 1, 5, 10, 20, 50 10 the rate [Hz] at which to gather the gimbal state
display_battery string off, right, left off whether and where to display the battery state: do not display (on); display on the right gimbal led (right); display on the left gimbal led (left)

EP-specific Configurations

Some configurations are specific for the Robomaster EP.

key type valid values default description
left_motor_zero int 1242 the [arm] left servo motor encoder value at zero angle
right_motor_zero int 1273 the [arm] right servo motor encoder value at zero angle
left_motor_direction int -1, 1 -1 the [arm] left servo motor direction: angle increases when encoder increases (+1); angle decreases when encoder increases (-1)
right_motor_direction int -1, 1 -1 the [arm] right servo motor direction: angle increases when encoder increases (+1); angle decreases when encoder increases (-1)

Multiple robots

If you want to control multiple robots through ROS, you need to know their serial numbers and set a different name for each of them (names are used as ROS namespaces and as tf prefixes). For physical robots, the serial number is written on top of the intelligent controller. For simulated robots, you set the serial number when you launch the simulation.

For example, we assume that you are using two [simulated] S1 robots with serial numbers "RM0" and "RM1", and that you want to use the serial numbers also as names. In two consoles, launch

cd <ros2_ws>
source install/setup.bash
ros2 launch robomaster_ros s1.launch name:=RM0 serial_number:=RM0

and

cd <ros2_ws>
source install/setup.bash
ros2 launch robomaster_ros s1.launch name:=RM1 serial_number:=RM1

Then, for instance, you can make the robots spin in opposite direction by publishing to their respective topics:

ros2 topic pub /RM0/cmd_vel geometry_msgs/msg/Twist "{angular: {z: -0.5}}" --once
ros2 topic pub /RM1/cmd_vel geometry_msgs/msg/Twist "{angular: {z: 0.5}}" --once

Thanks

This work has been supported by the European Commission through the Horizon 2020 project 1-SWARM, grant ID 871743.

robomaster_ros's People

Contributors

austinbrown101 avatar jeguzzi avatar proger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

robomaster_ros's Issues

About the robomasterEP model

I load the model of the provided robomasterEP in gazebo but it seems like the arm part are not well connected like shown in the fig. I examined the arm.urdf.xacro file and find only 1 joint defined about the triangle_link and arm_1_link while there should be 3. Why and how to fix this?
Screenshot 2023-11-14 20:19:03

the action server failed to start: robomaster_msgs.action.PlaySound, "play"

the speaker.py: cmd_sound cannot play the wav file. I tried demo1.wav.
the below code skipped msg.file. just only passed three parameters to the function play:
self.play(sound_id=msg.sound_id, times=msg.times, control=msg.control)
by using these new code robomaster s1 can play a wav file:
if msg.file and msg.control:
self.api.play_audio(msg.file).wait_for_completed()
else:
self.play(sound_id=msg.sound_id, times=msg.times, control=msg.control)
Maybe it's not the best way to play a wav file, Can someone give me any suggestion?

and the action server play didn't start, I only can find /play/_action/cancel_goal in rqt service caller , but the command: ros2 action list can find /play, strange !!!

    **_self._sound_action_server = rclpy.action.ActionServer(
        node, robomaster_msgs.action.PlaySound, "play", self.execute_play_sound,
        goal_callback=self.new_speaker_goal_callback,
        cancel_callback=self.cancel_callback, callback_group=cbg)_**

host cannot communicate with container

Hi,
I started the container via command: sudo docker compose up
I tried to use rqt (and rqt_graph) to monitor the topics published in container. and rqt can list out the topics in container but cannot print out the topic content. but rqt_grahp cannot find the nodes created in container. and RVIZ2 also cannot subscribe the image from S1. ROS_DOMAIN_ID were set to the same number both in container and host.
Are there any other settings should be done before connect to S1 in container?
I think it could be easy to correct the settings. thank you for any suggestions.

the yaml file:
version: '3'
services:
driver:
image: jeguzzi/robomaster_ros:humble
build:
context: ..
dockerfile: Dockerfile
network_mode: host
environment:
- ROS_DOMAIN_ID=1
command: ros2 launch robomaster_ros main.launch model:=s1 chassis_twist_to_wheel_speeds:=true gimbal_mode:=0 chassis_timeout:=1.0

log information print out in terminal:
sudo docker compose up
[sudo] password for orin:
WARN[0000] Found orphan containers ([s1-teleop-1]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
[+] Running 1/0
โœ” Container s1-driver-1 Created 0.0s
Attaching to driver-1
driver-1 | [INFO] [launch]: All log files can be found below /root/.ros/log/2024-02-24-03-33-28-258386-orin-agx-1
driver-1 | [INFO] [launch]: Default logging verbosity is set to INFO
driver-1 | [INFO] [robomaster_driver-1]: process started with pid [64]
driver-1 | [INFO] [robot_state_publisher-2]: process started with pid [66]
driver-1 | [INFO] [joint_state_publisher-3]: process started with pid [68]
driver-1 | [robot_state_publisher-2] Warning: link 'speaker_link' material 'Material #32.001' undefined.
driver-1 | [robot_state_publisher-2] at line 84 in /ros_ws/src/urdfdom/urdf_parser/src/model.cpp
driver-1 | [robot_state_publisher-2] Warning: link 'speaker_link' material 'Material #32.001' undefined.
driver-1 | [robot_state_publisher-2] at line 84 in /ros_ws/src/urdfdom/urdf_parser/src/model.cpp
driver-1 | [robomaster_driver-1] [INFO] [1708745610.117109422] [robomaster]: Waiting for a robot
driver-1 | [robomaster_driver-1] [INFO] [1708745610.122266496] [robomaster]: Found a robot
driver-1 | [robomaster_driver-1] [INFO] [1708745610.123151966] [robomaster]: Try to connect via sta to robot with sn None
driver-1 | [robomaster_driver-1] [INFO] [1708745610.843849004] [robomaster]: Connected
driver-1 | [robomaster_driver-1] [INFO] [1708745610.960670140] [robomaster]: [Chassis] Topic cmd_vel will control wheel speeds
driver-1 | [robomaster_driver-1] [INFO] [1708745611.204520034] [robomaster]: Set initial robot mode to free
driver-1 | [robomaster_driver-1] [INFO] [1708745611.277636644] [robomaster]: Enabled modules: Battery, Camera, Chassis, LED, Speaker, Gimbal, Blaster
driver-1 | [robomaster_driver-1] [INFO] [1708745612.112190250] [robomaster]: [Camera] Started video stream with resolution 360p

How to visualize the EP robot model in rviz/gazebo?

Dear author, I have found the robomaster_description folder and xacro models of EP/S1 robot in your project, but I have not found any launch files that could open visualization nodes in robomaster_ros folder. If I need to visualize the actions of multiple EP robots in rviz/gazebo, how should I set them?
Hope to get your reply, thank you!

Can't connect to S1 using dockerized 'humble' Ros2, in 'ap' mode

OS host: windows 10 pro, docker does not use WSL, just old good virtualization.

I' tried first to use Robomaster standard sdk, and it does work:

ep_robot = robot.Robot()
ep_robot.initialize(conn_type='ap')
True
version = ep_robot.get_version()
print("Robot version: {0}".format(version))
Robot version: 00.06.0518
SN = ep_robot.get_sn()
print("Robot SN:", SN)
Robot SN: 159CXXXXXXXXX
ep_robot.close()

I'm trying to get dockerized ROS2 humble working
In a docker compose I adjusted only: command: ros2 launch robomaster_ros main.launch model:=s1 lib_log_level:=DEBUG conn_type:=ap

And getting errors in a log:

...
2024-06-24 22:55:55 [INFO] [joint_state_publisher-3]: process started with pid [4746]
2024-06-24 22:55:56 [robot_state_publisher-2] Warning: link 'speaker_link' material 'Material #32.001' undefined.
2024-06-24 22:55:56 [robot_state_publisher-2] at line 84 in /ros_ws/src/urdfdom/urdf_parser/src/model.cpp
2024-06-24 22:55:56 [robot_state_publisher-2] Warning: link 'speaker_link' material 'Material #32.001' undefined.
2024-06-24 22:55:56 [robot_state_publisher-2] at line 84 in /ros_ws/src/urdfdom/urdf_parser/src/model.cpp
2024-06-24 22:56:04 [robomaster_driver-1] [INFO] [1719284164.120571500] [robomaster]: Try to connect via ap to robot with sn None
2024-06-24 22:56:04 [robomaster_driver-1] 2024-06-25 02:56:04,127 INFO robot.py:1284 Robot: try to connection robot.
2024-06-24 22:56:04 [robomaster_driver-1] 2024-06-25 02:56:04,134 INFO conn.py:350 CONN TYPE is ap
2024-06-24 22:56:04 [robomaster_driver-1] 2024-06-25 02:56:04,134 INFO conn.py:360 Robot: request_connection, ap get local ip:0.0.0.0
2024-06-24 22:56:04 [robomaster_driver-1] 2024-06-25 02:56:04,136 INFO conn.py:393 SdkConnection: request_connection, local addr ('0.0.0.0', 10406), remote_addr ('192.168.2.1', 20020), proxy addr ('192.168.2.1', 30030)
2024-06-24 22:56:04 [robomaster_driver-1] 2024-06-25 02:56:04,140 DEBUG protocol.py:286 Msg: pack, len:23, seq_id:10001, buf:b'55170438c9091127403fd400c9000000000000a628faf3'
2024-06-24 22:56:04 [robomaster_driver-1] 2024-06-25 02:56:04,204 DEBUG conn.py:325 SdkConnection, data:b'5513040309c01127803fd40002c0a8021b4bb5'.
2024-06-24 22:56:04 [robomaster_driver-1] 2024-06-25 02:56:04,205 INFO conn.py:337 SdkConnection: got config ip:192.168.2.27
2024-06-24 22:56:04 [robomaster_driver-1] 2024-06-25 02:56:04,206 INFO robot.py:1287 Robot: initialized with Connection, host:('192.168.2.27', 10406), target:('192.168.2.1', 20020)
2024-06-24 22:56:04 [robomaster_driver-1] 2024-06-25 02:56:04,209 WARNING conn.py:168 udpConnection: create, host_addr:('192.168.2.27', 10406), exception:[Errno 99] Cannot assign requested address
2024-06-24 22:56:04 [robomaster_driver-1] 2024-06-25 02:56:04,210 ERROR robot.py:1300 Robot: Connection Create Failed.
2024-06-24 22:56:04 [robomaster_driver-1] Traceback (most recent call last):
2024-06-24 22:56:04 [robomaster_driver-1] File "/opt/ros/ws/lib/robomaster_ros/robomaster_driver", line 33, in
2024-06-24 22:56:04 [robomaster_driver-1] sys.exit(load_entry_point('robomaster-ros==0.0.0', 'console_scripts', 'robomaster_driver')())
2024-06-24 22:56:04 [robomaster_driver-1] File "/opt/ros/ws/lib/python3.10/site-packages/robomaster_ros/robomaster_driver.py", line 40, in main
2024-06-24 22:56:04 [robomaster_driver-1] node = RoboMasterROS(executor=executor)
2024-06-24 22:56:04 [robomaster_driver-1] File "/opt/ros/ws/lib/python3.10/site-packages/robomaster_ros/client.py", line 121, in init
2024-06-24 22:56:04 [robomaster_driver-1] self.ep_robot.initialize(conn_type=conn_type, sn=sn)
2024-06-24 22:56:04 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/robot.py", line 1301, in initialize
2024-06-24 22:56:04 [robomaster_driver-1] raise e
2024-06-24 22:56:04 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/robot.py", line 1298, in initialize
2024-06-24 22:56:04 [robomaster_driver-1] self._client.start()
2024-06-24 22:56:04 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/client.py", line 129, in start
2024-06-24 22:56:04 [robomaster_driver-1] raise e
2024-06-24 22:56:04 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/client.py", line 123, in start
2024-06-24 22:56:04 [robomaster_driver-1] result = self.initialize()
2024-06-24 22:56:04 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/client.py", line 114, in initialize
2024-06-24 22:56:04 [robomaster_driver-1] raise e
2024-06-24 22:56:04 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/client.py", line 112, in initialize
2024-06-24 22:56:04 [robomaster_driver-1] self._conn.create()
2024-06-24 22:56:04 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/conn.py", line 279, in create
2024-06-24 22:56:04 [robomaster_driver-1] super().create()
2024-06-24 22:56:04 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/conn.py", line 163, in create
2024-06-24 22:56:04 [robomaster_driver-1] self._sock.bind(self._host_addr)
2024-06-24 22:56:04 [robomaster_driver-1] OSError: [Errno 99] Cannot assign requested address
2024-06-24 22:56:04 [robomaster_driver-1] Exception ignored in: <function Robot.del at 0x40002ebe1120>
2024-06-24 22:56:04 [robomaster_driver-1] Traceback (most recent call last):
2024-06-24 22:56:04 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/robot.py", line 1109, in del
2024-06-24 22:56:04 [robomaster_driver-1] self.close()
2024-06-24 22:56:04 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/robot.py", line 1329, in close
2024-06-24 22:56:04 [robomaster_driver-1] self._client.stop()
2024-06-24 22:56:04 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/client.py", line 132, in stop
2024-06-24 22:56:04 [robomaster_driver-1] if self._thread.is_alive():
2024-06-24 22:56:04 [robomaster_driver-1] AttributeError: 'NoneType' object has no attribute 'is_alive'
2024-06-24 22:56:04 [robomaster_driver-1] Exception ignored in: <function Client.del at 0x400002a9a3b0>
2024-06-24 22:56:04 [robomaster_driver-1] Traceback (most recent call last):
2024-06-24 22:56:04 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/client.py", line 88, in del
2024-06-24 22:56:04 [robomaster_driver-1] self.stop()
2024-06-24 22:56:04 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/client.py", line 132, in stop
2024-06-24 22:56:04 [robomaster_driver-1] if self._thread.is_alive():
2024-06-24 22:56:04 [robomaster_driver-1] AttributeError: 'NoneType' object has no attribute 'is_alive'
2024-06-24 22:56:04 [ERROR] [robomaster_driver-1]: process has died [pid 4738, exit code 1, cmd '/opt/ros/ws/lib/robomaster_ros/robomaster_driver --ros-args --log-level info --ros-args -r __node:=robomaster -r __ns:=/ --params-file /tmp/launch_params_uz4gqq30 --params-file /tmp/launch_params_5aqhydyi --params-file /tmp/launch_params_h0ebskhu --params-file /tmp/launch_params__9r7w_cv --params-file /tmp/launch_params_z3_7vhkj --params-file /tmp/launch_params_43xn_j77 --params-file /tmp/launch_params_4ygk7ha3 --params-file /tmp/launch_params_atbvjtn7 --params-file /tmp/launch_params_hbo848ve --params-file /tmp/launch_params_2nes5ujo --params-file /tmp/launch_params_m488_2il --params-file /tmp/launch_params_jpt9mmul --params-file /tmp/launch_params_0cjipdio --params-file /tmp/launch_params_yt56tnkv --params-file /tmp/launch_params_77qc2jfa --params-file /tmp/launch_params_ik4sfq77 --params-file /tmp/launch_params_5pyxg3nm --params-file /tmp/launch_params_f4zznng1 --params-file /tmp/launch_params_0u65zyrv --params-file /tmp/launch_params_mwlm8sv3 --params-file /tmp/launch_params_tg0fvcj0 --params-file /tmp/launch_params_urr006tr'].
2024-06-24 23:09:24 [INFO] [launch]: All log files can be found below /root/.ros/log/2024-06-25-03-09-24-415898-docker-desktop-5431
2024-06-24 23:09:24 [INFO] [launch]: Default logging verbosity is set to INFO
2024-06-24 23:09:33 [INFO] [robomaster_driver-1]: process started with pid [5776]
2024-06-24 23:09:33 [INFO] [robot_state_publisher-2]: process started with pid [5780]
2024-06-24 23:09:33 [INFO] [joint_state_publisher-3]: process started with pid [5784]
2024-06-24 23:09:34 [robot_state_publisher-2] Warning: link 'speaker_link' material 'Material #32.001' undefined.
2024-06-24 23:09:34 [robot_state_publisher-2] at line 84 in /ros_ws/src/urdfdom/urdf_parser/src/model.cpp
2024-06-24 23:09:34 [robot_state_publisher-2] Warning: link 'speaker_link' material 'Material #32.001' undefined.
2024-06-24 23:09:34 [robot_state_publisher-2] at line 84 in /ros_ws/src/urdfdom/urdf_parser/src/model.cpp
2024-06-24 23:09:40 [robomaster_driver-1] [INFO] [1719284980.820218200] [robomaster]: Try to connect via ap to robot with sn None
2024-06-24 23:09:40 [robomaster_driver-1] 2024-06-25 03:09:40,827 INFO robot.py:1284 Robot: try to connection robot.
2024-06-24 23:09:40 [robomaster_driver-1] 2024-06-25 03:09:40,833 INFO conn.py:350 CONN TYPE is ap
2024-06-24 23:09:40 [robomaster_driver-1] 2024-06-25 03:09:40,834 INFO conn.py:360 Robot: request_connection, ap get local ip:0.0.0.0
2024-06-24 23:09:40 [robomaster_driver-1] 2024-06-25 03:09:40,836 INFO conn.py:393 SdkConnection: request_connection, local addr ('0.0.0.0', 10321), remote_addr ('192.168.2.1', 20020), proxy addr ('192.168.2.1', 30030)
2024-06-24 23:09:40 [robomaster_driver-1] 2024-06-25 03:09:40,840 DEBUG protocol.py:286 Msg: pack, len:23, seq_id:10001, buf:b'55170438c9091127403fd400c90000000000005128fac2'
2024-06-24 23:09:40 [robomaster_driver-1] 2024-06-25 03:09:40,901 DEBUG conn.py:325 SdkConnection, data:b'5513040309c01127803fd40002c0a8021b4bb5'.
2024-06-24 23:09:40 [robomaster_driver-1] 2024-06-25 03:09:40,902 INFO conn.py:337 SdkConnection: got config ip:192.168.2.27
2024-06-24 23:09:40 [robomaster_driver-1] 2024-06-25 03:09:40,903 INFO robot.py:1287 Robot: initialized with Connection, host:('192.168.2.27', 10321), target:('192.168.2.1', 20020)
2024-06-24 23:09:40 [robomaster_driver-1] 2024-06-25 03:09:40,907 WARNING conn.py:168 udpConnection: create, host_addr:('192.168.2.27', 10321), exception:[Errno 99] Cannot assign requested address
2024-06-24 23:09:40 [robomaster_driver-1] 2024-06-25 03:09:40,908 ERROR robot.py:1300 Robot: Connection Create Failed.
2024-06-24 23:09:40 [robomaster_driver-1] Traceback (most recent call last):
2024-06-24 23:09:40 [robomaster_driver-1] File "/opt/ros/ws/lib/robomaster_ros/robomaster_driver", line 33, in
2024-06-24 23:09:40 [robomaster_driver-1] sys.exit(load_entry_point('robomaster-ros==0.0.0', 'console_scripts', 'robomaster_driver')())
2024-06-24 23:09:40 [robomaster_driver-1] File "/opt/ros/ws/lib/python3.10/site-packages/robomaster_ros/robomaster_driver.py", line 40, in main
2024-06-24 23:09:40 [robomaster_driver-1] node = RoboMasterROS(executor=executor)
2024-06-24 23:09:40 [robomaster_driver-1] File "/opt/ros/ws/lib/python3.10/site-packages/robomaster_ros/client.py", line 121, in init
2024-06-24 23:09:40 [robomaster_driver-1] self.ep_robot.initialize(conn_type=conn_type, sn=sn)
2024-06-24 23:09:40 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/robot.py", line 1301, in initialize
2024-06-24 23:09:40 [robomaster_driver-1] raise e
2024-06-24 23:09:40 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/robot.py", line 1298, in initialize
2024-06-24 23:09:40 [robomaster_driver-1] self._client.start()
2024-06-24 23:09:40 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/client.py", line 129, in start
2024-06-24 23:09:40 [robomaster_driver-1] raise e
2024-06-24 23:09:40 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/client.py", line 123, in start
2024-06-24 23:09:40 [robomaster_driver-1] result = self.initialize()
2024-06-24 23:09:40 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/client.py", line 114, in initialize
2024-06-24 23:09:40 [robomaster_driver-1] raise e
2024-06-24 23:09:40 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/client.py", line 112, in initialize
2024-06-24 23:09:40 [robomaster_driver-1] self._conn.create()
2024-06-24 23:09:40 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/conn.py", line 279, in create
2024-06-24 23:09:40 [robomaster_driver-1] super().create()
2024-06-24 23:09:40 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/conn.py", line 163, in create
2024-06-24 23:09:40 [robomaster_driver-1] self._sock.bind(self._host_addr)
2024-06-24 23:09:40 [robomaster_driver-1] OSError: [Errno 99] Cannot assign requested address
2024-06-24 23:09:41 [robomaster_driver-1] Exception ignored in: <function Robot.del at 0x40002ebe1120>
2024-06-24 23:09:41 [robomaster_driver-1] Traceback (most recent call last):
2024-06-24 23:09:41 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/robot.py", line 1109, in del
2024-06-24 23:09:41 [robomaster_driver-1] self.close()
2024-06-24 23:09:41 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/robot.py", line 1329, in close
2024-06-24 23:09:41 [robomaster_driver-1] self._client.stop()
2024-06-24 23:09:41 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/client.py", line 132, in stop
2024-06-24 23:09:41 [robomaster_driver-1] if self._thread.is_alive():
2024-06-24 23:09:41 [robomaster_driver-1] AttributeError: 'NoneType' object has no attribute 'is_alive'
2024-06-24 23:09:41 [robomaster_driver-1] Exception ignored in: <function Client.del at 0x400002a9a3b0>
2024-06-24 23:09:41 [robomaster_driver-1] Traceback (most recent call last):
2024-06-24 23:09:41 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/client.py", line 88, in del
2024-06-24 23:09:41 [robomaster_driver-1] self.stop()
2024-06-24 23:09:41 [robomaster_driver-1] File "/usr/local/lib/python3.10/dist-packages/robomaster/client.py", line 132, in stop
2024-06-24 23:09:41 [robomaster_driver-1] if self._thread.is_alive():
2024-06-24 23:09:41 [robomaster_driver-1] AttributeError: 'NoneType' object has no attribute 'is_alive'
2024-06-24 23:09:41 [ERROR] [robomaster_driver-1]: process has died [pid 5776, exit code 1, cmd '/opt/ros/ws/lib/robomaster_ros/robomaster_driver --ros-args --log-level info --ros-args -r __node:=robomaster -r ns:=/ --params-file /tmp/launch_params__k_dlb3 --params-file /tmp/launch_params_q3zlf4fm --params-file /tmp/launch_params_pdub5prf --params-file /tmp/launch_params_92rud1a7 --params-file /tmp/launch_params_6j16wchu --params-file /tmp/launch_params_5746arhq --params-file /tmp/launch_params_oes_j5s9 --params-file /tmp/launch_params_mz44uj1k --params-file /tmp/launch_params_fa_m1i0k --params-file /tmp/launch_params_awujzbge --params-file /tmp/launch_params_ooa_ydk --params-file /tmp/launch_params_3ppk6dvo --params-file /tmp/launch_params_6snovqgr --params-file /tmp/launch_params_zq0l8wc6 --params-file /tmp/launch_params_4usgrgjn --params-file /tmp/launch_params_jlo4u8qo --params-file /tmp/launch_params_37d_ej9v --params-file /tmp/launch_params_511flnak --params-file /tmp/launch_params_wupqfz5z --params-file /tmp/launch_params_nr48uink --params-file /tmp/launch_params_iqcgih8c --params-file /tmp/launch_params_jochevg6'].
2024-06-24 23:25:01 [INFO] [launch]: All log files can be found below /root/.ros/log/2024-06-25-03-25-01-268475-docker-desktop-6059
2024-06-24 23:25:01 [INFO] [launch]: Default logging verbosity is set to INFO

Can't launch ep.launch or s1.launch

Hi Jeguzzi, I have successfully built robomaster_ros on several newly installed Ubuntu20, but every one failed to launch (the last step) with one exactly same error msg.
The error goes like this:
pkg_resources.DistributionNotFound: The 'robomaster' distribution was not found and is required by robomaster-ros

The whole log are as follows:

[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robomaster_driver-1]: process started with pid [21770]
[INFO] [robot_state_publisher-2]: process started with pid [21772]
[INFO] [joint_state_publisher-3]: process started with pid [21774]
[robot_state_publisher-2] Link chassis_base_link had 8 children
[robot_state_publisher-2] Link front_hit_sensor_link had 1 children
[robot_state_publisher-2] Link front_led_link had 0 children
[robot_state_publisher-2] Link front_left_wheel_link had 0 children
[robot_state_publisher-2] Link front_right_wheel_link had 0 children
[robot_state_publisher-2] Link left_hit_sensor_link had 1 children
[robot_state_publisher-2] Link left_led_link had 0 children
[robot_state_publisher-2] Link rear_hit_sensor_link had 1 children
[robot_state_publisher-2] Link rear_led_link had 0 children
[robot_state_publisher-2] Link rear_left_wheel_link had 0 children
[robot_state_publisher-2] Link rear_right_wheel_link had 0 children
[robot_state_publisher-2] Link right_hit_sensor_link had 1 children
[robot_state_publisher-2] Link right_led_link had 0 children
[robot_state_publisher-2] Link gimbal_base_link had 1 children
[robot_state_publisher-2] Link gimbal_link had 3 children
[robot_state_publisher-2] Link blaster_link had 3 children
[robot_state_publisher-2] Link camera_link had 1 children
[robot_state_publisher-2] Link camera_optical_link had 0 children
[robot_state_publisher-2] Link intelligent_controller_link had 0 children
[robot_state_publisher-2] Link speaker_link had 0 children
[robot_state_publisher-2] Link gimbal_left_led_link had 0 children
[robot_state_publisher-2] Link gimbal_right_led_link had 0 children
[robomaster_driver-1] Traceback (most recent call last):
[robomaster_driver-1]   File "/home/zhe/code/rm_ws/install/robomaster_ros/lib/robomaster_ros/robomaster_driver", line 6, in <module>
[robomaster_driver-1]     from pkg_resources import load_entry_point
[robomaster_driver-1]   File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3254, in <module>
[robomaster_driver-1]     def _initialize_master_working_set():
[robomaster_driver-1]   File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3237, in _call_aside
[robomaster_driver-1]     f(*args, **kwargs)
[robomaster_driver-1]   File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3266, in _initialize_master_working_set
[robomaster_driver-1]     working_set = WorkingSet._build_master()
[robomaster_driver-1]   File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 584, in _build_master
[robomaster_driver-1]     ws.require(__requires__)
[robomaster_driver-1]   File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 901, in require
[robomaster_driver-1]     needed = self.resolve(parse_requirements(requirements))
[robomaster_driver-1]   File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 787, in resolve
[robomaster_driver-1]     raise DistributionNotFound(req, requirers)
[robomaster_driver-1] pkg_resources.DistributionNotFound: The 'robomaster' distribution was not found and is required by robomaster-ros

But I have definitely installed RoboMaster-SDK as instructed in README.md.
However, I was using latest miniconda3, and create an env called py38, and I have activated this env to execute all building and launch procedures, I wonder if this could cause the problem.

Robomaster does not connect to ROS2 humble on WSL2

Good afternoon. Help please soon I have a diploma, and the project is not ready. Because ROS2 does not see the robot Robomaster EP or S1 (I am confused in them), although it is written, as soon as your robot and PC will be on the same network, you can execute the command <ros2 launch robomaster_ros {s1|ep}.launch> and everything will work. And nothing works because it can't see the robot.
I installed wsl2 for windows 11, Ubuntu 22.04 distribution, installed ROS2 humble, all packages using colcon built fine. I run the file from RobomasterSDK 05_conn_helper.py on windows to display the QR code to connect Robomaster.
Yes, and it is not clear what the result will be, as there are no screenshots. I would at least like to see a video about the product in this repository.
Thanks in advance)
P.S. Docker's having the same problem.

URDF for Isaac Gym

Hello, jeguzzi! Because the speed of Gazebo simulation is too slow, I'm working to transfer the robomaster model to Issac Gym environment, which uses ROS plugin to export URDF from XACRO files that this repo provides. But something went wrong when I imported URDF to it. I wonder if you can provide the corresponding raw URDF file or you have already deployed robomaster in Isaac Gym? Thank you!

Cannot interact with robomaster

after running the command: ros2 launch robomaster_ros ep.launch name:=RM0 serial_number:=159CG9T1050FCM
but no node found by command in other terminator: ros2 node list
nor rqt...
Can someone help me please?
ROS2 version: humble

log information:
ros2 launch robomaster_ros ep.launch name:=RM0 serial_number:=159CG9T1050FCM
[INFO] [launch]: All log files can be found below /home/orin/.ros/log/2023-09-02-22-50-04-007892-ubuntu-293672
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robomaster_driver-1]: process started with pid [293686]
[INFO] [robot_state_publisher-2]: process started with pid [293688]
[INFO] [joint_state_publisher-3]: process started with pid [293690]
[robomaster_driver-1] [INFO] [1693666207.453671432] [RM0.robomaster]: Waiting for a robot
[robomaster_driver-1] [INFO] [1693666207.508756968] [RM0.robomaster]: Found a robot
[robomaster_driver-1] [INFO] [1693666207.509638120] [RM0.robomaster]: Try to connect via sta to robot with sn 159CG9T1050FCM
[robomaster_driver-1] [INFO] [1693666208.159753256] [RM0.robomaster]: Connected
[robomaster_driver-1] [INFO] [1693666208.200431272] [RM0.robomaster]: [Arm] left servo: index 0, direction 1, value 1024, angle 0.073304
[robomaster_driver-1] [INFO] [1693666208.203435208] [RM0.robomaster]: [Arm] right servo: index 1, direction -1, value 1024, angle -0.274016
[robomaster_driver-1] [INFO] [1693666208.245256616] [RM0.robomaster]: [Arm] Callback group <rclpy.callback_groups.MutuallyExclusiveCallbackGroup object at 0xffff3fdcedf0>
[robomaster_driver-1] [INFO] [1693666208.309605704] [RM0.robomaster]: [Camera] Start video stream with resolution 360p
[robomaster_driver-1] [INFO] [1693666208.464369832] [RM0.robomaster]: topic cmd_vel will control chassis twist
[robomaster_driver-1] [INFO] [1693666208.828274056] [RM0.robomaster]: Enabled modules: Arm, Battery, Camera, Chassis, Gripper, LED, Speaker

Can't compose Dockerfile during 'colcon build'

The error msg are as follows:

Step 12/12 : RUN mkdir -p /ros_ws/src     && cd /ros_ws     && git clone https://github.com/jeguzzi/robomaster_ros.git src/robomaster_ros     && source /ros_entrypoint.sh     && colcon build --install-base /opt/ros/humble --merge-install     && rm -r /ros_ws
 ---> Running in 5d2abbf093c0
Cloning into 'src/robomaster_ros'...
Starting >>> robomaster_msgs
Starting >>> robomaster_description
Finished <<< robomaster_description [0.62s]
--- stderr: robomaster_msgs
CMake Error at /opt/ros/humble/share/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake:59 (message):
  execute_process(/usr/bin/python3.10 -m rosidl_adapter --package-name
  robomaster_msgs --arguments-file
  /ros_ws/build/robomaster_msgs/rosidl_adapter__arguments__robomaster_msgs.json
  --output-dir /ros_ws/build/robomaster_msgs/rosidl_adapter/robomaster_msgs
  --output-file
  /ros_ws/build/robomaster_msgs/rosidl_adapter/robomaster_msgs.idls) returned
  error code 1:

  /usr/bin/python3.10: No module named rosidl_adapter

Call Stack (most recent call first):
  /opt/ros/humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:130 (rosidl_adapt_interfaces)
  CMakeLists.txt:39 (rosidl_generate_interfaces)


---
Failed   <<< robomaster_msgs [0.69s, exited with code 1]

Summary: 1 package finished [1.12s]
  1 package failed: robomaster_msgs
  1 package had stderr output: robomaster_msgs
  1 package not processed
ERROR: Service 'driver' failed to build: The command '/bin/bash -c mkdir -p /ros_ws/src     && cd /ros_ws     && git clone https://github.com/jeguzzi/robomaster_ros.git src/robomaster_ros     && source /ros_entrypoint.sh     && colcon build --install-base /opt/ros/humble --merge-install     && rm -r /ros_ws' returned a non-zero code: 1

It seems that /usr/bin/python3.10 can't find a module called rosidl_adapter.
So I have tried add a command in Dockerfile that install rosidl_adapter by RUN apt-get install ros-humble-rosidl-adapter. Then it says it's already installed, and shows this same error msg again.

namespace problem when launch multiple s1.launch

Hi Jerome, I have been learning and using ROS2 recently, and this repo is really helpful. It allows multiple control of robomaster, combined with ROS2 which makes coding much easier, thanks a lot!
When I use it to control three S1, the namespace become strange. I simply set each serial number and their respective name to RM4, RM5, RM6. But the namespace become:

/RM4
/RM4/RM5
/RM4/RM5/RM6

Which is strange, because when I do the same thing to three EP, the namespace is normal:

/RM1
/RM2
/RM3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.