ROS2(humble) install based on YouTube video in Ubuntu 22.04.4

Hello, I’m attempting to run ROS2 (humble) on Ubuntu 22.04.4 LTS using ‘RM-X52-TNM’ and ‘OpenCR’. Currently, I’ve verified the robot’s operation using examples with Arduino 2.3.2, Processing 4.3, and Python 3.10.12 (modified bps to 1000000 in read_write.py using Visual Studio Code). For your reference, all necessary tasks on Arduino have been completed correctly (such as usb_to_dxl, etc.).

After that, I’m trying to install ROS2 following ROBOTIS’ YouTube video (https://www.youtube.com/watch?v=E8XPqDjof4U).

However, when I enter the following command, an error occurs:
Command entered: ros2 run dynamixel_sdk_examples read_write_node
Error:
[PortHandlerLinux::SetupPort] Error opening serial port!
[ERROR] [1710776383.663677600] [read_write_node]: Failed to open the port!
[ros2run]: Process exited with failure 255

Just in case, I also tried adding sudo in front of the command, but then I encountered the following error:
sudo: ros2: command not found

As another hypothesis, I tried changing ls /dev/tty* to ls /dev/tty0 as described in the YouTube video’s commands, but the same 3-line error occurred. (I input 0 because /dev/tty0 was a valid port when operated from Arduino and Python3.)

Is there anyone with experience in resolving this issue or who can provide assistance? Thank you.

It sounds like your user account doesn’t have access to write to the serial port. Adding your linux login to the “dialout” user group with the command

sudo usermod -aG dialout YOURLINUXUSERNAME

and logging out and back in should allow you to open the serial port.

“logging out” you said is logout linux account right?

I have tried this way, But, I can’t fix this problem.

(Surely, I used “sudo usermod -aG dialout MYNAME”)

manipulatorx@manipulatorx-System-Product-Name:~$ source /opt/ros/humble/setup.bash
manipulatorx@manipulatorx-System-Product-Name:~$ cd ~/robotis_ws
manipulatorx@manipulatorx-System-Product-Name:~/robotis_ws$ . install/local_setup.bash
manipulatorx@manipulatorx-System-Product-Name:~/robotis_ws$ ls /dev/tty*
/dev/tty /dev/tty23 /dev/tty39 /dev/tty54 /dev/ttyS1 /dev/ttyS25
/dev/tty0 /dev/tty24 /dev/tty4 /dev/tty55 /dev/ttyS10 /dev/ttyS26
/dev/tty1 /dev/tty25 /dev/tty40 /dev/tty56 /dev/ttyS11 /dev/ttyS27
/dev/tty10 /dev/tty26 /dev/tty41 /dev/tty57 /dev/ttyS12 /dev/ttyS28
/dev/tty11 /dev/tty27 /dev/tty42 /dev/tty58 /dev/ttyS13 /dev/ttyS29
/dev/tty12 /dev/tty28 /dev/tty43 /dev/tty59 /dev/ttyS14 /dev/ttyS3
/dev/tty13 /dev/tty29 /dev/tty44 /dev/tty6 /dev/ttyS15 /dev/ttyS30
/dev/tty14 /dev/tty3 /dev/tty45 /dev/tty60 /dev/ttyS16 /dev/ttyS31
/dev/tty15 /dev/tty30 /dev/tty46 /dev/tty61 /dev/ttyS17 /dev/ttyS4
/dev/tty16 /dev/tty31 /dev/tty47 /dev/tty62 /dev/ttyS18 /dev/ttyS5
/dev/tty17 /dev/tty32 /dev/tty48 /dev/tty63 /dev/ttyS19 /dev/ttyS6
/dev/tty18 /dev/tty33 /dev/tty49 /dev/tty7 /dev/ttyS2 /dev/ttyS7
/dev/tty19 /dev/tty34 /dev/tty5 /dev/tty8 /dev/ttyS20 /dev/ttyS8
/dev/tty2 /dev/tty35 /dev/tty50 /dev/tty9 /dev/ttyS21 /dev/ttyS9
/dev/tty20 /dev/tty36 /dev/tty51 /dev/ttyACM0 /dev/ttyS22
/dev/tty21 /dev/tty37 /dev/tty52 /dev/ttyprintk /dev/ttyS23
/dev/tty22 /dev/tty38 /dev/tty53 /dev/ttyS0 /dev/ttyS24
manipulatorx@manipulatorx-System-Product-Name:~/robotis_ws$ sudo usermod -aG dialout manipulatorx
[sudo] password for manipulatorx:
manipulatorx@manipulatorx-System-Product-Name:~/robotis_ws$ ros2 run dynamixel_sdk_examples read_write_node
[PortHandlerLinux::SetupPort] Error opening serial port!
[ERROR] [1710812914.546940953] [read_write_node]: Failed to open the port!
[ros2run]: Process exited with failure 255
manipulatorx@manipulatorx-System-Product-Name:~/robotis_ws$

I opened the file named “read_write_node” located at ~/robotis_ws/install/dynamixel_sdk_examples/lib/dynamixel_sdk_examples/ without an extension.

This file appeared to be in hexadecimal format. Upon inspection in Visual Studio Code, it was written to recognize the USB port as ttyUSB0. However, my USB port is ttyACM0, so I made some modifications to the file by changing A, C, and M to their hexadecimal equivalents to resolve the issue.