DFKI-NI / mir_robot

ROS support for the MiR Robots. This is a community project to use the MiR Robots with ROS. It is not affiliated with Mobile Industrial Robots.
BSD 3-Clause "New" or "Revised" License
239 stars 157 forks source link

MIR bridge in ROS, topic mir_msgs does not work. #139

Open MDario97 opened 3 months ago

MDario97 commented 3 months ago

Good morning, i am controlling a MIR100 with ROS Noetic 20.04 installed in a virtual box (Oracle). when i launch the mir.launch file i can see all the topics created by it, and i see a strange thing: a lot of topics have as message type 'mirMsgs', all of these topics are not available for me and i can't even visualize them with the echo funcion, so i went into the CMakeLists.txt, package.xml and mir_bridge.py files in the mir_driver folder and i noticed that mirMsgs is never present, but instead there is the message type 'mir_msgs' that is assigned as message type of all the topics that in the terminal of the mir_bridge have 'mirMsgs' as message type. i will post some photos: One of the Topics created after launching 'roslaunch mir_bridge mir.launch' on terminal: terminal Contents of mir_bridge.py file in mir_driver/nodes folder: mi_bridge_py Contents of CMakeLists.txt file in mir_driver folder: cmakelist Contents of package.xml file in mir_driver folder: package How could i change the message type that i see in the Terminal? Thank you

mintar commented 3 months ago

On the internal ROS system inside the MiR platform, there is a package called mirMsgs. In order to publish these messages to the external ROS system, I had to recreate that package and copy the message definitions. The name mirMsgs does not follow the naming conventions, which generates a warning in ROS1 and is even impossible in ROS2. Therefore, I've called the "external" ROS package that I created mir_msgs.

The difference in naming is not a problem. If there were a difference in the actual contents of the messages, you would get an error.

Echoing the robot_mode and robot_state topics works for me:

$ rostopic echo /robot_mode
robotMode: 7
robotModeString: "Mission"
---

$ rostopic echo /robot_state
robotState: 4
robotStateString: "Pause"
---

This is on MiR software version 2.8.3.1. It is possible that they've changed these topics again in a later software version.

MDario97 commented 3 months ago

If i try to echo those commands i get the error: ERROR: Cannot load message class for [mir_msgs/Robot...]. Are your messages built?

mintar commented 3 months ago

That means you didn't install the mir_msgs package, or installed from source but didn't compile it / didn't source the proper setup.bash. How did you install the mir_robot package? The easiest way is sudo apt install ros-noetic-mir-robot. That should automatically install mir_msgs as well.

MDario97 commented 3 months ago

These are my exact passages to install the MIR package: (already installed ROS Noetic 20.04) 1)mkdir -p ~/catkinMIR_ws/src 2)cd ~/catkinMIR_ws/src/ 3)git clone -b noetic https://github.com/DFKI-NI/mir_robot.git 4)sudo apt-get update -qq 5)sudo apt-get install -qq -y python3-rosdep 6)sudo rosdep init 7)rosdep update 8)rosdep install --from-paths ./ -i -y --rosdistro noetic 9)source /opt/ros/noetic/setup.bash 10)catkin_init_workspace 11)cd ~/catkinMIR_ws 12)catkin_make -DCMAKE_BUILD_TYPE=RelWithDebugInfo 13)source ~/catkinMIR_ws/devel/setup.bash 14)echo "source ~/catkinMIR_ws/devel/setup.bash" >> ~/.bashrc 15)source ~/.bashrc

EDIT: i tried with the binary installation on another VM and it works

mintar commented 3 months ago

Glad that it works! Your installation steps from source also look correct, that should also have worked...

MDario97 commented 3 months ago

Good morning, In these days i am moving the MIR100 with matlab, publishing and subscribing topics, and i noticed that this particular message type ('mirMsgs/...) gives problems also in Matlab/Simulink (even with the new installation, if i see those topics in ROS i don't have problems anymore), in fact when i connect to the MIR/ROS master (i have the same problem), and the i digit 'rosmsg list' in matlab, i don't have the messages mirMssgs or mir_msgs in the available ones. In the next screens i am connected to the MIR master using 'rosinit(http://....:11311): mir_topic_matlab As we can see the topic is present and the message type is the correct one, but then if i try to read the message types available: mir_msg_matlab I don't get how it is possible, and the problem is the same even if i connect to the ROS master instead of the MIR master.

EDIT: Matlab is installed in the VM as ROS, so all the system is in the VM.

mintar commented 3 months ago

Yes, if you connect to the MiR ROS master directly, then you will need the package mirMsgs from the MiR platform. I would recommend using this repository here with the mir_bridge instead.