Hi! I am trying to write a ROS2 node to publish IMU messages using master board SDK. I am currently stuck with an user permission issue. To access the ethernet port sudo permission is needed , however it also changes the environment variables is such a way that, executable is not able to find ros related libraries. is there a way to access the port without using sudo ?
You can change the capabilities of your executable to have access to raw sockets like this
sudo setcap cap_net_admin,cap_net_raw+ep <your_executeable>
However, note that this comes with some downsides. Once you change the capabilities, your LD_LIBRARY_PATH is set to zero for security reason. This restricts what your executeable can use.
Another option is to start a session as root and source sudo again (that’s what I am doing):
sudo -s # Note the `-s`
source /opt/ros/dashing/setup.bash # Or whatever distro you are using
# Then run your executeable here
./your_executeable
Hi ! jviereck .
I tried both the approaches . But the environment path changes and thus not able to access any of the ros library files.
Yours Sincerely,
S.Shyam
The easiest you can do is running as root user:
- compile your code as
$USER
(yourself) - spawn a terminal and change user to root:
sudo su
- source the different ros workspace:
source /opt/ros/dashing/setup.bash
source ~/user_workspace/instal/seutp.bash
- run the node:
ros2 run package_name node_name
Let us know if you still have trouble.
ps: if you tried the option above know that using setcap
cancel the use of the LD_LIBRARY_PATH by the binary hence it won’t see ANY dependencies. You can just delete the binary and recompile it. Or look at how to cancel the setcap
For book keeping here is the solution:
@siva_uchiha can you share more information about your use of ROS2 in the context of ODRI?
AFAIK currently there already is a ROS2 package for Bolt, but not for SOLO (12).
(Cf. General Issues Solo12 - Calibration & Driver Errors and GitHub - stack-of-tasks/ros2_control_bolt)
Dear @andreasBihlmaier
We splitted the hardware support for ODRI from BOLT:
stack-of-tasks / ros2_hardware_interface_odri
I juste created a new repository for SOLO here:
stack-of-tasks / ros2_control_solo
The work to be done is:
1/ Make sure that the new URDF file is using ros2_hardware_interface_odri
2/ Make some tests on the real hardware with standard ros2_controller
3/ Split the gazebo plugin from ros2_control_bolt to use it with both ros2_control_solo and ros2_control_bolt
Any feedback welcome.
Hi, I am trying to get root permission of ros2 node and found that the root node cannot communicate with non-root node, but I found there is root(control-node) and non-root node(rviz) mixed in the launch file.
Did you notice that issue that non-root node cannot pub/sub with root node?
Thanks.
@ZhenshengLee the root cause of your problem is likely related to a quirk of DDS on localhost (see here for some background information). The workaround is to add a custom DDS config for root:
<?xml version="1.0" encoding="UTF-8" ?>
<!-- export FASTRTPS_DEFAULT_PROFILES_FILE=$HOME/fastdds_root_workaround.xml -->
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles" >
<transport_descriptors>
<transport_descriptor>
<transport_id>CustomUdpTransport</transport_id>
<type>UDPv4</type>
</transport_descriptor>
</transport_descriptors>
<participant profile_name="participant_profile" is_default_profile="true">
<rtps>
<userTransports>
<transport_id>CustomUdpTransport</transport_id>
</userTransports>
<useBuiltinTransports>false</useBuiltinTransports>
</rtps>
</participant>
</profiles>
Before running the ODRI node as root, run export FASTRTPS_DEFAULT_PROFILES_FILE=$HOME/fastdds_root_workaround.xml
(assuming you have placed the content above in a file at $HOME/fastdds_root_workaround.xml
).
Then non-root ROS 2 nodes should be able to communicate with those run as root.