Answer
stringlengths 44
28.2k
⌀ | Id
stringlengths 1
6
| CreationDate
stringlengths 23
23
| Tags
stringlengths 4
94
| Body
stringlengths 54
35.7k
| Title
stringlengths 13
150
|
---|---|---|---|---|---|
<p>Acc'd to your output:</p>
<pre><code>dpkg: error processing archive /var/cache/apt/archives/ros-noetic-behaviortree-c
pp-v3_3.8.5-1focal.20230814.151459_amd64.deb (--unpack):
trying to overwrite '/opt/ros/noetic/bin/bt3_log_cat', which is also in package
ros-noetic-behaviortree-cpp 4.4.2-1focal.20231128.201059
</code></pre>
<p>Internally, the <code>dpkg</code> command is called on the archived file path <code>/var/cache/apt/archives/ros-noetic-behaviortree-c pp-v3_3.8.5-1focal.20230814.151459_amd64.deb</code>. It has an error because it's unable to overwrite <code>/opt/ros/noetic/bin/bt3_log_cat</code> as you install the ros-noetic packages.</p>
<p>It seems that you have a conflicting existing package, i.e. ros-noetic-behaviortree-cpp, and that needs to be purged prior to installing the new packages. Based on your command to install all other packages, my best guess is that it's an older package, hence the conflict.</p>
<p>See <a href="https://manpages.ubuntu.com/manpages/noble/en/man1/dpkg.1.html" rel="nofollow noreferrer">man dpkg</a></p>
<p>Try the following:</p>
<pre><code># Remove the existing package, -P or --purge
sudo dpkg -P ros-noetic-behaviortree-cpp
</code></pre>
<p>Another way to fix this (not recommend), is to simply force the overwrite when installing with <code>dpkg</code>.</p>
<pre><code># Force overwrite
sudo dpkg -i --force-overwrite /var/cache/apt/archives/ros-noetic-behaviortree-c
pp-v3_3.8.5-1focal.20230814.151459_amd64.deb
</code></pre>
<p>In either case, follow up with <code>sudo apt -f install</code> to fix broken pipes (as your output mentions in the following line for <code>dpkg-deb</code>). Then try running your command again.</p>
<pre><code># Fix broken pipes
sudo apt -f install
# Your command
sudo apt install ros-noetic-behaviortree-cpp*
</code></pre>
<p>Hope this helps.</p>
|
107246
|
2023-12-26T11:34:18.390
|
|ros|ros-noetic|apt|
|
<p>I tried to install behaviortree using <code>sudo apt install ros-noetic-behaviortree-cpp*</code> and got the following error while the system installing it:</p>
<pre><code>Preparing to unpack .../ros-noetic-behaviortree-cpp-v3_3.8.5-1focal.20230814.151
459_amd64.deb ...
Unpacking ros-noetic-behaviortree-cpp-v3 (3.8.5-1focal.20230814.151459) ...
dpkg: error processing archive /var/cache/apt/archives/ros-noetic-behaviortree-c
pp-v3_3.8.5-1focal.20230814.151459_amd64.deb (--unpack):
trying to overwrite '/opt/ros/noetic/bin/bt3_log_cat', which is also in package
ros-noetic-behaviortree-cpp 4.4.2-1focal.20231128.201059
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/ros-noetic-behaviortree-cpp-v3_3.8.5-1focal.20230814.15
1459_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
</code></pre>
<p>I tried multiple ways to install it but was unsuccessful.</p>
|
behaviortree-cpp not installing using apt
|
<p>The current version of <a href="https://packages.ubuntu.com/it/jammy/libopencv-dev" rel="nofollow noreferrer">libopencv-dev in Ubuntu Jammy is 4.5.4</a>. To find the related commit in the <code>opencv</code> GitHub project, you've to check the <a href="https://github.com/opencv/opencv/releases" rel="nofollow noreferrer">tags (or releases page on GitHub)</a>. There you'll notice the <a href="https://github.com/opencv/opencv/tree/4.5.4" rel="nofollow noreferrer">4.5.4 tag</a> which is created from <a href="https://github.com/opencv/opencv/commit/4223495e6cd67011f86b8ecd9be1fa105018f3b1" rel="nofollow noreferrer">commit 4223495</a>.<br />
This is the source code that is used by the Ubuntu maintainers to create the apt-package (OpenCV even provides a <a href="https://github.com/opencv/opencv/blob/4.x/cmake/OpenCVPackaging.cmake" rel="nofollow noreferrer">OpenCVPackaging.cmake</a> file).</p>
|
107248
|
2023-12-26T14:37:28.433
|
|opencv|library|
|
<p>I want to find this github address.</p>
<p>(I can<code>t find it,because main opencv</code>s github has opencv/opencv -b 4,3,2,1)</p>
<p>Thank you.</p>
|
ros2- where is the data libopencv-dev
|
<p>Lifelng mapping in SLAM Toolbox is in the experimental namespace and documented as an experimental-only feature. There are definitely gaps in it.</p>
|
107249
|
2023-12-26T14:54:57.237
|
|ros|ros-melodic|slam|
|
<p>I have this parameters to run slamtoolbox in lifelong mapping , map is creating worse ( will give the pic below)
here is the params:</p>
<pre><code># Plugin params
solver_plugin: solver_plugins::CeresSolver
ceres_linear_solver: SPARSE_NORMAL_CHOLESKY
ceres_preconditioner: SCHUR_JACOBI
ceres_trust_strategy: LEVENBERG_MARQUARDT
ceres_dogleg_type: TRADITIONAL_DOGLEG
ceres_loss_function: None
# ROS Parameters
odom_frame: odom
map_frame: map
base_frame: base_footprint
scan_topic: /scan_multi
mode: mapping
# lifelong params
lifelong_search_use_tree: true
lifelong_minimum_score: 0.1
lifelong_iou_match: 0.85
lifelong_node_removal_score: 0.04
lifelong_overlap_score_scale: 0.06
lifelong_constraint_multiplier: 0.08
lifelong_nearby_penalty: 0.001
lifelong_candidates_scale: 0.03
# if you'd like to immediately start continuing a map at a given pose
# or at the dock, but they are mutually exclusive, if pose is given
# will use pose
#map_file_name: lifelong_22.12
#map_start_pose: [-8.04, 14.20, 0.81]
#map_start_pose: [-17.657 7.370 0.323]
#map_start_at_dock: true
debug_logging: false
throttle_scans: 1
transform_publish_period: 0.05 #if 0 never publishes odometry
map_update_interval: 5.0
resolution: 0.05
max_laser_range: 20.0 #for rastering images
minimum_time_interval: 0.5
transform_timeout: 0.2
tf_buffer_duration: 10.
stack_size_to_use: 40000000 #// program needs a larger stack size to serialize large maps
# General Parameters
use_scan_matching: true
use_scan_barycenter: true
minimum_travel_distance: 0.2
minimum_travel_heading: 0.2
scan_buffer_size: 50
scan_buffer_maximum_scan_distance: 20
link_match_minimum_response_fine: 0.3
link_scan_maximum_distance: 10
do_loop_closing: true
loop_match_minimum_chain_size: 10
loop_match_maximum_variance_coarse: 2.0
loop_match_minimum_response_coarse: 0.45
loop_match_minimum_response_fine: 0.35
# Correlation Parameters - Correlation Parameters
correlation_search_space_dimension: 0.3
correlation_search_space_resolution: 0.01
correlation_search_space_smear_deviation: 0.03
# Correlation Parameters - Loop Closure Parameters
loop_search_space_dimension: 8.0
loop_search_space_resolution: 0.05
loop_search_space_smear_deviation: 0.05
loop_search_maximum_distance: 4.0
# Scan Matcher Parameters
distance_variance_penalty: 0.35
angle_variance_penalty: 1.0
fine_search_angle_offset: 0.00349
coarse_search_angle_offset: 0.349
coarse_angle_resolution: 0.0349
minimum_angle_penalty: 0.9
minimum_distance_penalty: 0.5
use_response_expansion: false
</code></pre>
<p>pic:
<a href="https://i.stack.imgur.com/3b7iW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3b7iW.jpg" alt="enter image description here" /></a></p>
|
Lifelong mappping in slamtoolbox
|
<p>You are trying to override the <code>robot_namespace</code> in the xacro file. For your scenario, you need to set the xacro <strong>property</strong> using a xacro argument (<strong>arg</strong>).</p>
<ul>
<li><strong>Modify your xacro file:</strong> Adding an arg means we enable the file to accept command line arguments. Let's make an arg for the <code>robot_namespace</code>.</li>
</ul>
<pre><code><?xml version="1.0"?>
<robot name="turtlebot3_waffle_pi_sim" xmlns:xacro="http://ros.org/wiki/xacro">
<!-- New arg to add with the same default -->
<xacro:arg name="robot_namespace" default="robot1"/>
<xacro:property name="robot_namespace" value="$(arg robot_namespace)"/>
<plugin name="turtlebot3_waffle_pi_controller" filename="libgazebo_ros_diff_drive.so">
<odometryTopic><span class="math-container">${robot_namespace}/odom</odometryTopic>
<odometryFrame>$</span>{robot_namespace}/odom</odometryFrame>
</plugin>
</robot>
</code></pre>
<ul>
<li><strong>Test with the same command in the question:</strong></li>
</ul>
<pre><code>xacro pathOfXacroFile robot_namespace:=robot2
</code></pre>
<p>This will print the xacro file content with the required change. Hope this helps!</p>
|
107289
|
2023-12-28T12:42:05.933
|
|ros-noetic|xacro|
|
<p>thisis my example xacro file and I need to change robot_namespace property's value</p>
<pre><code><?xml version="1.0"?>
<robot name="turtlebot3_waffle_pi_sim" xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:property name="robot_namespace" value="robot1"/>
<plugin name="turtlebot3_waffle_pi_controller" filename="libgazebo_ros_diff_drive.so">
<odometryTopic><span class="math-container">${robot_namespace}/odom</odometryTopic>
<odometryFrame>$</span>{robot_namespace}/odom</odometryFrame>
</plugin>
</robot>
</code></pre>
<p>I am trying to format this file with <strong>xacro pathOfXacroFile robot_namespace:=robot2</strong>
but in the output it shows always the default value not the formatted one</p>
|
xacro formatting xacro file property with given param
|
<p>after fiddling around for weeks I have found the solution to my problem!</p>
<p>The problem is not due to the holding position error but that I used velocity as a control interface which does not work in the aforementioned setup.
It worked when i changed it to:</p>
<pre><code>ur_joint_trajectory_controller:
ros__parameters:
joints:
- UR_shoulder_pan_joint
- UR_shoulder_lift_joint
- UR_elbow_joint
- UR_wrist_1_joint
- UR_wrist_2_joint
- UR_wrist_3_joint
command_interfaces:
- velocity
state_interfaces:
- position
- velocity
state_publish_rate: 100.0
action_monitor_rate: 20.0
open_loop_control: true
</code></pre>
|
107295
|
2023-12-28T17:24:03.190
|
|ros2|ros2-control|joint-trajectory-controller|ros2-controllers|
|
<p>first of all merry Christmas to whoever is celebrating!</p>
<p>I am working on adding a 7th prismatic axis to the UR10e robot and implementing a kinematic chain to synchronously control the robot.
The hardware interfaces are working perfectly so far. Using each kinematic chain by itself (axis or robot) is no problem with the joint trajectory controller as well as all other controllers.</p>
<p>However when using the joint trajectory controller with the combined kinematic chain, i seem to get nothing but errors.</p>
<p>The current list of joints are</p>
<ul>
<li>axis_joint1</li>
<li>UR_shoulder_pan_joint</li>
<li>UR_shoulder_lift_joint</li>
<li>UR_elbow_joint</li>
<li>UR_wrist_1_joint</li>
<li>UR_wrist_2_joint</li>
<li>UR_wrist_3_joint</li>
</ul>
<p>When using a joint trajectory controller which tries to move all joints at once such as</p>
<pre><code>joint_trajectory_controller:
ros__parameters:
joints:
- axis_joint1
- UR_shoulder_pan_joint
- UR_shoulder_lift_joint
- UR_elbow_joint
- UR_wrist_1_joint
- UR_wrist_2_joint
- UR_wrist_3_joint
command_interfaces:
- velocity
state_interfaces:
- position
- velocity
state_publish_rate: 100.0
action_monitor_rate: 20.0
allow_partial_joints_goal: true
</code></pre>
<p>i receive this error:</p>
<pre><code>[ur_ros2_control_node-1] [ERROR] [1703780467.945419329] [axis_joint_trajectory_controller]: Holding position due to state tolerance violation
</code></pre>
<p>which comes from this file: <a href="https://github.com/ros-controls/ros2_controllers/blob/humble/joint_trajectory_controller/src/joint_trajectory_controller.cpp" rel="nofollow noreferrer">https://github.com/ros-controls/ros2_controllers/blob/humble/joint_trajectory_controller/src/joint_trajectory_controller.cpp</a>
(Line 401, caused by Line 263)
which is checking for a state tolerance? I guess this is either the goal or trajectory tolerance of the joint? There is not much documentation on that. I'm also not sure which state it is violating when it doesn't even have a position it <strong>should</strong> be in.</p>
<p>The same error occurs when i try sending commands to the axis only using this controller setup:</p>
<pre><code>axis_joint_trajectory_controller:
ros__parameters:
joints:
- axis_joint1
command_interfaces:
- velocity
state_interfaces:
- position
- velocity
state_publish_rate: 100.0
action_monitor_rate: 20.0
allow_partial_joints_goal: true
constraints:
stopped_velocity_tolerance: 0.2
goal_time: 0.0
axis_joint1: { trajectory: 0.2, goal: 0.1 }
</code></pre>
<p>and these goals</p>
<pre><code>publisher_joint_trajectory_controller:
ros__parameters:
controller_name: "axis_joint_trajectory_controller"
wait_sec_between_publish: 5
goal_names: ["pos1", "pos2", "pos3", "pos4"]
pos1: [0.6]
pos2: [0.2]
pos3: [0.5]
pos4: [0.4]
joints:
- axis_joint1
check_starting_point: false
starting_point_limits:
axis_joint1: [-2.0,2.0]
</code></pre>
<p>The other thing is, when trying to move the UR Robot joints alone (while the axis is still in the urdf kinematic chain), i get an error in the sanity check of the publisher .
Using this setup</p>
<pre><code>ur_joint_trajectory_controller:
ros__parameters:
joints:
- UR_shoulder_pan_joint
- UR_shoulder_lift_joint
- UR_elbow_joint
- UR_wrist_1_joint
- UR_wrist_2_joint
- UR_wrist_3_joint
command_interfaces:
- velocity
state_interfaces:
- position
- velocity
state_publish_rate: 100.0
action_monitor_rate: 20.0
allow_partial_joints_goal: true
constraints:
stopped_velocity_tolerance: 0.2
goal_time: 0.0
UR_shoulder_pan_joint: { trajectory: 0.2, goal: 0.1 }
UR_shoulder_lift_joint: { trajectory: 0.2, goal: 0.1 }
UR_elbow_joint: { trajectory: 0.2, goal: 0.1 }
UR_wrist_1_joint: { trajectory: 0.2, goal: 0.1 }
UR_wrist_2_joint: { trajectory: 0.2, goal: 0.1 }
UR_wrist_3_joint: { trajectory: 0.2, goal: 0.1 }
</code></pre>
<p>and this trajectory yaml file</p>
<pre><code>publisher_urjoint_trajectory_controller:
ros__parameters:
controller_name: "ur_joint_trajectory_controller"
wait_sec_between_publish: 6
goal_names: ["pos1", "pos2", "pos3", "pos4"]
pos1:
positions: [0.785, -1.57, 0.785, 0.785, 0.785, 0.785]
pos2:
positions: [0.0, -1.57, 0.0, 0.0, 0.0, 0.0]
pos3:
positions: [0.0, -1.57, 0.0, 0.0, -0.785, 0.0]
pos4:
positions: [0.0, -1.57, 0.0, 0.0, 0.0, 0.0]
joints:
- UR_shoulder_pan_joint
- UR_shoulder_lift_joint
- UR_elbow_joint
- UR_wrist_1_joint
- UR_wrist_2_joint
- UR_wrist_3_joint
check_starting_point: true
starting_point_limits:
UR_shoulder_pan_joint: [-3.0,3.1]
UR_shoulder_lift_joint: [-3.6,3.5]
UR_elbow_joint: [-3.6,3.6]
UR_wrist_1_joint: [-3.6,3.5]
UR_wrist_2_joint: [-3.6,3.6]
UR_wrist_3_joint: [-3.1,3.61]
</code></pre>
<p>I receive this error:</p>
<pre><code>[publisher_joint_trajectory_controller-1] if (msg.position[idx] < self.starting_point[enum][0]) or (
[publisher_joint_trajectory_controller-1] KeyError: 'axis_joint1'
</code></pre>
<p>which comes from this file <a href="https://github.com/ros-controls/ros2_controllers/blob/master/ros2_controllers_test_nodes/ros2_controllers_test_nodes/publisher_joint_trajectory_controller.py" rel="nofollow noreferrer">https://github.com/ros-controls/ros2_controllers/blob/master/ros2_controllers_test_nodes/ros2_controllers_test_nodes/publisher_joint_trajectory_controller.py</a>, (line 168)
This means that somehow it is checking for "axis_joint1", which is within the kinematic chain but neither in the sent trajectory nor in the controller, meaning for some inexplicable reason it is checking against the joint states or the defined urdf (which it should NOT do since the only relevant joints that should be checked are the ones defined in the controller)</p>
<p>It seems the error is within the <code>joint_trajectory_controller</code>, because when i use the <code>forward_velocity_controller</code> everything works as intended and when I load a robot with EITHER the kinematic chain of the Robot alone OR the axis alone, the joint trajectory controller works without problem.</p>
<p>I hope this was not too confusing and I really hope someone has some ideas, this has cost me many restless nights.</p>
|
Joint Trajectory Controller not working with multiple hardware interfaces
|
<p><a href="https://control.ros.org/master/doc/ros2_controllers/ackermann_steering_controller/doc/userdoc.html" rel="nofollow noreferrer">ackermann_steering_controller</a> is what you are looking for. Have a look at <a href="https://github.com/ros-controls/ros2_control_demos/pull/316" rel="nofollow noreferrer">this PR here</a>.</p>
<p>However, we have some issues with the controller, see e.g. <a href="https://github.com/ros-controls/ros2_controllers/issues/878" rel="nofollow noreferrer">here</a>. Please report a new issue if it doesn't work as expected.</p>
|
107303
|
2023-12-29T10:18:19.693
|
|ros2|control|autonomous-car|ros2-control|gazebo-ros2-control|
|
<p>I want to implement a 4 wheel robot with car like steering(having 2 front steerable wheels and 2 back drive wheels) in ros2 using ros2_control. Can you suggest me which ros2 controller should I use(with example)? Is there any example I could refer to? The ros2_control documentation is not detailed enough and their example are mostly differential drive based.</p>
<p>Edit:</p>
<p>Distro: <code>ros2-humble</code></p>
<h1>Directory Structure</h1>
<pre><code>race_it_ws
/src
/race_it
/description
/race_car.xacro
/ros2_ack.xacro
/inertial.xacro
/config
/controller
/my_controllers.yaml
/launch
/rsp.launch.py
/hardware ## NOTE: I have just copied this folder from "ros2_control_demos/example_11" AS IT IS.
</code></pre>
<p>Complete source code is provided below.</p>
<h1>Description</h1>
<h2>race_car.xacro(main urdf file)</h2>
<pre><code><?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="simple_car">
<xacro:include filename="inertial.xacro"/>
<!-- <xacro:include filename="gazebo_control_dd.xacro"/> -->
<!-- <xacro:include filename="gazebo_control_steer.xacro"/> -->
<xacro:property name="wheel_width" value="0.04"/>
<xacro:property name="wheel_radius" value="0.1"/>
<!-- Wheel macro -->
<xacro:macro name="wheel" params="name">
<link name="<span class="math-container">${name}">
<visual>
<geometry>
<cylinder length="$</span>{wheel_width}" radius="<span class="math-container">${wheel_radius}" />
</geometry>
<material name="blue"/>
</visual>
<collision>
<geometry>
<cylinder length="$</span>{wheel_width}" radius="<span class="math-container">${wheel_radius}" />
</geometry>
</collision>
<xacro:inertial_cylinder mass="0.1" length="$</span>{wheel_width}" radius="${wheel_radius}"/>
</link>
<gazebo reference="${name}">
<material>Gazebo/Blue</material>
</gazebo>
</xacro:macro>
<!-- Base Link -->
<link name="base_link">
</link>
<!-- Chassis Link -->
<link name="chassis_link">
<visual>
<geometry>
<box size="0.5 1.0 0.2"/>
</geometry>
<origin xyz="0 0 0" rpy="0 0 0"/>
<material name="blue">
<color rgba="0 0 1 1"/>
</material>
</visual>
<xacro:inertial_box mass="0.5" x="0.5" y="1.0" z="0.15"/>
</link>
<gazebo reference="chassis_link">
<material>Gazebo/Orange</material>
</gazebo>
<!-- Base Chassis Joint -->
<joint name="base_chassis_joint" type="fixed">
<parent link="base_link"/>
<child link="chassis_link"/>
<origin xyz="0 0 0.2" rpy="0 0 0 "/>
</joint>
<!-- Front Left Wheel -->
<xacro:wheel name="front_left_link"/>
<joint name="front_left_joint" type="continuous">
<parent link="chassis_link"/>
<child link="front_left_link"/>
<origin xyz="-0.3 0.5 -0.1" rpy="0 ${pi/2} 0"/>
<axis xyz="0 0 1"/>
</joint>
<gazebo reference="front_left_link">
<material>Gazebo/Red</material>
<mu1 value="0.001"/>
<mu2 value="0.001"/>
</gazebo>
<!-- Front Right Wheel -->
<xacro:wheel name="front_right_link"/>
<joint name="front_right_joint" type="continuous">
<parent link="chassis_link"/>
<child link="front_right_link"/>
<origin xyz="0.3 0.5 -0.1" rpy="0 ${pi/2} 0"/>
<axis xyz="0 0 1"/>
</joint>
<gazebo reference="front_right_link">
<material>Gazebo/Red</material>
<mu1 value="0.001"/>
<mu2 value="0.001"/>
</gazebo>
<!-- Rear Left Wheel -->
<xacro:wheel name="rear_left_link"/>
<joint name="rear_left_joint" type="continuous">
<parent link="chassis_link"/>
<child link="rear_left_link"/>
<origin xyz="-0.3 -0.5 -0.1" rpy="0 ${pi/2} 0"/>
<axis xyz="0 0 1"/>
</joint>
<!-- Rear Right Wheel -->
<xacro:wheel name="rear_right_link" />
<joint name="rear_right_joint" type="continuous">
<parent link="chassis_link"/>
<child link="rear_right_link"/>
<origin xyz="0.3 -0.5 -0.1" rpy="0 ${pi/2} 0"/> <!-- Default value for x is "0.27" -->
<axis xyz="0 0 1"/>
</joint>
<xacro:include filename="ros2_ack.xacro"/>
</robot>
</code></pre>
<h2>ros2_ack.xacro</h2>
<pre><code><?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="simple_car">
<ros2_control name="carbot" type="system">
<hardware>
<!-- <plugin>gazebo_ros2_control/GazeboSystem</plugin> -->
<plugin>ros2_control_demo_example_11/CarlikeBotSystemHardware</plugin>
<param name="example_param_hw_start_duration_sec">0</param>
<param name="example_param_hw_stop_duration_sec">3.0</param>
<param name="is_simulation">1</param>
</hardware>
<!-- Front Left Wheel -->
<joint name="front_left_joint">
<command_interface name="position"/>
<state_interface name="position" />
</joint>
<!-- Front Right Wheel -->
<joint name="front_right_joint">
<command_interface name="position"/>
<state_interface name="position" />
</joint>
<!-- Rear Left Wheel -->
<joint name="rear_left_joint">
<command_interface name="velocity"/>
<state_interface name="velocity" />
</joint>
<!-- Rear Right Wheel -->
<joint name="rear_right_joint">
<command_interface name="velocity"/>
<state_interface name="velocity" />
</joint>
</ros2_control>
<gazebo>
<plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
<parameters>$(find race_it)/config/controller/my_controllers.yaml</parameters>
</plugin>
</gazebo>
</robot>
</code></pre>
<h1>Controller Config</h1>
<h2>my_controllers.yaml</h2>
<pre><code>controller_manager:
ros__parameters:
update_rate: 30
use_sim_time: true
asc:
type: ackermann_steering_controller/AckermannSteeringController
jsc:
type: joint_state_broadcaster/JointStateBroadcaster
asc:
ros__parameters:
reference_timeout: 2.0
front_steering: true
open_loop: false
velocity_rolling_window_size: 10
position_feedback: false
use_stamped_vel: true
#rear_wheels_names: [rear_right_joint, rear_left_joint]
#front_wheels_names: [front_right_joint, front_left_joint]
rear_wheels_names: [rear_right_joint, rear_left_joint]
front_wheels_names: [front_right_joint, front_left_joint]
wheelbase: 1.0
front_wheel_track: 0.55
rear_wheel_track: 0.55
front_wheels_radius: 0.1
rear_wheels_radius: 0.1
#jsc:
# ros__parameters:
# type: joint_state_controller/JointStateController
</code></pre>
<h1>Launch File</h1>
<h2>rsp.launch.py</h2>
<pre><code>import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.substitutions import LaunchConfiguration
from launch.actions import DeclareLaunchArgument
from launch_ros.actions import Node
import launch_ros
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
import xacro
def generate_launch_description():
# Check if we're told to use sim time
use_sim_time = LaunchConfiguration('use_sim_time')
# Process the URDF file
pkg_path = os.path.join(get_package_share_directory('race_it'))
#xacro_file = os.path.join(pkg_path,'description','robot.urdf.xacro')
xacro_file = os.path.join(pkg_path,'description', 'race_car.xacro')
robot_description_config = xacro.process_file(xacro_file)
default_rviz_config_path = os.path.join(pkg_path, 'config/rviz/urdf_config.rviz')
# Create a robot_state_publisher node
params = {'robot_description': robot_description_config.toxml(), 'use_sim_time': use_sim_time}
node_robot_state_publisher = Node(
package='robot_state_publisher',
executable='robot_state_publisher',
output='screen',
parameters=[params]
)
joint_state_publisher_node = launch_ros.actions.Node(
package='joint_state_publisher',
executable='joint_state_publisher',
name='joint_state_publisher'
)
rviz_node = launch_ros.actions.Node(
package='rviz2',
executable='rviz2',
name='rviz2',
output='screen',
arguments=['-d', default_rviz_config_path],
)
gazebo = IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
get_package_share_directory('gazebo_ros'), 'launch', 'gazebo.launch.py')])#,
# launch_arguments={'world': "my_bot/worlds/obstacles.world"}.items()
)
spawn_entity = launch_ros.actions.Node(
package='gazebo_ros',
executable='spawn_entity.py',
arguments=['-entity', '', '-topic', 'robot_description'],
output='screen'
)
# Launch!
return LaunchDescription([
DeclareLaunchArgument(
'use_sim_time',
default_value='true',
description='Use sim time if true'),
node_robot_state_publisher,
joint_state_publisher_node,
rviz_node,
gazebo,
spawn_entity
])
</code></pre>
|
impliment car like steering in ros2_control
|
<p>Anytime <code>NaN</code> values start to show up in your filter, there are really only two possibilities:</p>
<ol>
<li>Your sensor data contains <code>NaN</code> values, or the covariance matrices in your sensor data are singular (or nearly so).</li>
<li>You are not measuring some part of your state that needs to be measured, and the covariance is growing without bound.</li>
</ol>
<p>If I were you, I'd:</p>
<ul>
<li>Record a bag of everything in your system from bringup until you start getting <code>NaN</code> values/warnings</li>
<li>Look at the state and covariance values of the EKF output leading up to the <code>NaN</code> reports. Are they stable, and then suddenly change to <code>NaN</code>? Are they increasingly unstable?</li>
<li>Look at the input messages to the filter leading up to the <code>NaN</code> reports (look at the raw GPS as well)</li>
</ul>
<p>Just a quick note: I'd avoid fusing absolute <code>yaw</code> from your IMU, at least in the <code>odom</code> frame EKF. I'd just fuse yaw velocity <em>and</em> wheel encoder yaw velocity. Not your issue, but worth mentioning.</p>
|
107311
|
2023-12-29T19:32:36.967
|
|ros2|robot-localization|foxy|
|
<p>I'm using robot_localization from binary in foxy. I have an IMU, a magnetometer, wheel encoders and a GPS. I'm trying to integrate all of them into one odom message. I've already done that in the past on kinectic and ROS1, but now I spend a couple of days trying to understand the problem.
I fuse IMU (gyro + accel) and magnetometer data using imu_filter_madgwick, getting a new IMU message with earth's referenced orientation. I'm not using accelerometers on RL for now.
For testing purpose I made a node that suscribe to each sensor, overwrite covariance matrix with custom values and republish them, just to test different values of sensor noise. My test, rigth now, are statics one, that is with the robot fixed on the ground.
In order to isolate the probelm I made 3 launch file and 3 yaml file. The first one is for odomo to base_link and use imu and wheel odometry, I set world_frame: odom. In the second one I want to have map to base_link using IMU, wheel encoder and GPS odometry from a navsat_transform_node. The first test was whitout this information. In this ekf I set world_frame: map. Finally I launch navsat_transform_node using the IMU and the odomotry of the second EKF.
This are my config files:</p>
<pre><code>ekf_filter_node_odom:
ros__parameters:
frequency: 30.0
sensor_timeout: 0.1
two_d_mode: true
transform_time_offset: 0.0
transform_timeout: 0.0
print_diagnostics: true
debug: false
map_frame: map # Defaults to "map" if unspecified
odom_frame: odom # Defaults to "odom" if unspecified
base_link_frame: base_link # Defaults to "base_link" if unspecified
world_frame: odom # Defaults to the value of odom_frame if unspecified
odom0: /chori/odom
odom0_config: [false, false, false, # x, y, z
false, false, false, # roll, pitch, yaw
true, true, false, # vx, vy, vz
false, false, false, # vroll, vpitch, vyaw
false, false, false] # ax, ay, az
odom0_queue_size: 10
odom0_differential: false
odom0_relative: false
imu0: /imu_filt/data
imu0_config: [false, false, false, # x, y, z
false, false, true, # roll, pitch, yaw
false, false, false, # vx, vy, vz
false, false, true, # vroll, vpitch, vyaw
false, false, false] # ax, ay, az
imu0_differential: false
imu0_relative: false
imu0_queue_size: 10
imu0_remove_gravitational_acceleration: true
# odom1: /odometry/gps
# odom1_config: [true, true, false,
# false, false, false,
# false, false, false,
# false, false, false,
# false, false, false]
# odom1_queue_size: 10
# odom1_differential: false
# odom1_relative: false
use_control: false
process_noise_covariance: [0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.06, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.03, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.03, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.06, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.025, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.025, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.04, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.02, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.015]
initial_estimate_covariance: [1.0, 1.0, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9]
</code></pre>
<pre><code>ekf_filter_node_map:
ros__parameters:
frequency: 30.0
sensor_timeout: 0.1
two_d_mode: true
transform_time_offset: 0.0
transform_timeout: 0.0
print_diagnostics: true
debug: false
map_frame: map # Defaults to "map" if unspecified
odom_frame: odom # Defaults to "odom" if unspecified
base_link_frame: base_link # Defaults to "base_link" if unspecified
world_frame: map # Defaults to the value of odom_frame if unspecified
odom0: /chori/odom
odom0_config: [false, false, false, # x, y, z
false, false, false, # roll, pitch, yaw
true, true, false, # vx, vy, vz
false, false, false, # vroll, vpitch, vyaw
false, false, false] # ax, ay, az
odom0_queue_size: 10
odom0_differential: false
odom0_relative: false
imu0: /imu_filt/data
imu0_config: [false, false, false, # x, y, z
false, false, true, # roll, pitch, yaw
false, false, false, # vx, vy, vz
false, false, true, # vroll, vpitch, vyaw
false, false, false] # ax, ay, az
imu0_differential: false
imu0_relative: false
imu0_queue_size: 10
imu0_remove_gravitational_acceleration: true
# odom1: /odometry/gps
# odom1_config: [true, true, false,
# false, false, false,
# false, false, false,
# false, false, false,
# false, false, false]
# odom1_queue_size: 10
# odom1_differential: false
# odom1_relative: false
use_control: false
process_noise_covariance: [0.00005, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.00005, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.06, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.03, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.03, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.06, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.025, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.025, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.04, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.02, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.015]
initial_estimate_covariance: [1e-9, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9, 1e-9]
</code></pre>
<pre><code>navsat_transform:
ros__parameters:
frequency: 30.0
delay: 3.0
magnetic_declination_radians: 0.0
yaw_offset: 0.0
zero_altitude: true
broadcast_utm_transform: false
broadcast_utm_transform_as_parent_frame: false
publish_filtered_gps: true
use_odometry_yaw: false
wait_for_datum: false
datum: [55.944904, -3.186693, 0.0]
</code></pre>
<p>Commenting the odom from navsat_node everithing works as expected:</p>
<pre><code>/odometry/local:
header:
stamp:
sec: 1703877370
nanosec: 618882913
frame_id: odom
child_frame_id: base_link
pose:
pose:
position:
x: -3.265787509571813e-08
y: -2.5325475992428667e-08
z: 0.0
orientation:
x: 0.0
y: 0.0
z: -0.9464920648473698
w: 0.3227270846721146
covariance:
- 105.41803562756589
- 0.9999999997402413
- 0.0
- 0.0
- 0.0
- 0.0
- 8.97322730679937e-11
- 104.41803562743078
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 9.97250753351147e-07
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 9.945240794569202e-07
- -8.99665850990115e-32
- 0.0
- 0.0
- 0.0
- 0.0
- 4.53524026675228e-32
- 9.945240794569202e-07
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.00045500753652848267
twist:
twist:
linear:
x: -5.0e-324
y: -5.0e-324
z: 0.0
angular:
x: 0.0
y: 0.0
z: -0.016021900057577837
covariance:
- 0.003166571002366939
- 5.0e-324
- 0.0
- 0.0
- 0.0
- 0.0
- 5.0e-324
- 0.003166571002366939
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 9.958846128129104e-07
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 9.838374544094523e-07
- -2.133540770254387e-40
- 0.0
- 0.0
- 0.0
- 0.0
- 1.0760776055407016e-40
- 9.838374544094523e-07
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0005829180548309103
</code></pre>
<pre><code>/odometry/global:
header:
stamp:
sec: 1703877524
nanosec: 533675418
frame_id: map
child_frame_id: base_link
pose:
pose:
position:
x: -5.5119621632357074e-08
y: -5.058970622734353e-08
z: 0.0
orientation:
x: 0.0
y: 0.0
z: -0.943614123552411
w: 0.33104740722805115
covariance:
- 0.2039609652147536
- 7.435771160987088e-10
- 0.0
- 0.0
- 0.0
- 0.0
- 8.815912973107209e-11
- 0.20396096408126818
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 4.993807114645625e-07
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 4.987659973458145e-07
- 8.449250328203822e-33
- 0.0
- 0.0
- 0.0
- 0.0
- 1.0860977782637455e-34
- 4.987659973458145e-07
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 9.300757210968958e-05
twist:
twist:
linear:
x: -5.0e-324
y: -5.0e-324
z: 0.0
angular:
x: 0.0
y: 0.0
z: -0.01235058626604838
covariance:
- 0.003366571597252472
- 5.0e-324
- 0.0
- 0.0
- 0.0
- 0.0
- 5.0e-324
- 0.003366571597252472
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 4.990727864575202e-07
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 4.963516746353309e-07
- 7.982007752141765e-41
- 0.0
- 0.0
- 0.0
- 0.0
- -1.1567015083963526e-42
- 4.963516746353309e-07
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0004669832570670235
</code></pre>
<pre><code>/odometry/gps:
header:
stamp:
sec: 1703877582
nanosec: 399740028
frame_id: map
child_frame_id: ''
pose:
pose:
position:
x: -0.008271901635453105
y: -1.2983679128810763
z: 0.0
orientation:
x: 0.0
y: 0.0
z: 0.0
w: 1.0
covariance:
- 0.010000000000000002
- -1.727544254342965e-20
- 0.0
- 0.0
- 0.0
- 0.0
- -2.1858820742247025e-20
- 0.01
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.01
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
twist:
twist:
linear:
x: 0.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0
covariance:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
</code></pre>
<p>So, it seems that each node is consuming the correct topic.</p>
<p>The problem begin as soon as I un-comment odom1: /odometry/gps in 2nd EKF instance. Doing that makes the filter to diverge (?) and getting NaN in /odometry/global and tf errors on each nodes.</p>
<p>This are some sensor messages:</p>
<p>IMU:</p>
<pre><code>header:
stamp:
sec: 1703877924
nanosec: 612979324
frame_id: base_link
orientation:
x: -0.021131203593264605
y: -0.00959170781407142
z: -0.9435509779280431
w: 0.3304134129041116
orientation_covariance:
- 0.0001
- 0.0
- 0.0
- 0.0
- 0.0001
- 0.0
- 0.0
- 0.0
- 0.0001
angular_velocity:
x: 0.0
y: 0.0
z: -0.0127901965752244
angular_velocity_covariance:
- 0.001
- 0.0
- 0.0
- 0.0
- 0.001
- 0.0
- 0.0
- 0.0
- 0.001
linear_acceleration:
x: 0.42631348967552185
y: -0.014370117336511612
z: 9.81
linear_acceleration_covariance:
- 0.001
- 0.0
- 0.0
- 0.0
- 0.001
- 0.0
- 0.0
- 0.0
- 0.001
---
</code></pre>
<p>Encoder:</p>
<pre><code>header:
stamp:
sec: 1703878128
nanosec: 55326030
frame_id: odom
child_frame_id: base_link
pose:
pose:
position:
x: 0.0
y: 0.0
z: 0.0
orientation:
x: 0.0
y: 0.0
z: 0.0
w: 1.0
covariance:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
twist:
twist:
linear:
x: 0.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: -0.0
covariance:
- 0.01
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.01
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
</code></pre>
<p>GPS:</p>
<pre><code>header:
stamp:
sec: 1703878190
nanosec: 899551033
frame_id: base_link
status:
status: 0
service: 0
latitude: -33.5079348
longitude: -60.0621127
altitude: 56.347
position_covariance:
- 0.01
- 0.0
- 0.0
- 0.0
- 0.01
- 0.0
- 0.0
- 0.0
- 0.01
position_covariance_type: 0
---
</code></pre>
<p>Do I missing something?</p>
<p>EDIT: I can't make the map to base_link to work alone even publishing fake /odometry/gps without runnning navsat_transform_node.
if I enable that message in the sensors list then the ekf_node broke as soon as I run it and print "Critical Error, NaNs were detected in the output state of the filter. This was likely due to poorly coniditioned process, noise, or sensor covariances"
But I can't find a good starting point to work with.</p>
|
problems trying to use navsat_transform into robot_localization ekf_node
|
<p>I have fixed the issue it was about the costmap inflation radius parameter. It was too huge so that the start position of the turtlebot was not on the free space area.</p>
|
107316
|
2023-12-30T01:48:10.850
|
|ros|navigation|costmap|turtlebot3|
|
<p>I have a problem on my astar planner plugin for move_base to move the turtlebot3.</p>
<p>When I use the 2D nav goal, sometimes it works I don't know why but many times it doesn't. It does not make the path instead the turtlbot just rotates.
I think that the turtlebot does not find its starting point so it keeps rotating for recovery behavior.</p>
<p>I think that it is related to the OccupancyGridMap, which finds the free area except for the obstacles. However, I think that the logic is fine and I cannot figure out the problem. I think that the costmap can be the problem.
The default planner of move_base works fine but mine doesn't.</p>
<p>I uploaded the astar planner plugin algorithm(cpp,header) and screenshot of what I got when using the 2D nav goal</p>
<p>please Help me I am solving this problem a week ㅠㅠ</p>
<p>It is ROS Noetic and Ubuntu 20.04
<a href="https://i.stack.imgur.com/fZK6f.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fZK6f.png" alt="enter image description here" /></a></p>
<pre><code>#ifndef ASTAR_PLANNER_CPP
#define ASTAR_PLANNER_CPP
#include <ros/ros.h>
#include <costmap_2d/costmap_2d_ros.h>
#include <costmap_2d/costmap_2d.h>
#include <nav_core/base_global_planner.h>
#include <geometry_msgs/PoseStamped.h>
#include <angles/angles.h>
#include <base_local_planner/world_model.h>
#include <base_local_planner/costmap_model.h>
#include <nav_msgs/Path.h>
#include <tf/tf.h>
#include <vector>
#include <queue>
#include <cmath>
using std::string;
using std::vector;
using std::priority_queue;
using std::abs;
struct Node{
double f_cost, g_cost;
int idx;
};
namespace astar_planner {
class AstarPlanner : public nav_core::BaseGlobalPlanner {
public:
bool initialized = false;
costmap_2d::Costmap2DROS *m_costmap_ros;
costmap_2d::Costmap2D *m_costmap;
int cellsY;
int cellsX;
int area;
vector<bool> OccupancyGridMap;
vector<int> open;
vector<bool> closed;
vector<int> parentNode;
string m_frame_id;
ros::Publisher pub;
AstarPlanner(); // default constructor
AstarPlanner(std::string name, costmap_2d::Costmap2DROS* costmap_ros);
/** overridden classes from interface nav_core::BaseGlobalPlanner **/
void initialize(std::string name, costmap_2d::Costmap2DROS* costmap_ros);
bool makePlan(const geometry_msgs::PoseStamped& start,const geometry_msgs::PoseStamped& goal,std::vector<geometry_msgs::PoseStamped>& plan);
//helper methods
vector<int> getAdjacent(int cur_idx);
double getGcost(int fstIdx, int sndIdx);
int getHeuristic(int nIdx, int goalIdx);
bool areaLimit(int x, int y);
void publishPlan(const std::vector<geometry_msgs::PoseStamped>& path);
void mapToWorld(unsigned int mx, unsigned int my, double& wx, double& wy);
bool worldToMap(double wx, double wy, unsigned int& mx, unsigned int& my);
};
};
#endif
</code></pre>
<pre><code>#include "AstarPlanner.h"
#include <pluginlib/class_list_macros.h>
//register this planner as a BaseAstarPlanner plugin
PLUGINLIB_EXPORT_CLASS(astar_planner::AstarPlanner, nav_core::BaseGlobalPlanner)
// compare function for minimum heap
struct cmp {
bool operator()(Node &fst_node, Node &snd_node) {
return fst_node.f_cost > snd_node.f_cost;
}
};
//finding the adjacent nodes in the clockwise direction
int dx[8] = {0,1,1,1,0,-1,-1,-1};
int dy[8] = {-1,-1,0,1,1,1,0,-1};
namespace astar_planner {
//Constructor
AstarPlanner::AstarPlanner(){}
AstarPlanner::AstarPlanner(std::string name, costmap_2d::Costmap2DROS* costmap_ros){
initialize(name, costmap_ros);
}
//initialized the astar planner
void AstarPlanner::initialize(std::string name, costmap_2d::Costmap2DROS* costmap_ros){
if(!initialized) {
m_costmap_ros = costmap_ros;
m_costmap = m_costmap_ros->getCostmap();
cellsY = m_costmap->getSizeInCellsY();
cellsX = m_costmap->getSizeInCellsX();
area = cellsY * cellsX;
OccupancyGridMap.resize(area,false);
for(unsigned int i = 0; i < cellsY; i++) {
for(unsigned int j = 0; j < cellsX; j++) {
int cost = static_cast<int>(m_costmap->getCost(j,i));
if(cost == 0) {
OccupancyGridMap[i*cellsX+j] = true;
}
}
}
m_frame_id = m_costmap_ros->getGlobalFrameID();
ros::NodeHandle private_nh("~/"+name);
pub = private_nh.advertise<nav_msgs::Path>("plan", 1);
initialized = true;
}
else {
ROS_WARN("Already Initialized");
}
}
//making the path of the AMR
bool AstarPlanner::makePlan(const geometry_msgs::PoseStamped& start, const geometry_msgs::PoseStamped& goal, std::vector<geometry_msgs::PoseStamped>& plan ){
if(!initialized) {
ROS_WARN("Not Initialized");
return false;
}
//get the start pose of the map from the world
double world_sx = start.pose.position.x;
double world_sy = start.pose.position.y;
unsigned int start_x,start_y;
m_costmap->worldToMap(world_sx,world_sy,start_x,start_y);
//get the goal pose of the map from the world
double world_gx = goal.pose.position.x;
double world_gy = goal.pose.position.y;
unsigned int goal_x,goal_y;
m_costmap->worldToMap(world_gx,world_gy,goal_x,goal_y);
//convert to the index from the coordinates
int start_idx = m_costmap->getIndex(start_x,start_y);
int goal_idx = m_costmap->getIndex(goal_x,goal_y);
//check the start and goal located at the correct poistion
if(OccupancyGridMap[start_idx] == false || !areaLimit(start_x,start_y)) {
ROS_WARN("%d %d",start_y,start_x);
ROS_WARN("Wrong start position");
return false;
}
if(OccupancyGridMap[goal_idx] == false || !areaLimit(goal_x,goal_y)) {
ROS_WARN("Wrong goal position");
return false;
}
//pq to get the lowest value of the fuctions
priority_queue<Node,vector<Node>,cmp> pq_wait;
//make the open and closed checking vector for astar
open.resize(area,2000000);
closed.resize(area,false);
//make the parent node
parentNode.resize(area,-10);
//make the start node
Node start_node;
start_node.f_cost = 0 + getHeuristic(start_idx,goal_idx);
start_node.g_cost = 0;
start_node.idx = start_idx;
open[start_idx] = start_node.f_cost;
parentNode[start_idx] = -1;
pq_wait.push(start_node);
//find the path and allocate it to the parentNode
while(!pq_wait.empty()) {
Node cur = pq_wait.top();
pq_wait.pop();
if(closed[cur.idx]== true) {
continue;
}
if(cur.idx == goal_idx) {
break;
}
closed[cur.idx] = true;
vector<int> adj = getAdjacent(cur.idx);
for(int i = 0; i < adj.size(); i++) {
Node nxt;
nxt.idx = adj[i];
if(closed[nxt.idx]) {
continue;
}
nxt.g_cost = cur.g_cost + getGcost(cur.idx,nxt.idx);
nxt.f_cost = nxt.g_cost + getHeuristic(nxt.idx,goal_idx);
if(open[nxt.idx] < nxt.f_cost) {
continue;
}
open[nxt.idx] = nxt.f_cost;
parentNode[nxt.idx] = cur.idx;
pq_wait.push(nxt);
}
}
if(parentNode[goal_idx] == -10) {
ROS_WARN("%d", parentNode[goal_idx]);
ROS_WARN("Goal pose cannot be reached");
return false;
}
//construct the path
vector<int> path;
int reverse_start = goal_idx;
while(parentNode[reverse_start] != -1) {
path.push_back(reverse_start);
reverse_start = parentNode[reverse_start];
}
path.push_back(start_idx);
reverse(path.begin(),path.end());
//make the final plan
ros::Time plan_time = ros::Time::now();
for(int i = 0; i < path.size(); i++) {
unsigned int tmp_x,tmp_y;
m_costmap->indexToCells(path[i],tmp_x,tmp_y);
double cur_x,cur_y;
m_costmap->mapToWorld(tmp_x,tmp_y,cur_x,cur_y);
m_costmap->indexToCells(path[i-1],tmp_x,tmp_y);
double prev_x,prev_y;
m_costmap->mapToWorld(tmp_x,tmp_y,prev_x,prev_y);
double angle = atan2(cur_y-prev_y,cur_x-prev_x);
geometry_msgs::PoseStamped coord;
coord.header.stamp = plan_time;
coord.header.frame_id = m_costmap_ros->getGlobalFrameID();
coord.pose.position.x = cur_x;
coord.pose.position.y = cur_y;
coord.pose.position.z = 0.0;
coord.pose.orientation = tf::createQuaternionMsgFromYaw(angle);
plan.push_back(coord);
}
return true;
}
//find the adjacent nodes
vector<int> AstarPlanner::getAdjacent(int cur_idx) {
vector<int> adj;
unsigned int cur_x, cur_y;
m_costmap->indexToCells(cur_idx,cur_x,cur_y);
for(int dir = 0; dir < 8; dir++) {
int nx = cur_x+dx[dir];
int ny = cur_y+dy[dir];
if(!areaLimit(nx,ny)) {
continue;
}
int nidx = m_costmap->getIndex(nx,ny);
if(OccupancyGridMap[nidx] == false) {
continue;
}
adj.push_back(nidx);
}
return adj;
}
// get the g function value of the adjacent nodes
double AstarPlanner::getGcost(int fstIdx, int sndIdx) {
unsigned int tmp_x,tmp_y;
m_costmap->indexToCells(fstIdx,tmp_x,tmp_y);
int fst_x = tmp_x;
int fst_y = tmp_y;
m_costmap->indexToCells(sndIdx,tmp_x,tmp_y);
int snd_x = tmp_x;
int snd_y = tmp_y;
int cost = abs(fst_x-snd_x) + abs(fst_y-snd_y);
if(cost == 2) {
// pythagorean theorem
return 1.4;
}
else {
return 1.0;
}
}
// get the heuristic function value
int AstarPlanner::getHeuristic(int nIdx, int goalIdx) {
unsigned int tmp_x,tmp_y;
m_costmap->indexToCells(nIdx,tmp_x,tmp_y);
int nx = tmp_x;
int ny = tmp_y;
m_costmap->indexToCells(goalIdx,tmp_x,tmp_y);
int gx = tmp_x;
int gy = tmp_y;
return (abs(nx-gx)+abs(ny-gy));
}
//check the limitation of the map size
bool AstarPlanner::areaLimit(int x, int y) {
if(x < 0 || y < 0 || x >= cellsX || y >= cellsY) {
return false;
}
return true;
}
};
</code></pre>
|
Stuck on Astar Planner plugin for movebase to operate turtlebot3
|
<p>This was totally my mistake. I remapped the <code>/cmd_vel</code> topic from the <code>move_base</code> to the <code>/diff_drive_controller/cmd_vel</code> from the <code>diff_drive_controller</code> in the <code>move_base.launch</code> file like this</p>
<pre><code><node name="move_base" pkg="move_base" respawn="false" type="move_base" output="screen">
<!-- Other parameters for move_base -->
<remap from="/cmd_vel" to="/diff_drive_controller/cmd_vel"/>
</node>
</code></pre>
<p>now the robot moves like a charm. Thanks for your insight @Russ76</p>
|
107319
|
2023-12-30T07:44:20.037
|
|navigation|robot-localization|ros-noetic|diff-drive-controller|
|
<p>I am trying to implement the navigation and reaching the goal by the 4_wheel_bot, you can find the files in <a href="https://github.com/Vasanth28897/my_4wheel_bot/tree/master" rel="nofollow noreferrer">this</a> github page. I tried the <code>diff_drive_controller</code> by giving 4 wheel joints instead of two, which publishes the topic <code>/diff_drive_controller/cmd_ve</code>l instead of <code>/cmd_vel</code>, and it's totally working by just moving the robot with the help of <code>teleop_twist_keyboard</code> or <code>rqt_robot_steering</code> node. Furthermore, there are <code>amcl</code> and <code>move_base</code> package already implemented. But when i gave the <code>2d_pose_estimate</code> and <code>2d_nav_goal</code> in rviz, the robot does not move an inch. I don't know what causes this issue...
there are two launch files, have to run these on separate terminal... you can see <a href="https://github.com/Vasanth28897/my_4wheel_bot/blob/master/bot_not_moving_to_goal.webm" rel="nofollow noreferrer">this</a> video how the bot is reacting when the 2d_nav_goal given...</p>
<p>i am posting here the terminal results after the launch files executed..</p>
<p>roslaunch my_4wheel_bot navigation.launch</p>
<pre><code>pc@pc-NUC12WSHi5:~/ros_ws$ roslaunch my_4wheel_bot navigation.launch
... logging to /home/pc/.ros/log/b50f9400-a6e2-11ee-b407-7df1f70a5813/roslaunch-pc-NUC12WSHi5-74880.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://pc-NUC12WSHi5:33327/
SUMMARY
========
PARAMETERS
* /diff_drive_controller/angular/z/has_acceleration_limits: True
* /diff_drive_controller/angular/z/has_velocity_limits: True
* /diff_drive_controller/angular/z/max_acceleration: 6.0
* /diff_drive_controller/angular/z/max_velocity: 2.0
* /diff_drive_controller/base_frame_id: base_link
* /diff_drive_controller/commandTopic: cmd_vel
* /diff_drive_controller/enable_odom_tf: True
* /diff_drive_controller/estimate_velocity_from_position: False
* /diff_drive_controller/left_wheel: ['front_left_whee...
* /diff_drive_controller/linear/x/has_acceleration_limits: True
* /diff_drive_controller/linear/x/has_velocity_limits: True
* /diff_drive_controller/linear/x/max_acceleration: 0.6
* /diff_drive_controller/linear/x/max_velocity: 0.2
* /diff_drive_controller/odom_frame_id: odom
* /diff_drive_controller/pose_covariance_diagonal: [0.001, 0.001, 0....
* /diff_drive_controller/publish_rate: 50
* /diff_drive_controller/right_wheel: ['front_right_whe...
* /diff_drive_controller/twist_covariance_diagonal: [0.001, 0.001, 0....
* /diff_drive_controller/type: diff_drive_contro...
* /diff_drive_controller/wheel_radius: 0.025
* /diff_drive_controller/wheel_separation: 0.125
* /gazebo/enable_ros_network: True
* /joint_state_controller/gazebo_ros_control/pid_gains/front_left_wheel_joint/d: 10.0
* /joint_state_controller/gazebo_ros_control/pid_gains/front_left_wheel_joint/i: 0.01
* /joint_state_controller/gazebo_ros_control/pid_gains/front_left_wheel_joint/p: 100.0
* /joint_state_controller/gazebo_ros_control/pid_gains/front_right_wheel_joint/d: 10.0
* /joint_state_controller/gazebo_ros_control/pid_gains/front_right_wheel_joint/i: 0.01
* /joint_state_controller/gazebo_ros_control/pid_gains/front_right_wheel_joint/p: 100.0
* /joint_state_controller/gazebo_ros_control/pid_gains/rear_left_wheel_joint/d: 10.0
* /joint_state_controller/gazebo_ros_control/pid_gains/rear_left_wheel_joint/i: 0.01
* /joint_state_controller/gazebo_ros_control/pid_gains/rear_left_wheel_joint/p: 100.0
* /joint_state_controller/gazebo_ros_control/pid_gains/rear_right_wheel_joint/d: 10.0
* /joint_state_controller/gazebo_ros_control/pid_gains/rear_right_wheel_joint/i: 0.01
* /joint_state_controller/gazebo_ros_control/pid_gains/rear_right_wheel_joint/p: 100.0
* /joint_state_controller/publish_rate: 50
* /joint_state_controller/type: joint_state_contr...
* /robot_description: <?xml version="1....
* /rosdistro: noetic
* /rosversion: 1.16.0
* /use_sim_time: True
NODES
/
controller_spawner (controller_manager/spawner)
gazebo (gazebo_ros/gzserver)
gazebo_gui (gazebo_ros/gzclient)
joint_state_publisher (joint_state_publisher/joint_state_publisher)
robot_state_publisher (robot_state_publisher/robot_state_publisher)
rviz (rviz/rviz)
spawning_lidar (gazebo_ros/spawn_model)
auto-starting new master
process[master]: started with pid [74890]
ROS_MASTER_URI=http://localhost:11311
setting /run_id to b50f9400-a6e2-11ee-b407-7df1f70a5813
process[rosout-1]: started with pid [74901]
started core service [/rosout]
process[controller_spawner-2]: started with pid [74908]
process[joint_state_publisher-3]: started with pid [74909]
process[robot_state_publisher-4]: started with pid [74910]
process[rviz-5]: started with pid [74911]
process[gazebo-6]: started with pid [74912]
process[gazebo_gui-7]: started with pid [74917]
process[spawning_lidar-8]: started with pid [74926]
[ WARN] [1703920313.201055396]: The root link base_link has an inertia specified in the URDF, but KDL does not support a root link with an inertia. As a workaround, you can add an extra dummy link to your URDF.
[INFO] [1703920313.361973, 0.000000]: Controller Spawner: Waiting for service controller_manager/load_controller
[ INFO] [1703920313.655122071]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1703920313.656130462]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
[ INFO] [1703920313.681551370]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1703920313.682233097]: waitForService: Service [/gazebo_gui/set_physics_properties] has not been advertised, waiting...
Error: Non-unique names detected in <link name='link'>
<collision name='surface'>
<pose>0 0 1 0 -0 0</pose>
<geometry>
<box>
<size>1.5 0.8 0.03</size>
</box>
</geometry>
<surface>
<friction>
<ode>
<mu>0.6</mu>
<mu2>0.6</mu2>
</ode>
<torsional>
<ode/>
</torsional>
</friction>
<contact>
<ode/>
</contact>
<bounce/>
</surface>
<max_contacts>10</max_contacts>
</collision>
<visual name='visual1'>
<pose>0 0 1 0 -0 0</pose>
<geometry>
<box>
<size>1.4 0.8 0.04</size>
</box>
</geometry>
<material>
<script>
<uri>file://media/materials/scripts/gazebo.material</uri>
<name>Gazebo/Wood</name>
</script>
</material>
</visual>
<collision name='front_left_leg'>
<pose>0.68 0.38 0.5 0 -0 0</pose>
<geometry>
<cylinder>
<radius>0.02</radius>
<length>1</length>
</cylinder>
</geometry>
<max_contacts>10</max_contacts>
<surface>
<contact>
<ode/>
</contact>
<bounce/>
<friction>
<torsional>
<ode/>
</torsional>
<ode/>
</friction>
</surface>
</collision>
<visual name='front_left_leg'>
<pose>0.68 0.38 0.5 0 -0 0</pose>
<geometry>
<cylinder>
<radius>0.02</radius>
<length>1</length>
</cylinder>
</geometry>
<material>
<script>
<uri>file://media/materials/scripts/gazebo.material</uri>
<name>Gazebo/Grey</name>
</script>
</material>
</visual>
<collision name='front_right_leg'>
<pose>0.68 -0.38 0.5 0 -0 0</pose>
<geometry>
<cylinder>
<radius>0.02</radius>
<length>1</length>
</cylinder>
</geometry>
<max_contacts>10</max_contacts>
<surface>
<contact>
<ode/>
</contact>
<bounce/>
<friction>
<torsional>
<ode/>
</torsional>
<ode/>
</friction>
</surface>
</collision>
<visual name='front_right_leg'>
<pose>0.68 -0.38 0.5 0 -0 0</pose>
<geometry>
<cylinder>
<radius>0.02</radius>
<length>1</length>
</cylinder>
</geometry>
<material>
<script>
<uri>file://media/materials/scripts/gazebo.material</uri>
<name>Gazebo/Grey</name>
</script>
</material>
</visual>
<collision name='back_right_leg'>
<pose>-0.68 -0.38 0.5 0 -0 0</pose>
<geometry>
<cylinder>
<radius>0.02</radius>
<length>1</length>
</cylinder>
</geometry>
<max_contacts>10</max_contacts>
<surface>
<contact>
<ode/>
</contact>
<bounce/>
<friction>
<torsional>
<ode/>
</torsional>
<ode/>
</friction>
</surface>
</collision>
<visual name='back_right_leg'>
<pose>-0.68 -0.38 0.5 0 -0 0</pose>
<geometry>
<cylinder>
<radius>0.02</radius>
<length>1</length>
</cylinder>
</geometry>
<material>
<script>
<uri>file://media/materials/scripts/gazebo.material</uri>
<name>Gazebo/Grey</name>
</script>
</material>
</visual>
<collision name='back_left_leg'>
<pose>-0.68 0.38 0.5 0 -0 0</pose>
<geometry>
<cylinder>
<radius>0.02</radius>
<length>1</length>
</cylinder>
</geometry>
<max_contacts>10</max_contacts>
<surface>
<contact>
<ode/>
</contact>
<bounce/>
<friction>
<torsional>
<ode/>
</torsional>
<ode/>
</friction>
</surface>
</collision>
<visual name='back_left_leg'>
<pose>-0.68 0.38 0.5 0 -0 0</pose>
<geometry>
<cylinder>
<radius>0.02</radius>
<length>1</length>
</cylinder>
</geometry>
<material>
<script>
<uri>file://media/materials/scripts/gazebo.material</uri>
<name>Gazebo/Grey</name>
</script>
</material>
</visual>
<self_collide>0</self_collide>
<inertial>
<pose>0 0 0 0 -0 0</pose>
<inertia>
<ixx>1</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>1</iyy>
<iyz>0</iyz>
<izz>1</izz>
</inertia>
<mass>1</mass>
</inertial>
<enable_wind>0</enable_wind>
<kinematic>0</kinematic>
</link>
[ INFO] [1703920314.132334676]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[ INFO] [1703920314.152715158]: Physics dynamic reconfigure ready.
[ERROR] [1703920314.184128, 144.836000]: Spawn service failed. Exiting.
../src/intel/isl/isl.c:2105: FINISHME: ../src/intel/isl/isl.c:isl_surf_supports_ccs: CCS for 3D textures is disabled, but a workaround is available.
../src/intel/isl/isl.c:2105: FINISHME: ../src/intel/isl/isl.c:isl_surf_supports_ccs: CCS for 3D textures is disabled, but a workaround is available.
[spawning_lidar-8] process has died [pid 74926, exit code 1, cmd /opt/ros/noetic/lib/gazebo_ros/spawn_model -urdf -param robot_description -model my_rover __name:=spawning_lidar __log:=/home/pc/.ros/log/b50f9400-a6e2-11ee-b407-7df1f70a5813/spawning_lidar-8.log].
log file: /home/pc/.ros/log/b50f9400-a6e2-11ee-b407-7df1f70a5813/spawning_lidar-8*.log
[ INFO] [1703920315.050990054, 144.916000000]: Camera Plugin: Using the 'robotNamespace' param: '/'
[ INFO] [1703920315.054478329, 144.916000000]: Camera Plugin (ns = /) <tf_prefix_>, set to ""
[ WARN] [1703920315.054523453, 144.916000000]: dynamic reconfigure is not enabled for this image topic [image_raw] becuase <cameraName> is not specified
[ INFO] [1703920315.062594749, 144.916000000]: Laser Plugin: Using the 'robotNamespace' param: '/'
[ INFO] [1703920315.062678021, 144.916000000]: Starting Laser Plugin (ns = /)
[ INFO] [1703920315.063889626, 144.916000000]: Laser Plugin (ns = /) <tf_prefix_>, set to ""
[ INFO] [1703920315.169929579, 144.916000000]: Loading gazebo_ros_control plugin
[ INFO] [1703920315.170051816, 144.916000000]: Starting gazebo_ros_control plugin in namespace: /
[ INFO] [1703920315.171993289, 144.916000000]: gazebo_ros_control plugin is waiting for model URDF in parameter [robot_description] on the ROS param server.
[ERROR] [1703920315.285361885, 144.916000000]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/front_left_wheel_joint
[ERROR] [1703920315.285814208, 144.916000000]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/rear_left_wheel_joint
[ERROR] [1703920315.286150395, 144.916000000]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/front_right_wheel_joint
[ERROR] [1703920315.286822565, 144.916000000]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/rear_right_wheel_joint
[ INFO] [1703920315.291574976, 144.916000000]: Loaded gazebo_ros_control.
[INFO] [1703920315.475831, 145.090000]: Controller Spawner: Waiting for service controller_manager/switch_controller
[INFO] [1703920315.484127, 145.095000]: Controller Spawner: Waiting for service controller_manager/unload_controller
[INFO] [1703920315.492859, 145.103000]: Loading controller: diff_drive_controller
[ INFO] [1703920315.519353393, 145.118000000]: Controller state will be published at 50Hz.
[ INFO] [1703920315.520722058, 145.119000000]: Wheel separation will be multiplied by 1.
[ INFO] [1703920315.523375624, 145.122000000]: Left wheel radius will be multiplied by 1.
[ INFO] [1703920315.523493837, 145.122000000]: Right wheel radius will be multiplied by 1.
[ INFO] [1703920315.524567966, 145.122000000]: Velocity rolling window size of 10.
[ INFO] [1703920315.526177505, 145.124000000]: Velocity commands will be considered old if they are older than 0.5s.
[ INFO] [1703920315.527602461, 145.125000000]: Allow mutiple cmd_vel publishers is enabled
[ INFO] [1703920315.529640837, 145.127000000]: Base frame_id set to base_link
[ INFO] [1703920315.531813692, 145.129000000]: Odometry frame_id set to odom
[ INFO] [1703920315.535220029, 145.132000000]: Publishing to tf is enabled
[ INFO] [1703920315.552850365, 145.147000000]: Odometry params : wheel separation 0.125, left wheel radius 0.025, right wheel radius 0.025
[ INFO] [1703920315.559993255, 145.153000000]: Adding left wheel with joint name: front_left_wheel_joint and right wheel with joint name: front_right_wheel_joint
[ INFO] [1703920315.560146106, 145.154000000]: Adding left wheel with joint name: rear_left_wheel_joint and right wheel with joint name: rear_right_wheel_joint
[ INFO] [1703920315.582658184, 145.173000000]: Dynamic Reconfigure:
DynamicParams:
Odometry parameters:
left wheel radius multiplier: 1
right wheel radius multiplier: 1
wheel separation multiplier: 1
Publication parameters:
Publish executed velocity command: disabled
Publication rate: 50
Publish frame odom on tf: enabled
[INFO] [1703920315.590121, 145.180000]: Loading controller: joint_state_controller
[INFO] [1703920315.613393, 145.201000]: Controller Spawner: Loaded controllers: diff_drive_controller, joint_state_controller
[INFO] [1703920315.624950, 145.212000]: Started controllers: diff_drive_controller, joint_state_controller
</code></pre>
<p>roslaunch my_4wheel_bot move_base.launch</p>
<pre><code>pc@pc-NUC12WSHi5:~/ros_ws$ roslaunch my_4wheel_bot move_base.launch
... logging to /home/pc/.ros/log/b50f9400-a6e2-11ee-b407-7df1f70a5813/roslaunch-pc-NUC12WSHi5-75267.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://pc-NUC12WSHi5:34391/
SUMMARY
========
PARAMETERS
* /amcl/gui_publish_rate: 10.0
* /amcl/kld_err: 0.05
* /amcl/kld_z: 0.99
* /amcl/laser_lambda_short: 0.1
* /amcl/laser_likelihood_max_dist: 2.0
* /amcl/laser_max_beams: 30
* /amcl/laser_model_type: likelihood_field
* /amcl/laser_sigma_hit: 0.2
* /amcl/laser_z_hit: 0.5
* /amcl/laser_z_max: 0.05
* /amcl/laser_z_rand: 0.5
* /amcl/laser_z_short: 0.05
* /amcl/max_particles: 2000
* /amcl/min_particles: 500
* /amcl/odom_alpha1: 0.2
* /amcl/odom_alpha2: 0.2
* /amcl/odom_alpha3: 0.8
* /amcl/odom_alpha4: 0.2
* /amcl/odom_alpha5: 0.1
* /amcl/odom_frame_id: odom
* /amcl/odom_model_type: diff
* /amcl/recovery_alpha_fast: 0.0
* /amcl/recovery_alpha_slow: 0.0
* /amcl/resample_interval: 1
* /amcl/transform_tolerance: 0.5
* /amcl/update_min_a: 0.2
* /amcl/update_min_d: 0.1
* /amcl/use_map_topic: True
* /move_base/DWAPlannerROS/acc_lim_theta: 2.5
* /move_base/DWAPlannerROS/acc_lim_x: 3.2
* /move_base/DWAPlannerROS/acc_lim_y: 0.0
* /move_base/DWAPlannerROS/controller_frequency: 10.0
* /move_base/DWAPlannerROS/forward_point_distance: 0.325
* /move_base/DWAPlannerROS/goal_distance_bias: 20.0
* /move_base/DWAPlannerROS/latch_xy_goal_tolerance: False
* /move_base/DWAPlannerROS/max_scaling_factor: 0.2
* /move_base/DWAPlannerROS/max_vel_theta: 1.82
* /move_base/DWAPlannerROS/max_vel_trans: 0.26
* /move_base/DWAPlannerROS/max_vel_x: 0.45
* /move_base/DWAPlannerROS/max_vel_y: 0.0
* /move_base/DWAPlannerROS/min_vel_theta: 0.9
* /move_base/DWAPlannerROS/min_vel_trans: -0.13
* /move_base/DWAPlannerROS/min_vel_x: -0.26
* /move_base/DWAPlannerROS/min_vel_y: 0.0
* /move_base/DWAPlannerROS/occdist_scale: 0.02
* /move_base/DWAPlannerROS/oscillation_reset_dist: 0.05
* /move_base/DWAPlannerROS/path_distance_bias: 32.0
* /move_base/DWAPlannerROS/publish_cost_grid_pc: True
* /move_base/DWAPlannerROS/publish_traj_pc: True
* /move_base/DWAPlannerROS/scaling_speed: 0.25
* /move_base/DWAPlannerROS/sim_time: 2.0
* /move_base/DWAPlannerROS/stop_time_buffer: 0.2
* /move_base/DWAPlannerROS/vth_samples: 40
* /move_base/DWAPlannerROS/vx_samples: 20
* /move_base/DWAPlannerROS/vy_samples: 0
* /move_base/DWAPlannerROS/xy_goal_tolerance: 0.05
* /move_base/DWAPlannerROS/yaw_goal_tolerance: 0.17
* /move_base/NavfnROS/default_tolerance: 1.0
* /move_base/aggressive_reset/reset_distance: 1.0
* /move_base/base_global_planner: navfn/NavfnROS
* /move_base/base_local_planner: dwa_local_planner...
* /move_base/conservative_reset/reset_distance: 2.0
* /move_base/global_costmap/cost_scaling_radius: 3.0
* /move_base/global_costmap/footprint: [[-0.2, -0.375], ...
* /move_base/global_costmap/global_frame: map
* /move_base/global_costmap/inflation_radius: 0.55
* /move_base/global_costmap/laser_scan_sensor/clearing: True
* /move_base/global_costmap/laser_scan_sensor/data_type: LaserScan
* /move_base/global_costmap/laser_scan_sensor/marking: True
* /move_base/global_costmap/laser_scan_sensor/sensor_frame: lidar_link
* /move_base/global_costmap/laser_scan_sensor/topic: scan
* /move_base/global_costmap/observation_sources: laser_scan_sensor
* /move_base/global_costmap/obstacle_range: 2.5
* /move_base/global_costmap/plugins: [{'name': 'static...
* /move_base/global_costmap/publish_frequency: 0.5
* /move_base/global_costmap/raytrace_range: 1.0
* /move_base/global_costmap/robot_base_frame: base_link
* /move_base/global_costmap/static_map: True
* /move_base/global_costmap/transform_tolerance: 0.5
* /move_base/global_costmap/update_frequency: 5.0
* /move_base/local_costmap/cost_scaling_radius: 3.0
* /move_base/local_costmap/footprint: [[-0.2, -0.375], ...
* /move_base/local_costmap/global_frame: map
* /move_base/local_costmap/height: 6.0
* /move_base/local_costmap/inflation_radius: 0.55
* /move_base/local_costmap/laser_scan_sensor/clearing: True
* /move_base/local_costmap/laser_scan_sensor/data_type: LaserScan
* /move_base/local_costmap/laser_scan_sensor/marking: True
* /move_base/local_costmap/laser_scan_sensor/sensor_frame: lidar_link
* /move_base/local_costmap/laser_scan_sensor/topic: scan
* /move_base/local_costmap/observation_sources: laser_scan_sensor
* /move_base/local_costmap/obstacle_range: 2.5
* /move_base/local_costmap/plugins: [{'name': 'static...
* /move_base/local_costmap/publish_frequency: 2.0
* /move_base/local_costmap/raytrace_range: 1.0
* /move_base/local_costmap/resolution: 0.05
* /move_base/local_costmap/robot_base_frame: base_link
* /move_base/local_costmap/rolling_window: True
* /move_base/local_costmap/track_unknown_space: False
* /move_base/local_costmap/transform_tolerance: 0.5
* /move_base/local_costmap/update_frequency: 5.0
* /move_base/local_costmap/width: 6.0
* /move_base/recovery_behavior_enabled: True
* /move_base/recovery_behaviors: [{'name': 'conser...
* /move_base/rotate_recovery_1/sim_granularity: 0.017
* /move_base/rotate_recovery_2/sim_granularity: 0.017
* /move_base/rotate_recovery_3/sim_granularity: 0.017
* /rosdistro: noetic
* /rosversion: 1.16.0
NODES
/
amcl (amcl/amcl)
map_server (map_server/map_server)
move_base (move_base/move_base)
ROS_MASTER_URI=http://localhost:11311
process[map_server-1]: started with pid [75291]
process[amcl-2]: started with pid [75292]
process[move_base-3]: started with pid [75293]
[ WARN] [1703920320.087000432, 149.521000000]: No laser scan received (and thus no pose updates have been published) for 149.521000 seconds. Verify that data is being published on the /scan topic.
[ WARN] [1703920320.087308022, 149.522000000]: No laser scan received (and thus no pose updates have been published) for 149.522000 seconds. Verify that data is being published on the /scan topic.
[ WARN] [1703920320.087575174, 149.522000000]: Timed out waiting for transform from base_link to map to become available before running costmap, tf error: canTransform: target_frame map does not exist.. canTransform returned after 149.522 timeout was 0.1.
[ WARN] [1703920320.634357520, 150.058000000]: global_costmap: Pre-Hydro parameter "static_map" unused since "plugins" is provided
[ INFO] [1703920320.635526559, 150.060000000]: global_costmap: Using plugin "static_map"
[ INFO] [1703920320.638619829, 150.063000000]: Requesting the map...
[ INFO] [1703920320.844913921, 150.265000000]: Resizing costmap to 384 X 384 at 0.050000 m/pix
[ INFO] [1703920320.944919863, 150.364000000]: Received a 384 X 384 map at 0.050000 m/pix
[ INFO] [1703920320.954511759, 150.373000000]: global_costmap: Using plugin "sensor"
[ INFO] [1703920320.965097755, 150.383000000]: Subscribed to Topics:
[ INFO] [1703920320.981582065, 150.399000000]: global_costmap: Using plugin "inflation"
[ INFO] [1703920321.040844116, 150.457000000]: local_costmap: Using plugin "static_map"
[ INFO] [1703920321.049657182, 150.466000000]: Requesting the map...
[ INFO] [1703920321.051589890, 150.468000000]: Resizing static layer to 384 X 384 at 0.050000 m/pix
[ INFO] [1703920321.153457904, 150.568000000]: Received a 384 X 384 map at 0.050000 m/pix
[ INFO] [1703920321.164096356, 150.579000000]: local_costmap: Using plugin "sensor"
[ INFO] [1703920321.173105716, 150.588000000]: Subscribed to Topics:
[ INFO] [1703920321.186462956, 150.601000000]: local_costmap: Using plugin "inflation"
[ INFO] [1703920321.247968935, 150.661000000]: Created local_planner dwa_local_planner/DWAPlannerROS
[ INFO] [1703920321.252109807, 150.665000000]: Sim period is set to 0.10
[ INFO] [1703920321.450377996, 150.860000000]: Recovery behavior will clear layer 'obstacles'
[ INFO] [1703920321.452541383, 150.862000000]: Recovery behavior will clear layer 'obstacles'
[ INFO] [1703920343.108455716, 172.065000000]: Got new plan
</code></pre>
|
Robot not moving to the goal - diff_drive_controller 4wheel bot
|
<p>I think this is just an array to string problem, there's an array of uint8_t inside the SerializedMessage wrapper:</p>
<pre><code>auto message = std_msgs::msg::String();
message.data = "Hello, world!";
rclcpp::Serialization<std_msgs::msg::String> stringSerializer;
rclcpp::SerializedMessage serialized_msg;
stringSerializer.serialize_message(&message, &serialized_msg);
const auto buffer_begin = serialized_msg.get_rcl_serialized_message().buffer;
const auto buffer_end = buffer_begin + serialized_msg.size();
std::string serialized_msg_str(buffer_begin, buffer_end);
</code></pre>
<p><a href="https://stackoverflow.com/questions/17982752/convert-vector-of-uint8-to-string">https://stackoverflow.com/questions/17982752/convert-vector-of-uint8-to-string</a> and also using <a href="https://stackoverflow.com/questions/77315367/how-to-implement-deserialization-of-ros2-messages">https://stackoverflow.com/questions/77315367/how-to-implement-deserialization-of-ros2-messages</a></p>
|
107346
|
2024-01-01T17:20:26.463
|
|ros2|c++|serialization|
|
<p>I have a simple subscriber to a topic in C++, and am receiving a custom PositionMsg, which includes other custom messages (Velocity, datum, etc). ROS2 handles all that very well, I'm getting the information.</p>
<p>Now I have been told to serialize the message as a string and store it in a database, where it will need to be deserialized later. Is there something in ROS2 that can write it out as a string. I can use Serialization and get back a SerializedMessage, but how do I save that as a std::string? It does not need to be easily human readable as a string, but if it is easier to do in yaml or json, that is fine too.</p>
|
ROS2 Message Serialization to String in C++
|
<p>There's nothing better than spending time to summarize and articulate your question/problem and stumbling upon the solution shortly after.</p>
<p>It turns out that the firmware configure step has a critical message:</p>
<pre class="lang-sh prettyprint-override"><code>$ ros2 run micro_ros_setup configure_firmware.sh ping_pong --transport udp --ip 127.0.0.1 --port 8888
Configuring firmware for zephyr platform host
Configured UDP mode.
Please check firmware/zephyr_apps/microros_extensions/microros_transports.h
for configuring IP and port before build.
</code></pre>
<p>In <code>firmware/zephyr_apps/microros_extensions/microros_transports.h</code>, buried in preprocessor <code>#if/#elif</code> directives there's a set of default transport parameters, one of which specifies the IP address of the micro-ros agent, which in my case was the incorrect one <code>192.168.1.100</code>.</p>
<pre class="lang-c prettyprint-override"><code>#if defined(MICRO_ROS_TRANSPORT_SERIAL)
#define MICRO_ROS_FRAMING_REQUIRED true
// Set the UART used for communication. e.g. {.fd = 0} leads to UART_0 being used.
static zephyr_transport_params_t default_params = {.fd = 0};
#elif defined(MICRO_ROS_TRANSPORT_UDP)
#define MICRO_ROS_FRAMING_REQUIRED false
static zephyr_transport_params_t default_params = {{0,0,0}, "192.168.1.100", "8888"};
#elif defined(MICRO_ROS_TRANSPORT_SERIALUSB)
#define MICRO_ROS_FRAMING_REQUIRED true
static zephyr_transport_params_t default_params;
#endif
</code></pre>
<p>Changing that to <code>127.0.0.1</code> before building fixed my issue:</p>
<pre class="lang-c prettyprint-override"><code> static zephyr_transport_params_t default_params = {{0,0,0}, "127.0.0.1", "8888"};
</code></pre>
<p>Proceeding to build and run the firmware shows working output!</p>
<pre class="lang-sh prettyprint-override"><code># build
$ ros2 run micro_ros_setup build_firmware.sh
# run
$ ros2 run micro_ros_setup flash_firmware.sh
Flashing firmware for zephyr platform host
WARNING: Using a test - not safe - entropy source
*** Booting Zephyr OS build zephyr-v2.6.0 ***
Ping send seq 1734063590_1823552900
Ping send seq 2118534989_1823552900
Ping send seq 1332252450_1823552900
...
</code></pre>
<p>In addition, <code>micro_ros_agent</code> outputs:</p>
<pre class="lang-sh prettyprint-override"><code> ros2 run micro_ros_agent micro_ros_agent udp4 --port 8888
[1704199501.102410] info | UDPv4AgentLinux.cpp | init | running... | port: 8888
[1704199501.102956] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 4
[1704199502.843766] info | Root.cpp | create_client | create | client_key: 0x176AC30B, session_id: 0x81
[1704199502.843832] info | SessionManager.hpp | establish_session | session established | client_key: 0x176AC30B, address: 127.0.0.1:13752
[1704199502.855327] info | ProxyClient.cpp | create_participant | participant created | client_key: 0x176AC30B, participant_id: 0x000(1)
[1704199502.855720] info | ProxyClient.cpp | create_topic | topic created | client_key: 0x176AC30B, topic_id: 0x000(2), participant_id: 0x000(1)
[1704199502.856105] info | ProxyClient.cpp | create_publisher | publisher created | client_key: 0x176AC30B, publisher_id: 0x000(3), participant_id: 0x000(1)
[1704199502.856837] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0x176AC30B, datawriter_id: 0x000(5), publisher_id: 0x000(3)
[1704199502.857028] info | ProxyClient.cpp | create_topic | topic created | client_key: 0x176AC30B, topic_id: 0x001(2), participant_id: 0x000(1)
[1704199502.857303] info | ProxyClient.cpp | create_publisher | publisher created | client_key: 0x176AC30B, publisher_id: 0x001(3), participant_id: 0x000(1)
[1704199502.857844] info | ProxyClient.cpp | create_datawriter | datawriter created | client_key: 0x176AC30B, datawriter_id: 0x001(5), publisher_id: 0x001(3)
[1704199502.858045] info | ProxyClient.cpp | create_topic | topic created | client_key: 0x176AC30B, topic_id: 0x002(2), participant_id: 0x000(1)
[1704199502.858254] info | ProxyClient.cpp | create_subscriber | subscriber created | client_key: 0x176AC30B, subscriber_id: 0x000(4), participant_id: 0x000(1)
[1704199502.859027] info | ProxyClient.cpp | create_datareader | datareader created | client_key: 0x176AC30B, datareader_id: 0x000(6), subscriber_id: 0x000(4)
[1704199502.859370] info | ProxyClient.cpp | create_topic | topic created | client_key: 0x176AC30B, topic_id: 0x003(2), participant_id: 0x000(1)
[1704199502.859639] info | ProxyClient.cpp | create_subscriber | subscriber created | client_key: 0x176AC30B, subscriber_id: 0x001(4), participant_id: 0x000(1)
[1704199502.865308] info | ProxyClient.cpp | create_datareader | datareader created | client_key: 0x176AC30B, datareader_id: 0x001(6), subscriber_id: 0x001(4)
</code></pre>
<p>And a ros2 node is listed:</p>
<pre class="lang-sh prettyprint-override"><code>$ ros2 node list
/pingpong_node
</code></pre>
<p>Along with 2 new topics</p>
<pre class="lang-sh prettyprint-override"><code>$ ros2 topic list
/microROS/ping
/microROS/pong
/parameter_events
/rosout
</code></pre>
|
107360
|
2024-01-02T12:06:43.860
|
|ros2|ros-humble|micro-ros|
|
<p>This is my first time setting up a micro-ROS and a ROS 2 dev environment, so I suspect there may be something obvious that I'm missing.</p>
<p>I'm attempting to run the Zephyr host emulator example in the micro-ROS tutorial <a href="https://micro.ros.org/docs/tutorials/core/zephyr_emulator/" rel="nofollow noreferrer">here</a> with ROS2 humble.</p>
<p>Effectively, I've installed <code>micro_ros_setup</code>, created/configured/built the firmware and installed <code>micro_ros_agent</code>. Then, when I run the zephyr app I see the error listed in the title, and I don't see any change in the output of the micro-ROS agent.</p>
<p>What I <em>think</em> I'm encountering is that the Zephyr app is unable to reach the micro-ROS agent, thus the "Failed status" error message.</p>
<p>From a third terminal I can see the port with <code>netstat</code>, so I don't believe this is a firewall issue since the host emulator and micro-ros agent are both running on the same machine.</p>
<pre class="lang-sh prettyprint-override"><code>$ sudo netstat -tulpn | grep 8888
udp 0 0 0.0.0.0:8888 0.0.0.0:* 78240/micro_ros_age
</code></pre>
<p>Inspecting the source code at <code>firmware/zephyr_apps/apps/ping_pong/src/main.c</code>, line 98, it appears as though <code>rclc_support_init()</code> is failing.</p>
<pre class="lang-c prettyprint-override"><code> // create init_options
RCCHECK(rclc_support_init(&support, 0, NULL, &allocator));
</code></pre>
<p>Additionally, <strong>should I see a node running and new topics listed when I run the micro-ROS agent?</strong> I'm seeing neither and I wonder if that's the reason:</p>
<pre class="lang-sh prettyprint-override"><code>$ ros2 topic list
/parameter_events
/rosout
</code></pre>
<pre class="lang-sh prettyprint-override"><code>$ ros2 node list
</code></pre>
<h3>Zephyr Tutorial</h3>
<p>Below is a summary of Zephyr micro-ROS tutorial to show where I'm at and how I got here.</p>
<p>Start with micro_ros_setup</p>
<pre class="lang-sh prettyprint-override"><code>source /opt/ros/humble/setup.bash
# install micro_ros_setup in new workspace
git clone -b $ROS_DISTRO https://github.com/micro-ROS/micro_ros_setup.git src/micro_ros_setup
# rosdep & pip
sudo apt update && rosdep update
rosdep install --from-paths src --ignore-src -y
sudo apt-get install python3-pip
# build micro_ros_setup and source it
colcon build
source install/local_setup.bash
</code></pre>
<p>Then the firmware workspace</p>
<pre class="lang-sh prettyprint-override"><code># create fw ws
ros2 run micro_ros_setup create_firmware_ws.sh zephyr host
# configure build
ros2 run micro_ros_setup configure_firmware.sh ping_pong --transport udp --ip 127.0.0.1 --port 8888
# build it
ros2 run micro_ros_setup build_firmware.sh
</code></pre>
<p>Next, the micro-ROS agent</p>
<pre class="lang-sh prettyprint-override"><code># create agent ws
ros2 run micro_ros_setup create_agent_ws.sh
# build it
ros2 run micro_ros_setup build_agent.sh
source install/local_setup.bash
</code></pre>
<p>Then I setup 2 terminals, terminal 1 running the micro-ROS agent and terminal 2 running the Zephyr app.</p>
<h4>Terminal 1:</h4>
<pre class="lang-sh prettyprint-override"><code>$ source /opt/ros/humble/setup.bash
$ source install/local_setup.bash
$ ros2 run micro_ros_agent micro_ros_agent udp4 --port 8888
[1704166624.989047] info | UDPv4AgentLinux.cpp | init | running... | port: 8888
[1704166624.989864] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 4
</code></pre>
<h4>Terminal 2</h4>
<pre class="lang-sh prettyprint-override"><code>$ source /opt/ros/humble/setup.bash
$ source install/local_setup.bash
$ ros2 run micro_ros_setup flash_firmware.sh
Flashing firmware for zephyr platform host
WARNING: Using a test - not safe - entropy source
*** Booting Zephyr OS build zephyr-v2.6.0 ***
Failed status on line 98: 1. Aborting.
</code></pre>
|
Error message "Failed status on line 98: 1. Aborting" while running zephyr host emulator
|
<p>Without new input data the ekf_localization node will simply continue to run its estimate that is based on the previous sensor data. The issue with the plus or minus Z drift is most likely a result of small acceleration errors from the IMU that accumulate into larger velocities. Some of this may be fixable using the <a href="http://docs.ros.org/en/melodic/api/robot_localization/html/state_estimation_nodes.html#dynamic-process-noise-covariance" rel="nofollow noreferrer">~dynamic_process_noise_covariance</a> parameter but otherwise it's the intended behavior of the ekf_localization node.</p>
<p>There are a few options you can try to deal with this issue:</p>
<ul>
<li>Remove the integration of the accelerometer's Z acceleration component. The RL gravitational acceleration removal (<code>~imuN_remove_gravitational_acceleration</code>) depends on the orientation of the IMU and results in a noisy acceleration value.</li>
<li>Decrease the process noise of the linear acceleration values in your <code>process_noise_covariance</code> matrix. Alternatively you can re-write the covariance field of the Imu message and increase the corresponding fields for linear acceleration. Higher variances in the sensor readings result in slower integration of the readings, for noisy sensor measurements this is preferred. It's generally not preferred to have 0 variances on the diagonal of the sensor readings, this results in the ekf_localization node <a href="https://answers.ros.org/question/353624/what-is-the-default-noise-parameters-in-sensor-inputs-in-robot_localization/" rel="nofollow noreferrer">populating the measurement variances with 1e-9</a> to keep the filter stable.</li>
<li>Use the <code>use_sim_time</code> parameter. When playing data from a ROS bag file, you can use the time information from the bag to drive your system instead of your system clock (<a href="https://answers.ros.org/question/288672/how-use_sim_time-works/" rel="nofollow noreferrer">read more here</a>). When the bag ends, the clock will stop, and your localization node will stop producing new estimates. This doesn't solve the issue, it will only <em>mask it</em>, but in my experience it's the best way to test localization on bag data.</li>
</ul>
|
107366
|
2024-01-02T15:38:06.647
|
|robot-localization|ekf-localization-node|
|
<p>I'm working on building a good Odometry estimation system for a quadruped Unitree robot (A1 and Go1). I've been trying to use ekf_localization node from the robot_localization package in ROS Melodic. Almost everything seems to work fine when I feed in sensor data through a rosbag, in the sense that, I'm able to get the fused odometry messages from the filter that correspond well with the ground truth.</p>
<p><strong>Issue:</strong>
But when my rosbag stops and none of the odometry and imu sources publish messages anymore, the node still keeps running and gives me erroneous results (basically a drift of the odometry in -ve z-direction). This happens at the end if I set <em>imu0_remove_gravitational_acceleration: true</em> and happens in the +ve z-direction if I set it to <em>false</em>.</p>
<p><strong>Odometry sources and sensors:</strong>
A VIO pipeline and a leg Odometry that returns linear velocity estimate from a RL controller. I use a single IMU source (publishes at 200Hz) and VIO runs on this IMU and a stereo Realsense d435i camera (realsense's imu not used). I re-publish all these messages at the same rate in the <em><strong>odom</strong></em> frame with child_frame_id as <em><strong>base_link</strong></em> for all the odometry sources.</p>
<p>I'm adding my config files for the ekf_localization node.</p>
<pre><code>frequency: 50
sensor_timeout: 1
two_d_mode: false # The robodog can also climb over steps
publish_tf: true
transform_time_offset: 0.0 # For packages that require transforms to be future-dated by a small time offset
# transform_timeout: 0.0 # Zero to get the latest transform available and not block the filter
reset_on_time_jump: false # Reset the filter if a sudden time jump is detected
print_diagnostics: true # Print diagnostics information to the /diagnostics topic
predict_to_current_time: false # Extrapolate (predict) the state to the current time when no measurements received
disabled_at_startup: false # Start the filter as disabled
publish_null_when_lost: false
odom_frame: odom
base_link_frame: base_link
world_frame: odom
publish_acceleration: false
lo_topic: &lo_topic /ekf_vilo/leg_odom
odom0: *lo_topic
odom0_config: [false, false, false, # Position
false, false, false, # Orientation
true, true, true, # Linear velocity
false, false, false, # Angular velocity
false, false, false] # Linear acceleration
odom0_differential: false
odom0_relative: false
odom0_queue_size: 100
odom0_nodelay: true
vio_topic: &vio_topic /ekf_vilo/vins_odom
odom1: *vio_topic
odom1_config: [true, true, true, # Position
true, true, true, # Orientation
false, false, false,
false, false, false,
false, false, false]
odom1_differential: false
odom1_relative: false
odom1_queue_size: 100
odom1_nodelay: true
imu0_remove_gravitational_acceleration: true
gravitational_acceleration: 9.81
imu_topic: &imu_topic /imu
imu0: *imu_topic
imu0_config: [false, false, false,
true, true, true, # Orientation
false, false, false,
true, true, true, # Angular velocity
true, true, true] # Linear acceleration
imu0_differential: false
imu0_relative: false
imu0_queue_size: 100
imu0_nodelay: true
process_noise_covariance: [0.025, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0.025, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0.025, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0.05, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0.05, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0.05, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0.025, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0.025, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0.04, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.02, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.015]
initial_estimate_covariance: [1e-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1e-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1e-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1e-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1e-2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1e-2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1e-6, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1e-6, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1e-6, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 1e-6, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1e-6, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1e-6, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1e-6, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1e-6, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1e-6]
</code></pre>
<p>Each odometry and sensor messages are as follows:</p>
<ol>
<li>Fused odometry from the ekf (Message from /ekf_vilo/odom)
<a href="https://i.stack.imgur.com/Pv8s8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Pv8s8.png" alt="Message from /ekf_vilo/odom" /></a></li>
<li>Imu messages (Message from /imu)
<a href="https://i.stack.imgur.com/D0k2g.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D0k2g.png" alt="Message from /imu" /></a></li>
<li>VIO odometry (Message from /ekf_vilo/vins_odom)
<a href="https://i.stack.imgur.com/kHP5p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kHP5p.png" alt="Message from /ekf_vilo/vins_odom" /></a></li>
<li>Odometry from the leg (Message from /ekf_vilo/leg_odom)
<a href="https://i.stack.imgur.com/ozk7y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ozk7y.png" alt="Message from /ekf_vilo/leg_odom" /></a></li>
</ol>
<ul>
<li>This is what happens when the IMU and the odometry sources (/ekf_vilo/vins_odom and /ekf_vilo/leg_odom) publish messages : The covariances are small and the fusion is good</li>
</ul>
<p><a href="https://i.stack.imgur.com/rE1Wx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rE1Wx.png" alt="enter image description here" /></a></p>
<ul>
<li>This is what happens when the rosbag ends (and the covariances start to explode)</li>
</ul>
<p><a href="https://i.stack.imgur.com/EFLZe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EFLZe.png" alt="enter image description here" /></a></p>
<ul>
<li>The odometry from ekf after the rosbag has ended (the odometry keeps drifting in the -ve z-direction)</li>
</ul>
<p><a href="https://i.stack.imgur.com/XNtX8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XNtX8.png" alt="enter image description here" /></a></p>
<p>I apologize for the extremely long message. Just wanted to be thorough!</p>
|
EKF localization node in robot_localization package doesn't stop
|
<p>For Gazebo Fortress, you should use the command <code>ign gazebo shapes.sdf</code>. For Gazebo Garden and newer, you can use <code>gz sim ...</code>. This is because the Gazebo project changed names from Ignition to Gazebo after Fortress was released.</p>
|
107374
|
2024-01-02T21:33:15.397
|
|gazebo|installation|ignition-fortress|
|
<p>I installed Gazebo Fortress following the instructions <a href="https://gazebosim.org/docs/fortress/install_ubuntu" rel="nofollow noreferrer">here</a> on my laptop with Ubuntu 22.04. I was able to install it without any problems & I could see the app installed with the name <code>Ignition Gazebo 6</code>. I am able to spawn it and run shapes.sdf file.</p>
<p>But when I try to spawn it using <code>gz sim shapes.sdf</code> from <a href="https://gazebosim.org/docs/harmonic/getstarted#step-2-run" rel="nofollow noreferrer">here</a>, it doesn't work. Here's the output I get:</p>
<pre><code>This tool modifies various aspects of a running Gazebo simulation.
Usage: gz <command>
List of commands:
help Print this help text.
camera Control a camera
debug Returns completion list for a command. Used for bash completion.
help Outputs information about a command
joint Modify properties of a joint
log Introspects and manipulates Gazebo log files.
marker Add, modify, or delete visual markers
model Modify properties of a model
physics Modify properties of the physics engine
sdf Converts between SDF versions, and provides info about SDF files
stats Print statistics about a running gzserver instance.
topic Lists information about topics on a Gazebo master
world Modify world properties
Use "gz help <command>" to print help for a command.
</code></pre>
|
Unable to spawn Gazebo from terminal
|
<blockquote>
<p>and what is the difference between following code compared to above snippet? example code snippet_2</p>
</blockquote>
<p>As explained in the ROS 2 Documentation page, "The call to spin(node) basically expands to an instantiation and invocation of the Single-Threaded Executor, which is the simplest Executor." The example was provided to show that <strong><em>both the code snippets do the same thing under the hood</em></strong>. When you call the spin() function on a node, it creates a SingleThreadedExecutor, adds the node to the executor, and spins it. But, when you call <code>rclcpp::spin(node)</code>, you are abstracted from this information, and you have a much simpler interface to deal with.</p>
<p>If you want to know more about scheduling in general, I will suggest that you read up on multi-threading in Operating Systems, and how task scheduling occurs. You will find that a lot of the design principles with use of executors will be clearer once you understand how an operating system manages multi tasking.</p>
<p>As a helpful resource focusing mainly on the ROS side of things, I point you to William Woodall's presentation on <a href="https://youtu.be/7_26inaLeYM" rel="nofollow noreferrer">Execution in ROS 2</a>.</p>
<blockquote>
<p>My second question is regarding callback groups: What does the following statement mean? In what scenario do we create the callback group (and not just callback function)?</p>
</blockquote>
<p>A callback function is more related to the data-exchange side of ROS 2. A callback function defines what is to be done when we receive data on a topic/we exhaust a timer, and so on. One can have multiple callback functions executing in one ROS 2 node. If you call <code>rclcpp::spin(node)</code>, it is effectively expanded to creating a SingleThreadedExecutor, adding the node to it, and spinning the node. Think of it as you having only one process running on your computer.</p>
<p>When you are running a MultiThreaded Executor, e.g., a web app on one thread, and the corresponding ROS node on the other thread, you can choose to offload some processing of callbacks on the rather light web app thread, compared to the ROS node thread, which will likely be busier, and might not be able to process all callbacks in the given time. This also indirectly contributes to ROS 2 being able to run Real-Time Systems, where missing a deadline leads to system failure.</p>
|
107389
|
2024-01-03T09:04:14.040
|
|ros2|ros-humble|callback|
|
<p>I am learning ROS2 Humble and would like to learn more about executors, and callbackgroup.</p>
<p>my first question is:
"What if we use basic spin and executor? How would it affect things?"
example code snippet 1:</p>
<pre><code>int main(int argc, char* argv[])
{
// Some initialization.
rclcpp::init(argc, argv);
...
// Instantiate a node.
rclcpp::Node::SharedPtr node = ...
// Run the executor.
rclcpp::spin(node);
// Shutdown and exit.
...
return 0;
}
</code></pre>
<p>and what is the difference between following code compared to above snippet?
example code snippet_2:</p>
<pre><code>rclcpp::executors::SingleThreadedExecutor executor;
executor.add_node(node);
executor.spin();
</code></pre>
<p>My second question is regarding callback groups:
What does the following statement mean? In what scenario do we create the callback group (and not just callback function)?</p>
<p>"ROS 2 allows organizing the callbacks of a node in groups. In rclcpp, such a callback group can be created by the create_callback_group function of the Node class."</p>
<p><a href="https://docs.ros.org/en/humble/Concepts/Intermediate/About-Executors.html#:%7E:text=ROS%202%20allows%20organizing%20the%20callbacks%20of%20a%20node%20in%20groups.%20In%20rclcpp%2C%20such%20a%20callback%20group%20can%20be%20created%20by%20the%20create_callback_group%20function%20of%20the%20Node%20class" rel="nofollow noreferrer">https://docs.ros.org/en/humble/Concepts/Intermediate/About-Executors.html#:~:text=ROS%202%20allows%20organizing%20the%20callbacks%20of%20a%20node%20in%20groups.%20In%20rclcpp%2C%20such%20a%20callback%20group%20can%20be%20created%20by%20the%20create_callback_group%20function%20of%20the%20Node%20class</a></p>
<p>I would appreciate the time and effort anyone put into answering this question, as I know it would be a long answer. Thank you!</p>
|
what is executors, and callbackgroup in ROS2?
|
<p>Ok, I found the problem and solution. I think that this needs to be included on ros2 docker page because there are a lot of people struggled with this.
It's ros2 trying to use shared memory between docker and host (because of net=host it thinks that it's the same computer). The problem is docker and host are not running on the same user. So, the solution is sharing the host user or disable share memory:
<a href="https://stackoverflow.com/questions/65900201/troubles-communicating-with-ros2-node-in-docker-container">https://stackoverflow.com/questions/65900201/troubles-communicating-with-ros2-node-in-docker-container</a></p>
|
107395
|
2024-01-03T12:30:48.173
|
|ros2|docker|
|
<p>I'm using <a href="https://github.com/KumarRobotics/ublox" rel="nofollow noreferrer">Kumar's driver's</a> for ublox f9p GPS on a jetson nano with ubuntu 20.04 and ros foxy. I connect the GPS to USB and it is assigned to ttyACM1. I can ros2 launch and get fix messages, so it is working ok here.
Now I'm moving to Docker:</p>
<p>My dockerfile:</p>
<pre><code>FROM ros:humble-ros-base
RUN mkdir -p /ublox_ws/src
WORKDIR /ublox_ws
RUN git -C src clone -b ros2 https://github.com/KumarRobotics/ublox.git
COPY f9p.launch.py src/ublox/ublox_gps/launch
COPY zed_f9p.yaml src/ublox/ublox_gps/config
RUN apt update \
&& apt install -y python3-pip \
&& . /opt/ros/$ROS_DISTRO/setup.sh \
# && sudo rosdep fix-permissions \
&& rosdep update \
&& rosdep install --from-paths src --ignore-src -y \
&& colcon build \
# && .install/setup.sh \
&& apt autoremove -y \
# && rm -rf log/ build/ src/* \
&& rm -rf /var/lib/apt/lists/*
COPY ros_entrypoint.sh /
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["bash"]
</code></pre>
<p>f9p.launch.py</p>
<pre><code>import os
import ament_index_python.packages
import launch
from launch_ros.actions import Node
def generate_launch_description():
config_directory = os.path.join(
ament_index_python.packages.get_package_share_directory('ublox_gps'),
'config')
params = os.path.join(config_directory, 'zed_f9p.yaml')
ublox_gps_node = Node(package='ublox_gps',
executable='ublox_gps_node',
output='screen',
parameters=[params],
# remappings=[('/fix', '/gps/fix'),]
)
return launch.LaunchDescription(
[ublox_gps_node,
launch.actions.RegisterEventHandler(
event_handler=launch.event_handlers.OnProcessExit(
target_action=ublox_gps_node,
on_exit=[launch.actions.EmitEvent(event=launch.events.Shutdown())],
)
),
])
</code></pre>
<p>zed_f9p.yaml</p>
<pre><code>ublox_gps_node:
ros__parameters:
debug: 4 # Range 0-4 (0 means no debug statements will print)
device: /dev/ttyACM1
frame_id: gps
config_on_startup: false
uart1:
baudrate: 38400
gnss:
glonass: false
beidou: false
gps: true
qzss: false
galileo: false
imes: false
# TMODE3 Config
tmode3: 1 # Survey-In Mode
# sv_in:
# reset: True # True: disables and re-enables survey-in (resets)
# # False: Disables survey-in only if TMODE3 is
# # disabled
# min_dur: 300 # Survey-In Minimum Duration [s]
# acc_lim: 3.0 # Survey-In Accuracy Limit [m]
inf:
all: true # Whether to display all INF messages in console
publish:
all: false
# nav:
# all: true
# relposned: true
# posllh: true
# posecef: true
</code></pre>
<p>I build it with:
<code> docker build . -t ublox_gps</code>
and running it with:
<code>docker run -it --rm --net=host --device=/dev/ttyACM1 ublox_gps:latest /bin/bash</code></p>
<p>once inside the container I run: <code> ros2 launch ublox_gps f9p.launch.py</code></p>
<p>and on my host computer <code>ros2 topic list </code> and there is no fix topic published.
as I enabled debug messages on the config file I can see this INF messages on driver startup:</p>
<pre><code>root@nano:/ublox_ws# ros2 launch ublox_gps f9p.launch.py
[INFO] [launch]: All log files can be found below /root/.ros/log/2024-01-03-12-16-23-433919-nano-62
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [ublox_gps_node-1]: process started with pid [63]
[ublox_gps_node-1] [INFO] [1704284183.931021489] [ublox_gps_node]: U-Blox: Opened serial port /dev/ttyACM1
[ublox_gps_node-1] [DEBUG] [1704284183.933363780] [ublox_gps_node]: U-Blox sent 8 bytes:
[ublox_gps_node-1] b5 62 a 4 0 0 e 34
[ublox_gps_node-1] [DEBUG] [1704284183.934180100] [ublox_gps_node]: U-Blox received 128 bytes
[ublox_gps_node-1] b5 62 a 4 dc 0 45 58 54 20 43 4f 52 45 20 31 2e 30 30 20 28 66 31 30 63 33 36 29 0 0 0 0 0 0 0 0 30 30 31 39 30 30 30 30 0 0 52 4f 4d 20 42 41 53 45 20 30 78 31 31 38 42 32 30 36 30 0 0 0 0 0 0 0 0 0 0 0 46 57 56 45 52 3d 48 50 47 20 31 2e 31 33 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 52 4f 54 56 45 52 3d 32 37 2e 31 32 0 0 0 0 0 0 0 0 0
[ublox_gps_node-1] [DEBUG] [1704284183.934492554] [ublox_gps_node]: U-Blox received 100 bytes
[ublox_gps_node-1] 0 0 0 0 0 0 0 0 4d 4f 44 3d 5a 45 44 2d 46 39 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 47 50 53 3b 47 4c 4f 3b 47 41 4c 3b 42 44 53 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 53 42 41 53 3b 51 5a 53 53 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f3 b0
[ublox_gps_node-1] [DEBUG] [1704284183.935095484] [ublox_gps_node]: U-Blox received 279 bytes
[ublox_gps_node-1] b5 62 1 7 5c 0 ac 8b 15 12 e8 7 1 3 c 10 17 37 19 0 0 0 e1 ac a1 35 3 1 ea f e4 3e 33 dc 61 18 7 ec ca d5 0 0 95 94 0 0 35 5 0 0 80 9 0 0 2f 0 0 0 14 0 0 0 14 0 0 0 33 0 0 0 ec d 23 2 e4 0 0 0 80 a8 12 1 ad 0 0 0 6c 18 42 3e 0 0 0 0 0 0 0 0 38 f 24 47 4e 52 4d 43 2c 31 32 31 36 32 33 2e 39 30 2c 41 2c 33 33 33 30 2e 34 37 35 39 36 2c 53 2c 30 36 30 30 33 2e 37 32 38 30 34 2c 57 2c 30 2e 31 30 30 2c 2c 30 33 30 31 32 34 2c 2c 2c 41 2c 56 2a 31 34 d a 24 47 4e 56 54 47 2c 2c 54 2c 2c 4d 2c 30 2e 31 30 30 2c 4e 2c 30 2e 31 38 35 2c 4b 2c 41 2a 33 30 d a 24 47 4e 47 47 41 2c 31 32 31 36 32 33 2e 39 30 2c 33 33 33 30 2e 34 37 35 39 36 2c 53 2c 30 36 30 30 33 2e 37 32 38 30 34 2c 57 2c 31 2c 31 32 2c 30 2e 37 33 2c 33 38 2e 30 2c 4d 2c 31 36 2e 37 2c 4d 2c 2c 2a 37 42 d a
[ublox_gps_node-1] [INFO] [1704284183.935094963] [ublox_gps_node]: EXT CORE 1.00 (f10c36), HW VER: 00190000
[ublox_gps_node-1] [DEBUG] [1704284183.935447992] [ublox_gps_node]: ROM BASE 0x118B2060
[ublox_gps_node-1] [DEBUG] [1704284183.935519191] [ublox_gps_node]: FWVER=HPG 1.13
[ublox_gps_node-1] [DEBUG] [1704284183.935531171] [ublox_gps_node]: U-Blox received 306 bytes
[ublox_gps_node-1] 24 47 4e 47 53 41 2c 41 2c 33 2c 32 38 2c 31 38 2c 32 33 2c 33 31 2c 30 35 2c 32 35 2c 32 39 2c 2c 2c 2c 2c 2c 31 2e 37 33 2c 30 2e 37 33 2c 31 2e 35 37 2c 31 2a 30 41 d a 24 47 4e 47 53 41 2c 41 2c 33 2c 37 35 2c 38 35 2c 37 33 2c 2c 2c 2c 2c 2c 2c 2c 2c 2c 31 2e 37 33 2c 30 2e 37 33 2c 31 2e 35 37 2c 32 2a 30 42 d a 24 47 4e 47 53 41 2c 41 2c 33 2c 32 35 2c 33 36 2c 31 32 2c 31 30 2c 32 34 2c 2c 2c 2c 2c 2c 2c 2c 31 2e 37 33 2c 30 2e 37 33 2c 31 2e 35 37 2c 33 2a 30 37 d a 24 47 50 47 53 56 2c 32 2c 31 2c 30 38 2c 30 35 2c 33 30 2c 31 32 34 2c 32 33 2c 31 32 2c 30 37 2c 30 34 30 2c 31 32 2c 31 38 2c 37 35 2c 32 36 38 2c 32 31 2c 32 33 2c 32 39 2c 30 30 39 2c 31 37 2c 31 2a 36 44 d a 24 47 50 47 53 56 2c 32 2c 32 2c 30 38 2c 32 35 2c 34 31 2c 30 33 31 2c 32 34 2c 32 38 2c 32 35 2c 33 30 32 2c 33 31 2c 32 39 2c 35 32 2c 31 33 31 2c 33 34 2c 33 31 2c 32 38 2c 32 37 32 2c 32 32 2c 31 2a 36 33 d a
[ublox_gps_node-1] [DEBUG] [1704284183.935604141] [ublox_gps_node]: PROTVER=27.12
[ublox_gps_node-1] [DEBUG] [1704284183.935728206] [ublox_gps_node]: MOD=ZED-F9P
[ublox_gps_node-1] [DEBUG] [1704284183.935768884] [ublox_gps_node]: GPS;GLO;GAL;BDS
[ublox_gps_node-1] [DEBUG] [1704284183.935780707] [ublox_gps_node]: U-Blox received 33 bytes
[ublox_gps_node-1] 24 47 50 47 53 56 2c 31 2c 31 2c 30 31 2c 31 32 2c 30 37 2c 30 34 30 2c 31 35 2c 35 2a 35 35 d a
[ublox_gps_node-1] [DEBUG] [1704284183.936009098] [ublox_gps_node]: U-Blox received 118 bytes
[ublox_gps_node-1] 24 47 50 47 53 56 2c 32 2c 31 2c 30 36 2c 31 38 2c 37 35 2c 32 36 38 2c 33 32 2c 32 33 2c 32 39 2c 30 30 39 2c 32 31 2c 32 35 2c 34 31 2c 30 33 31 2c 31 37 2c 32 36 2c 33 36 2c 32 32 38 2c 32 31 2c 36 2a 36 43 d a 24 47 50 47 53 56 2c 32 2c 32 2c 30 36 2c 32 38 2c 32 35 2c 33 30 32 2c 32 37 2c 33 31 2c 32 38 2c 32 37 32 2c 31 38 2c 36 2a 36 41 d a
[ublox_gps_node-1] [DEBUG] [1704284183.936199883] [ublox_gps_node]: U-Blox received 123 bytes
[ublox_gps_node-1] 24 47 50 47 53 56 2c 31 2c 31 2c 30 34 2c 31 30 2c 30 31 2c 33 34 38 2c 2c 31 35 2c 30 32 2c 30 36 39 2c 2c 31 36 2c 31 32 2c 32 32 32 2c 2c 32 30 2c 30 31 2c 31 34 36 2c 2c 30 2a 36 31 d a 24 47 4c 47 53 56 2c 31 2c 31 2c 30 33 2c 37 33 2c 32 36 2c 30 30 35 2c 32 38 2c 37 35 2c 34 31 2c 32 32 32 2c 32 37 2c 38 35 2c 33 38 2c 32 36 32 2c 32 36 2c 31 2a 34 30 d a
[ublox_gps_node-1] [DEBUG] [1704284183.935830917] [ublox_gps_node]: SBAS;QZSS
[ublox_gps_node-1] [DEBUG] [1704284183.936488223] [ublox_gps_node]: U-Blox received 136 bytes
[ublox_gps_node-1] 24 47 4c 47 53 56 2c 31 2c 31 2c 30 34 2c 36 39 2c 31 34 2c 30 37 39 2c 32 31 2c 37 33 2c 32 36 2c 30 30 35 2c 32 37 2c 37 35 2c 34 31 2c 32 32 32 2c 32 33 2c 38 35 2c 33 38 2c 32 36 32 2c 31 35 2c 33 2a 37 39 d a 24 47 4c 47 53 56 2c 32 2c 31 2c 30 35 2c 36 38 2c 31 32 2c 31 32 37 2c 2c 37 34 2c 36 34 2c 33 32 32 2c 2c 38 33 2c 30 32 2c 31 32 38 2c 2c 38 34 2c 34 39 2c 31 37 34 2c 2c 30 2a 37 35 d a
[ublox_gps_node-1] [DEBUG] [1704284183.936693227] [ublox_gps_node]: U-Blox received 31 bytes
[ublox_gps_node-1] 24 47 4c 47 53 56 2c 32 2c 32 2c 30 35 2c 38 34 2c 34 39 2c 31 37 34 2c 2c 30 2a 34 46 d a
[ublox_gps_node-1] [DEBUG] [1704284183.936928128] [ublox_gps_node]: U-Blox received 203 bytes
[ublox_gps_node-1] 24 47 41 47 53 56 2c 31 2c 31 2c 30 34 2c 31 38 2c 34 37 2c 31 30 39 2c 32 31 2c 32 34 2c 35 30 2c 30 33 32 2c 32 31 2c 32 35 2c 37 31 2c 32 33 36 2c 33 30 2c 33 36 2c 33 38 2c 33 30 30 2c 32 37 2c 32 2a 37 46 d a 24 47 41 47 53 56 2c 32 2c 31 2c 30 37 2c 31 30 2c 35 35 2c 31 34 38 2c 33 30 2c 31 32 2c 33 31 2c 31 33 38 2c 31 37 2c 31 38 2c 34 37 2c 31 30 39 2c 32 38 2c 32 34 2c 35 30 2c 30 33 32 2c 32 37 2c 37 2a 37 41 d a 24 47 41 47 53 56 2c 32 2c 32 2c 30 37 2c 32 35 2c 37 31 2c 32 33 36 2c 32 33 2c 33 31 2c 30 32 2c 30 33 38 2c 31 31 2c 33 36 2c 33 38 2c 33 30 30 2c 31 37 2c 37 2a 34 33 d a
[ublox_gps_node-1] [DEBUG] [1704284183.937139278] [ublox_gps_node]: U-Blox received 94 bytes
[ublox_gps_node-1] 24 47 41 47 53 56 2c 31 2c 31 2c 30 32 2c 30 32 2c 32 30 2c 32 32 32 2c 2c 31 31 2c 37 38 2c 32 30 38 2c 2c 30 2a 37 31 d a 24 47 4e 47 4c 4c 2c 33 33 33 30 2e 34 37 35 39 36 2c 53 2c 30 36 30 30 33 2e 37 32 38 30 34 2c 57 2c 31 32 31 36 32 33 2e 39 30 2c 41 2c 41 2a 37 32 d a
[ublox_gps_node-1] [DEBUG] [1704284183.937310584] [ublox_gps_node]: U-Blox received 72 bytes
[ublox_gps_node-1] b5 62 1 3c 40 0 1 0 0 0 ac 8b 15 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 dd d9 [ublox_gps_node-1] [INFO] [1704284183.943404466] [ublox_gps_node]: U-Blox Firmware Version: 9
[ublox_gps_node-1] [INFO] [1704284183.945315133] [ublox_gps_node]: U-Blox configured successfully.
[ublox_gps_node-1] [DEBUG] [1704284183.945396853] [ublox_gps_node]: Subscribing to U-Blox messages
[ublox_gps_node-1] [DEBUG] [1704284183.945785403] [ublox_gps_node]: Setting rate 0x01, 0x07, 1
[ublox_gps_node-1] [DEBUG] [1704284183.945990616] [ublox_gps_node]: Waiting for ACK 0x06 / 0x01
[ublox_gps_node-1] [DEBUG] [1704284183.946135828] [ublox_gps_node]: U-Blox sent 11 bytes:
[ublox_gps_node-1] b5 62 6 1 3 0 1 7 1 13 51
[ublox_gps_node-1] [DEBUG] [1704284183.946389062] [ublox_gps_node]: U-Blox received 10 bytes
[ublox_gps_node-1] b5 62 5 1 2 0 6 1 f 38
[ublox_gps_node-1] [DEBUG] [1704284183.946568806] [ublox_gps_node]: U-blox: received ACK: 0x06 / 0x01
[ublox_gps_node-1] [DEBUG] [1704284183.947036733] [ublox_gps_node]: Setting rate 0x01, 0x3c, 1
[ublox_gps_node-1] [DEBUG] [1704284183.947196423] [ublox_gps_node]: Waiting for ACK 0x06 / 0x01
[ublox_gps_node-1] [DEBUG] [1704284183.947273196] [ublox_gps_node]: U-Blox sent 11 bytes:
[ublox_gps_node-1] b5 62 6 1 3 0 1 3c 1 48 bb
[ublox_gps_node-1] [DEBUG] [1704284183.947922064] [ublox_gps_node]: U-Blox received 10 bytes
[ublox_gps_node-1] b5 62 5 1 2 0 6 1 f 38
[ublox_gps_node-1] [DEBUG] [1704284183.948054307] [ublox_gps_node]: U-blox: received ACK: 0x06 / 0x01
[ublox_gps_node-1] [DEBUG] [1704284183.948741717] [ublox_gps_node]: Configuring INF messages
[ublox_gps_node-1] [DEBUG] [1704284183.949149330] [ublox_gps_node]: Waiting for ACK 0x06 / 0x02
[ublox_gps_node-1] [DEBUG] [1704284183.949326678] [ublox_gps_node]: U-Blox sent 28 bytes:
[ublox_gps_node-1] b5 62 6 2 14 0 0 0 0 0 f f f f f f 1 0 0 0 f f f f f f d1 7a
[ublox_gps_node-1] [DEBUG] [1704284183.949636372] [ublox_gps_node]: U-Blox received 10 bytes
[ublox_gps_node-1] b5 62 5 1 2 0 6 2 10 39
[ublox_gps_node-1] [DEBUG] [1704284183.949748041] [ublox_gps_node]: U-blox: received ACK: 0x06 / 0x02
[ublox_gps_node-1] [DEBUG] [1704284184.036972589] [ublox_gps_node]: U-Blox received 205 bytes
[ublox_gps_node-1] b5 62 1 7 5c 0 10 8c 15 12 e8 7 1 3 c 10 18 37 19 0 0 0 c9 c3 fc ff 3 1 ea f e4 3e 33 dc 60 18 7 ec ac d5 0 0 77 94 0 0 35 5 0 0 80 9 0 0 17 0 0 0 10 0 0 0 1b 0 0 0 1b 0 0 0 ec d 23 2 cf 0 0 0 80 a8 12 1 ad 0 0 0 6c 18 42 3e 0 0 0 0 0 0 0 0 43 9d 24 47 4e 52 4d 43 2c 31 32 31 36 32 34 2e 30 30 2c 41 2c 33 33 33 30 2e 34 37 35 39 37 2c 53 2c 30 36 30 30 33 2e 37 32 38 30 34 2c 57 2c 30 2e 30 35 33 2c 2c 30 33 30 31 32 34 2c 2c 2c 41 2c 56 2a 31 43 d a 24 47 4e 56 54 47 2c 2c 54 2c 2c 4d 2c 30 2e 30 35 33 2c 4e 2c 30 2e 30 39 39 2c 4b 2c 41 2a 33 42 d a
[ublox_gps_node-1] [DEBUG] [1704284184.040197033] [ublox_gps_node]: U-Blox received 1190 bytes
[ublox_gps_node-1] 24 47 4e 47 47 41 2c 31 32 31 36 32 34 2e 30 30 2c 33 33 33 30 2e 34 37 35 39 37 2c 53 2c 30 36 30 30 33 2e 37 32 38 30 34 2c 57 2c 31 2c 31 32 2c 30 2e 37 33 2c 33 38 2e 30 2c 4d 2c 31 36 2e 37 2c 4d 2c 2c 2a 37 34 d a 24 47 4e 47 53 41 2c 41 2c 33 2c 32 38 2c 31 38 2c 32 33 2c 33 31 2c 30 35 2c 32 35 2c 32 39 2c 2c 2c 2c 2c 2c 31 2e 37 33 2c 30 2e 37 33 2c 31 2e 35 37 2c 31 2a 30 41 d a 24 47 4e 47 53 41 2c 41 2c 33 2c 37 35 2c 38 35 2c 37 33 2c 2c 2c 2c 2c 2c 2c 2c 2c 2c 31 2e 37 33 2c 30 2e 37 33 2c 31 2e 35 37 2c 32 2a 30 42 d a 24 47 4e 47 53 41 2c 41 2c 33 2c 32 35 2c 33 36 2c 31 32 2c 31 30 2c 32 34 2c 2c 2c 2c 2c 2c 2c 2c 31 2e 37 33 2c 30 2e 37 33 2c 31 2e 35 37 2c 33 2a 30 37 d a 24 47 50 47 53 56 2c 32 2c 31 2c 30 38 2c 30 35 2c 33 30 2c 31 32 34 2c 32 33 2c 31 32 2c 30 37 2c 30 34 30 2c 31 32 2c 31 38 2c 37 35 2c 32 36 38 2c 32 31 2c 32 33 2c 32 39 2c 30 30 39 2c 31 37 2c 31 2a 36 44 d a 24 47 50 47 53 56 2c 32 2c 32 2c 30 38 2c 32 35 2c 34 31 2c 30 33 31 2c 32 34 2c 32 38 2c 32 35 2c 33 30 32 2c 33 31 2c 32 39 2c 35 32 2c 31 33 31 2c 33 34 2c 33 31 2c 32 38 2c 32 37 32 2c 32 32 2c 31 2a 36 33 d a 24 47 50 47 53 56 2c 31 2c 31 2c 30 31 2c 31 32 2c 30 37 2c 30 34 30 2c 31 35 2c 35 2a 35 35 d a 24 47 50 47 53 56 2c 32 2c 31 2c 30 36 2c 31 38 2c 37 35 2c 32 36 38 2c 33 32 2c 32 33 2c 32 39 2c 30 30 39 2c 32 31 2c 32 35 2c 34 31 2c 30 33 31 2c 31 37 2c 32 36 2c 33 36 2c 32 32 38 2c 32 32 2c 36 2a 36 46 d a 24 47 50 47 53 56 2c 32 2c 32 2c 30 36 2c 32 38 2c 32 35 2c 33 30 32 2c 32 37 2c 33 31 2c 32 38 2c 32 37 32 2c 31 38 2c 36 2a 36 41 d a 24 47 50 47 53 56 2c 31 2c 31 2c 30 34 2c 31 30 2c 30 31 2c 33 34 38 2c 2c 31 35 2c 30 32 2c 30 36 39 2c 2c 31 36 2c 31 32 2c 32 32 32 2c 2c 32 30 2c 30 31 2c 31 34 36 2c 2c 30 2a 36 31 d a 24 47 4c 47 53 56 2c 31 2c 31 2c 30 33 2c 37 33 2c 32 36 2c 30 30 35 2c 32 38 2c 37 35 2c 34 31 2c 32 32 32 2c 32 37 2c 38 35 2c 33 38 2c 32 36 32 2c 32 36 2c 31 2a 34 30 d a 24 47 4c 47 53 56 2c 31 2c 31 2c 30 34 2c 36 39 2c 31 34 2c 30 37 39 2c 32 31 2c 37 33 2c 32 36 2c 30 30 35 2c 32 37 2c 37 35 2c 34 31 2c 32 32 32 2c 32 33 2c 38 35 2c 33 38 2c 32 36 32 2c 31 35 2c 33 2a 37 39 d a 24 47 4c 47 53 56 2c 32 2c 31 2c 30 35 2c 36 38 2c 31 32 2c 31 32 37 2c 2c 37 34 2c 36 34 2c 33 32 32 2c 2c 38 33 2c 30 32 2c 31 32 38 2c 2c 38 34 2c 34 39 2c 31 37 34 2c 2c 30 2a 37 35 d a 24 47 4c 47 53 56 2c 32 2c 32 2c 30 35 2c 38 34 2c 34 39 2c 31 37 34 2c 2c 30 2a 34 46 d a 24 47 41 47 53 56 2c 31 2c 31 2c 30 34 2c 31 38 2c 34 37 2c 31 30 39 2c 32 31 2c 32 34 2c 35 30 2c 30 33 32 2c 32 31 2c 32 35 2c 37 31 2c 32 33 36 2c 33 30 2c 33 36 2c 33 38 2c 33 30 30 2c 32 37 2c 32 2a 37 46 d a 24 47 41 47 53 56 2c 32 2c 31 2c 30 37 2c 31 30 2c 35 35 2c 31 34 38 2c 33 30 2c 31 32 2c 33 31 2c 31 33 38 2c 31 37 2c 31 38 2c 34 37 2c 31 30 39 2c 32 38 2c 32 34 2c 35 30 2c 30 33 32 2c 32 37 2c 37 2a 37 41 d a 24 47 41 47 53 56 2c 32 2c 32 2c 30 37 2c 32 35 2c 37 31 2c 32 33 36 2c 32 33 2c 33 31 2c 30 32 2c 30 33 38 2c 31 31 2c 33 36 2c 33 38 2c 33 30 30 2c 31 37 2c 37 2a 34 33 d a 24 47 41 47 53 56 2c 31 2c 31 2c 30 32 2c 30 32 2c 32 30 2c 32 32 32 2c 2c 31 31 2c 37 38 2c 32 30 38 2c 2c 30 2a 37 31 d a 24 47 4e 47 4c 4c 2c 33 33 33 30 2e 34 37 35 39 37 2c 53 2c 30 36 30 30 33 2e 37 32 38 30 34 2c 57 2c 31 32 31 36 32 34 2e 30 30 2c 41 2c 41 2a 37 44 d a b5 62 1 3c 40 0 1 0 0 0 10 8c 15 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 42 84 [ublox_gps_node-1] [DEBUG] [1704284184.136470579] [ublox_gps_node]: U-Blox received 441 bytes
.....
</code></pre>
<p>but here is the wierd thing, I have a ubuntu 22.04 WSL system running ros2 humble and a bridged network, there I run <code>ros2 topic list</code> and get:</p>
<pre><code>/diagnostics
/nmea
/parameter_events /rosout
/rtcm /ublox_gps_node/fix
/ublox_gps_node/fix_velocity
elgarbe@elgarbe:~$
</code></pre>
<p>finally if I run <code> docker exec -it d566a995b706 /bin/bash</code> in a second jetson nano terminal and run <code>ros2 topic list</code> I don't get ublox_messages.</p>
<p>Am I missing something?</p>
<p>EDIT1: <a href="https://github.com/micro-ROS/docker/tree/humble" rel="nofollow noreferrer">Using this dockerfile</a>:
<code> docker run -it --rm --net=host --device=/dev/ttyACM0 microros/micro-ros-agent:humble serial --dev /dev/ttyACM0</code>
I can see the topics published by microros in the ubuntu host computer. I'm trying to replicate the way that this image is created, but I can't figure out where the differences are.</p>
|
ublox_gps doesn't publish fix messages inside docker
|
<p>I solved my problem. I just used the wrong msg-type. I thought, the msg to be published into /clock should be of type "builtin_interfaces/msg/Time" but you need to use: "rosgraph_msgs/msg/Clock".</p>
<p>I attached to scripts as minimum example. One serves as "simulation loop" (clock_setter.py), which publishes the clock time, and the other has a rate, which should behave according to the published clock (try_rate_sim.py).</p>
<p>file: clock_setter.py</p>
<pre><code>import rclpy
import time
from rclpy.node import Node
from rosgraph_msgs.msg import Clock
def main():
rclpy.init()
node = rclpy.create_node('sim_time_publisher')
pub = node.create_publisher(Clock, '/clock', 1)
sec = 0
nanosec = 0
start_time = time.time()
while True:
msg = Clock()
msg.clock.sec = sec
msg.clock.nanosec = nanosec
pub.publish(msg)
node.get_logger().info('Publishing: Sim-Time Message: sec: {}, nanosec: {}'.format(sec, nanosec))
time.sleep(1)
current = time.time() - start_time
sec += 0
nanosec += int(0.001 * 10 ** 9)
if nanosec >= (1 * 10 ** 9):
sec += 1
nanosec -= 1 * 10 ** 9
if __name__ == "__main__":
main()
</code></pre>
<p>file: try_rate_sim.py</p>
<pre><code>import rclpy
import threading
def main():
rclpy.init()
node = rclpy.create_node('simple_node')
node.set_parameters([rclpy.parameter.Parameter("use_sim_time", rclpy.Parameter.Type.BOOL, True)])
print(rclpy.time.Time())
print(node.get_clock().now())
# Spin in a separate thread
thread = threading.Thread(target=rclpy.spin, args=(node,), daemon=True)
thread.start()
rate = node.create_rate(240.0)
try:
while rclpy.ok():
print(f"rclpy.time.Time(): {rclpy.time.Time()}")
print(f"node.get_clock().now(): {node.get_clock().now()}")
rate.sleep()
except KeyboardInterrupt:
pass
rclpy.shutdown()
thread.join()
if __name__ == "__main__":
main()
</code></pre>
<p>Thanks for your responses ! Any further critics of this code is more than welcome.</p>
|
107400
|
2024-01-03T17:39:39.130
|
|ros2|ros-foxy|rostime|use-sim-time|foxy|
|
<p>Dear Robotics Community,</p>
<p>I have a simple problem. I working with ros2 foxy and have a simulator (not important for the question).</p>
<p>I want to set the ros clock from my simulator-loop such that I can use the simulation time for other nodes e.g. using ros - rate according to the simulator.</p>
<p>I thought i would be easy to just publish into the /clock topic, but actually, it did not work for me. Can somebody help me with and minimal example in python? Any other help is more than welcome.</p>
<p>Thank you for your help</p>
|
ros2 foxy - set / publish simulation time and enable use_sim_time
|
<p>rosidl doesn't have a native way to support that. The pattern most commonly used is to do variable length arrays of each data type. It doesn't enforce the one part but you can gather a few different types.</p>
<pre><code>TypeA[] field_one
TypeB[] field_two
TypeC[] firld_three
</code></pre>
<p>Then you code which would have done a switch based on which type is in the <code>OneOf</code> now will do <code>if field_one ... else if field_two ... else ...</code></p>
<p>You should define behavior for multiple elements and if none are populated.</p>
<p>This works without needing to define a whole new construct, and let's us keep direct member based access for all the fields.</p>
|
107402
|
2024-01-03T18:37:18.487
|
|ros2|
|
<p>I would like the equivalent of protobuf's <code>Oneof</code> in my ROS messages. Is there a pattern for how to replicate this functionality in a ROS message?</p>
|
How to make tagged union (aka sum type) in ROS message?
|
<p>You should probably not find yourself ever using the <code>simple_commander</code>. I wrote that for creating easy demos that students and hobbyists could better understand. While it works, its not feature complete nor is it built to handle the full breadth of what Nav2 can do. You'd be kneecapping yourself with most of the advanced features. However, if you planned to write your task autonomy or application in Python3, then the NavigateToPose, FollowWaypoints, or NavigateThroughPoses demos might be something you'd leverage as a starting point, which calls the BT Navigator.</p>
<p>The Simple Commander includes APIs to call all of Nav2's Task Servers, including the lower level systems like the individual planner, controller, behaviors, etc. This is nice for basic testing that systems are working and are used in system and integration tests. I suppose you could also bypass the BT Navigator and design your own navigator-logic scripted in Python3, but that is not recommended and going 10+ years backwards in terms of robotics capabilities.</p>
<p>The BT Navigator leverages Behavior Trees (i.e. BT) for configurable navigation logic that can be easily changed and formally modeled. Its best to go that route.</p>
<blockquote>
<p>If I run both, what is prioritized?</p>
</blockquote>
<p>So, this question is not fully correct, but:</p>
<ul>
<li>Simple Commander's calls to the BT Navigator actions (ie Nav2Pose, NavThruPoses, WaypointFollower) so the commander acts as the autonomy application where Nav2 is the implementation of navigation</li>
<li>Simple Commander's calls to individual task servers (ie Spin, ComputePathToPose, FollowPath) completely bypasses the BT Navigator and calls the constituent parts</li>
</ul>
|
107410
|
2024-01-04T05:21:27.270
|
|ros|navigation|ros2|nav2|
|
<p>upon reading the documentation of nav2, I've came accross <a href="https://navigation.ros.org/configuration/packages/configuring-bt-navigator.html" rel="nofollow noreferrer">bt_navigator</a> and <a href="https://navigation.ros.org/commander_api/index.html" rel="nofollow noreferrer">simple commander api</a>. Both ways allows modification of the behavior of the robot. For example bt_navigator has <strong>FollowPath</strong> action while simple commander api has also one. If I run both, what is prioritized?</p>
|
What is prioritized in Nav2? bt_navigator or simple commander API?
|
<p>Don't start a <code>joint_state_publisher</code> node if you are already publishing to <code>joint_states</code> manually. That way there is only a single message being published to that topic.</p>
|
107430
|
2024-01-04T22:29:24.287
|
|ros2|ros-humble|joint-state-publisher|joint-states|
|
<p>By default <code>joint_state_publisher</code> publishes a message with all joints and default positions to the <code>joint_states</code> topic. What is the proper way of doing this? How do you take the preexisting message in <code>joint_states</code> and modify it to publish your own positions?</p>
<p>This code below is in a loop, publishing positions to <code>joint_states</code> but because there are 2 messages for the same joint, the joint wants to be in 2 different positions simultaneously.</p>
<pre><code>sensor_msgs::msg::JointState joint_state_msg;
joint_state_msg.header.stamp = this->get_clock()->now();
joint_state_msg.name.push_back("joint_name");
joint_state_msg.position.push_back(position);
joint_state_publisher_->publish(joint_state_msg);
</code></pre>
<p>Console output below: <code>ros2 topic echo /joint_states</code></p>
<pre><code>--- // the default joint_state_publisher is publishing
header:
stamp:
sec: 1704407222
nanosec: 811950312
frame_id: ''
name:
- joint_name
position:
- 0.0
velocity: []
effort: []
--- // position I want the joint to be
header:
stamp:
sec: 1704407222
nanosec: 911955095
frame_id: ''
name:
- joint_name
position:
- 0.156
velocity: []
effort: []
---
</code></pre>
<p>I thought setting the <code>publish_default_positions</code> to false would remove the entire message from sending but it only makes <code>positions: []</code> instead of <code>positions: - 0.0</code></p>
<pre><code>Node(
package="joint_state_publisher",
executable='joint_state_publisher',
name='joint_state_publisher',
output='screen',
parameters=[{'publish_default_positions': False}],
),
</code></pre>
<h3>Reference</h3>
<ul>
<li><a href="https://index.ros.org/p/joint_state_publisher/" rel="nofollow noreferrer">https://index.ros.org/p/joint_state_publisher/</a></li>
</ul>
|
How do you send positions in joint_states topic if there's already default positions being published?
|
<p>Reading your answer and previously mentioned answer it seems that you have to rotate some elements.</p>
<p>According to <a href="https://www.ros.org/reps/rep-0103.html" rel="nofollow noreferrer">REP103</a> front of the mobile robot should be aligned with X-axis. So to fix it, you have to change the rotation in your URDF file. If you have all joint attached to <code>base_link</code> (all joint have <code><parent link="base_link"></code> inside <code><joint>...</joint></code>, ) you have to add rotation in <code><joint></code> markers as
<code>rpy ="0 0 1.57"</code> instead of <code>rpy ="0 0 0"</code> which you probably have now. But without knowing the urdf file it's difficult to say if you need some other changes. But that's the start.</p>
|
107436
|
2024-01-05T06:45:35.100
|
|gazebo|ros2|rviz|mobile-robot|wheeled-robot|
|
<p>I am currently simulating a mobile robot, and I control its movements using the teleop keyboard node. Upon loading the robot model in both Gazebo and Rviz, the initial orientation appears consistent in both environments. However, when I initiate movement, I encounter a discrepancy in behavior.</p>
<p>In Gazebo, the robot moves along the y-axis, aligning with the expected motion based on wheel rotation. However, in Rviz, as I start moving the robot, it unexpectedly moves along the axis, which is the axis of rotation of the wheels.</p>
<p>Here are images illustrating the issue:</p>
<p><strong>Rviz Visualization:</strong>
<a href="https://i.stack.imgur.com/XDm2P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XDm2P.png" alt="enter image description here" /></a></p>
<p><strong>Gazebo Visualization:</strong>
<a href="https://i.stack.imgur.com/jQZEt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jQZEt.png" alt="enter image description here" /></a></p>
<p>As you can see, robot moves along the y axis in Gazebo, whereas it moves along x axis in Rviz. There was a similar question <a href="https://robotics.stackexchange.com/questions/18806/robot-moving-sideways-in-rviz-ros">previously</a>,Unfortunately, I couldn't understand the specific changes needed in the URDF from that answer.</p>
|
Mobile robot moves sideways in Rviz, but properly in gazebo
|
<p>The issue was in the design of the robot. The front 2 wheels were connected to the main chassi using "revolute joint" and not using "continous joint". Because of the friction of the front wheels, the robot was not able to move forward, left and right although its wheels moved left and right.</p>
<p>A quick fix for this issue is to remove the friction of the front wheels by adding the following code in the tag of the front 2 wheels:</p>
<pre><code> <mu1 value="0.001"/>
<mu2 value="0.001"/>
</code></pre>
<p>The other permanent fix was to add 2 additional link to the front 2 wheels as "revolute" joint and connect the wheels to this link as continuous joint.
<a href="https://i.stack.imgur.com/DRMR3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DRMR3.png" alt="Image showing the added links." /></a></p>
<p>I have added the additional links and the updated code can be found at <a href="https://github.com/nice-user1/ros2_acker/tree/master" rel="nofollow noreferrer">https://github.com/nice-user1/ros2_acker/tree/master</a>.</p>
|
107442
|
2024-01-05T11:32:20.100
|
|ros2|urdf|ros-humble|ros2-control|robot-description|
|
<p>I am working on a ros2 ackermann steering robot with 4 wheels.</p>
<p>Issue: The robot is not moving forward, left and right. Although its wheels are turning left and right. The robot is moving in reverse direction properly.</p>
<p>There are 4 wheels. Out of it, 2 rear wheels are of type <code>continuous</code> and 2 front wheels are of type <code>revolute</code>.</p>
<p>Distro: <code>ros2-humble</code></p>
<p>Full code with steps to reproduce error is available at: <a href="https://github.com/nice-user1/ros2_acker/tree/master" rel="nofollow noreferrer">https://github.com/nice-user1/ros2_acker/tree/master</a></p>
<p>Edit: The issue is resolved and the updated working code is pushed to the same branch.</p>
<h1>Directory Structure</h1>
<pre><code>race_it_ws
/src
/race_it
/description
/race_car.xacro
/ros2_ack.xacro
/inertial.xacro
/config
/controller
/my_controllers.yaml
/launch
/rsp.launch.py
</code></pre>
<h1>Code</h1>
<h2>Description</h2>
<h3>race_car.xacro (main urdf file)</h3>
<pre><code><?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="simple_car">
<xacro:include filename="inertial.xacro"/>
<!-- <xacro:include filename="gazebo_control_dd.xacro"/> -->
<!-- <xacro:include filename="gazebo_control_steer.xacro"/> -->
<xacro:property name="wheel_width" value="0.04"/>
<xacro:property name="wheel_radius" value="0.1"/>
<!-- Wheel macro -->
<xacro:macro name="wheel" params="name">
<link name="<span class="math-container">${name}">
<visual>
<geometry>
<cylinder length="$</span>{wheel_width}" radius="<span class="math-container">${wheel_radius}" />
</geometry>
<material name="blue"/>
</visual>
<collision>
<geometry>
<cylinder length="$</span>{wheel_width}" radius="<span class="math-container">${wheel_radius}" />
</geometry>
</collision>
<xacro:inertial_cylinder mass="0.1" length="$</span>{wheel_width}" radius="${wheel_radius}"/>
</link>
<gazebo reference="${name}">
<material>Gazebo/Blue</material>
</gazebo>
</xacro:macro>
<!-- Base Link -->
<link name="base_link">
</link>
<!-- Chassis Link -->
<link name="chassis_link">
<visual>
<geometry>
<box size="0.5 1.0 0.2"/>
</geometry>
<origin xyz="0 0 0" rpy="0 0 0"/>
<material name="blue">
<color rgba="0 0 1 1"/>
</material>
</visual>
<xacro:inertial_box mass="0.5" x="0.5" y="1.0" z="0.15"/>
</link>
<gazebo reference="chassis_link">
<material>Gazebo/Orange</material>
</gazebo>
<!-- Base Chassis Joint -->
<joint name="base_chassis_joint" type="fixed">
<parent link="base_link"/>
<child link="chassis_link"/>
<origin xyz="0 0 0.2" rpy="0 0 0 "/>
</joint>
<!-- Front Left Wheel -->
<xacro:wheel name="front_left_link"/>
<joint name="front_left_joint" type="revolute">
<parent link="chassis_link"/>
<child link="front_left_link"/>
<origin xyz="-0.25 0.5 -0.1" rpy="0 ${-pi/2} 0"/>
<limit upper="0.5236" lower="-0.5236" velocity="20" effort="1"/>
<axis xyz="1 0 0"/>
</joint>
<gazebo reference="front_left_link">
<material>Gazebo/Red</material>
<!--
<mu1 value="0.001"/>
<mu2 value="0.001"/>
-->
</gazebo>
<!-- Front Right Wheel -->
<xacro:wheel name="front_right_link"/>
<joint name="front_right_joint" type="revolute">
<parent link="chassis_link"/>
<child link="front_right_link"/>
<origin xyz="0.25 0.5 -0.1" rpy="0 ${-pi/2} 0"/>
<limit upper="0.5236" lower="-0.5236" velocity="20" effort="1"/>
<axis xyz="1 0 0"/>
</joint>
<gazebo reference="front_right_link">
<material>Gazebo/Red</material>
<!--
<mu1 value="0.001"/>
<mu2 value="0.001"/>
-->
</gazebo>
<!-- Rear Left Wheel -->
<xacro:wheel name="rear_left_link"/>
<joint name="rear_left_joint" type="continuous">
<parent link="chassis_link"/>
<child link="rear_left_link"/>
<origin xyz="-0.25 -0.5 -0.1" rpy="0 ${-pi/2} 0"/>
<limit upper="0.5236" lower="-0.5236" velocity="20" effort="1"/>
<axis xyz="0 0 1"/>
</joint>
<!-- Rear Right Wheel -->
<xacro:wheel name="rear_right_link" />
<joint name="rear_right_joint" type="continuous">
<parent link="chassis_link"/>
<child link="rear_right_link"/>
<origin xyz="0.25 -0.5 -0.1" rpy="0 ${-pi/2} 0"/> <!-- Default value for x is "0.27" -->
<axis xyz="0 0 1"/>
</joint>
<xacro:include filename="ros2_ack.xacro"/>
</robot>
</code></pre>
<h3>inertial.xacro (for inertia)</h3>
<pre><code><?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" >
<!-- Specify some standard inertial calculations https://en.wikipedia.org/wiki/List_of_moments_of_inertia -->
<!-- These make use of xacro's mathematical functionality -->
<xacro:macro name="inertial_box" params="mass x y z">
<inertial>
<mass value="<span class="math-container">${mass}" />
<inertia ixx="$</span>{(1/12) * mass * (y*y+z*z)}" ixy="0.0" ixz="0.0"
iyy="<span class="math-container">${(1/12) * mass * (x*x+z*z)}" iyz="0.0"
izz="$</span>{(1/12) * mass * (x*x+y*y)}" />
</inertial>
</xacro:macro>
<xacro:macro name="inertial_cylinder" params="mass length radius">
<inertial>
<mass value="<span class="math-container">${mass}" />
<inertia ixx="$</span>{(1/12) * mass * (3*radius*radius + length*length)}" ixy="0.0" ixz="0.0"
iyy="<span class="math-container">${(1/12) * mass * (3*radius*radius + length*length)}" iyz="0.0"
izz="$</span>{(1/2) * mass * (radius*radius)}" />
</inertial>
</xacro:macro>
</robot>
</code></pre>
<h3>ros2_ack.xacro</h3>
<pre><code><?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="simple_car">
<ros2_control name="carbot" type="system">
<hardware>
<plugin>gazebo_ros2_control/GazeboSystem</plugin>
<!--
<plugin>ros2_control_demo_example_11/CarlikeBotSystemHardware</plugin>
<param name="example_param_hw_start_duration_sec">0</param>
<param name="example_param_hw_stop_duration_sec">3.0</param>
<param name="is_simulation">1</param>
-->
</hardware>
<!-- Front Left Wheel -->
<joint name="front_left_joint">
<command_interface name="position"/>
<state_interface name="position" />
</joint>
<!-- Front Right Wheel -->
<joint name="front_right_joint">
<command_interface name="position"/>
<state_interface name="position" />
</joint>
<!-- Rear Left Wheel -->
<joint name="rear_left_joint">
<command_interface name="velocity"/>
<state_interface name="velocity" />
</joint>
<!-- Rear Right Wheel -->
<joint name="rear_right_joint">
<command_interface name="velocity"/>
<state_interface name="velocity" />
</joint>
</ros2_control>
<gazebo>
<plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
<parameters>$(find race_it)/config/controller/my_controllers.yaml</parameters>
</plugin>
</gazebo>
</robot>
</code></pre>
<h2>config (controller)</h2>
<h3>my_controllers.xacro</h3>
<pre><code>controller_manager:
ros__parameters:
update_rate: 30
use_sim_time: true
asc:
type: ackermann_steering_controller/AckermannSteeringController
jsc:
type: joint_state_broadcaster/JointStateBroadcaster
asc:
ros__parameters:
reference_timeout: 2.0
front_steering: true
open_loop: false
velocity_rolling_window_size: 10
position_feedback: false
use_stamped_vel: true
rear_wheels_names: [rear_right_joint, rear_left_joint]
front_wheels_names: [front_right_joint, front_left_joint]
wheelbase: 1.0
front_wheel_track: 0.5
rear_wheel_track: 0.5
front_wheels_radius: 0.1
rear_wheels_radius: 0.1
#jsc:
# ros__parameters:
# type: joint_state_controller/JointStateController
</code></pre>
<h2>launch</h2>
<h3>rsp.launch.py</h3>
<pre><code>import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.substitutions import LaunchConfiguration
from launch.actions import DeclareLaunchArgument
from launch_ros.actions import Node
import launch_ros
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
import xacro
def generate_launch_description():
# Check if we're told to use sim time
use_sim_time = LaunchConfiguration('use_sim_time')
# Process the URDF file
pkg_path = os.path.join(get_package_share_directory('race_it'))
#xacro_file = os.path.join(pkg_path,'description','robot.urdf.xacro')
xacro_file = os.path.join(pkg_path,'description', 'race_car.xacro')
robot_description_config = xacro.process_file(xacro_file)
default_rviz_config_path = os.path.join(pkg_path, 'config/rviz/urdf_config.rviz')
# Create a robot_state_publisher node
params = {'robot_description': robot_description_config.toxml(), 'use_sim_time': use_sim_time}
node_robot_state_publisher = Node(
package='robot_state_publisher',
executable='robot_state_publisher',
output='screen',
parameters=[params]
)
joint_state_publisher_node = launch_ros.actions.Node(
package='joint_state_publisher',
executable='joint_state_publisher',
name='joint_state_publisher'
)
rviz_node = launch_ros.actions.Node(
package='rviz2',
executable='rviz2',
name='rviz2',
output='screen',
arguments=['-d', default_rviz_config_path],
)
gazebo = IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
get_package_share_directory('gazebo_ros'), 'launch', 'gazebo.launch.py')])#,
# launch_arguments={'world': "my_bot/worlds/obstacles.world"}.items()
)
spawn_entity = launch_ros.actions.Node(
package='gazebo_ros',
executable='spawn_entity.py',
arguments=['-entity', '', '-topic', 'robot_description'],
output='screen'
)
# Launch!
return LaunchDescription([
DeclareLaunchArgument(
'use_sim_time',
default_value='true',
description='Use sim time if true'),
node_robot_state_publisher,
joint_state_publisher_node,
rviz_node,
gazebo,
spawn_entity
])
</code></pre>
<p><strong>To Execute:</strong></p>
<ul>
<li>ros2 launch race_it rsp.launch.py</li>
<li>ros2 run controller_manager spawner asc</li>
</ul>
<p>NOTE: I feel there are some issues with the robot_description due to which i am experiencing this weird behavior although I haven't been able to figure it out.</p>
<p>Thanks</p>
|
ros2 ackermann robot not moving forward, left and right
|
<p>This was an error related to time stamp of the both the messages. DetectionArray was using sim time and camera was not using it. so I made a new Node which subscribe to the camera, update the time stamp and managed to get the next error;-)</p>
|
107445
|
2024-01-05T13:16:22.833
|
|ros2|message-filters|approximatetime|
|
<p>I am trying to project 3d bounding box detected on a point cloud data to Image. I am using message filters to subscribe to image and detection topic. when I run the node i get the debug message on console but after that there is no output.</p>
<pre><code>#!/usr/bin/env python3
from typing import List
import rclpy
from rclpy.context import Context
from rclpy.node import Node
from rclpy.parameter import Parameter
from sensor_msgs.msg import Image
from vision_msgs.msg import Detection3DArray
import message_filters
import numpy as np
import ros2_numpy as rnp
import cv2
from cv_bridge import CvBridge, CvBridgeError
class Projection(Node):
def __init__(self):
super().__init__("projection")
self.bridge = CvBridge()
# self.lidar_sub = self.create_subscription(Detection3DArray, "cloud_detections", self.posecallback, 10)
self.rot_matrix = np.array([[0.691, 0.599, 0.405],
[0.516, 0.801, 0.303],
[-0.506, -0.00, 0.863]])
self.trans_vec = np.array([-5.976, 6.080, 0.018] )
self.intrinsic_ = np.array([[553.817335, 0.000000, 319.184693],
[0.000000, 553.998394, 319.639937],
[0.000000, 0.000000, 1.000000]] )
self.distortion_ = np.array([-0.002324, 0.004655, 0.000222, -0.000076, 0.000000])
self.lidar_detection_sub = message_filters.Subscriber(self, Detection3DArray, "cloud_detections")
self.image_sub = message_filters.Subscriber(self, Image, "camera")
self.camera_pub = self.create_publisher(Image, "bbbox_projection", 10)
self.proj = message_filters.ApproximateTimeSynchronizer([self.image_sub, self.lidar_detection_sub], 10, 10)
self.proj.registerCallback(self.posecallback)
self.get_logger().info("Projecting bounding box on image.....")
def posecallback(self, img_msg, detection_msg):
try:
img = self.bridge.imgmsg_to_cv2(img_msg, "bgr8")
except CvBridgeError as e:
self.get_logger().error(e)
for detection in detection_msg.detections:
object_point = rnp.numpify(detection.bbox.center.position)
size = rnp.numpify(detection.bbox.size)
self.get_logger().info(f"object_point:{object_point}")
image_point,_ = cv2.projectPoints(object_point, self.rot_matrix, self.trans_vec, self.intrinsic_, self.distortion_)
self.get_logger().info(f"image_point:{image_point}")
bbox_image_ = self.draw_box(img, object_point[0], object_point[1], size.x, size.y,(255,255,245))
bbox_msg = self.bridge.cv2_to_imgmsg(bbox_image_)
self.camera_pub.publish(bbox_msg)
def draw_box(self, cv_image: np.array, x_position, y_position,x_size, y_size, color) -> np.array:
min_pt = (round(x_position - x_size / 2.0),
round(y_position - y_size /2.0))
max_pt = (round(x_position + x_size / 2.0),
round(y_position + y_size /2.0))
# draw box
cv2.rectangle(cv_image, min_pt, max_pt, color, 2)
return cv_image
def main(args=None):
rclpy.init(args=args)
node = Projection()
rclpy.spin(node)
rclpy.shutdown()
if __name__ == '__main__':
main()
</code></pre>
<p>console output is just a message: Projecting bounding box on image.....</p>
<p>Any guidance is appreciated. Thank you!
I am using ros2 humble on linux 22.04.</p>
|
Not getting any output with python message_filter ApproximateTimeSynchronizer
|
<p>Be aware that tricycle_controller has a totally different codebase then the ackermann_steering_controller (which uses the same base as bicycle_steering_controller and tricycle_steering_controller, see <a href="https://control.ros.org/master/doc/ros2_controllers/steering_controllers_library/doc/userdoc.html" rel="nofollow noreferrer">steering_controller_library</a>): You cannot use the configuration directly.</p>
<p>Does <a href="https://github.com/ros-controls/ros2_controllers/issues/937#issuecomment-1875040977" rel="nofollow noreferrer">this note</a> here maybe fix your problem?</p>
|
107454
|
2024-01-06T12:35:41.883
|
|ros2|odometry|tf|ros2-controllers|fixed-frame|
|
<p>I cannot set odom as a fixed frame inside RViz. It doesn't show up at all. My robot is fully functional and visible in both Gazebo. I don't get any warnings, errors or exceptions in the log. I'm using ROS2 Humble and Gazebo Fortress. I follow the code of the tricycle_drive_example from ign_ros2_control_demos (which publishes odom correctly if I run it on my laptop).</p>
<p>As intended by the controller, the topic /ackermann_steering_cotroller/odometry is published. Whenerver I try to visualize that topic with RViz, I get the following message:</p>
<pre><code>[INFO] [1704543459.237610775] [rviz]: Message Filter dropping message: frame 'odom' at time 214,560 for reason 'discarding message because the queue is full'
</code></pre>
<p>Running <code>ros2 run tf2_ros tf2_echo odom base_link</code>, gives this:</p>
<pre><code>[INFO] [1704543792.043830485] [tf2_echo]: Waiting for transform odom -> base_link: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist
</code></pre>
<p>Also, my tf_tree looks like this:
<a href="https://i.stack.imgur.com/Hg9ni.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Hg9ni.png" alt="enter image description here" /></a></p>
<p>The ros2_control tag inside my urdf:</p>
<pre><code><ros2_control name="IgnitionSystem" type="system">
<hardware>
<plugin>ign_ros2_control/IgnitionSystem</plugin>
</hardware>
<joint name="LEFT_HINGE_JOINT">
<command_interface name="position"/>
<state_interface name="position"/>
</joint>
<joint name="RIGHT_HINGE_JOINT">
<command_interface name="position"/>
<state_interface name="position"/>
</joint>
<joint name="LEFT_REAR_WHEEL_JOINT">
<command_interface name="velocity"/>
<state_interface name="velocity"/>
<state_interface name="position"/>
</joint>
<joint name="RIGHT_REAR_WHEEL_JOINT">
<command_interface name="velocity"/>
<state_interface name="velocity"/>
<state_interface name="position"/>
</joint>
</ros2_control>
</code></pre>
<p>The configuration file for the controllers:</p>
<pre><code>controller_manager:
ros__parameters:
update_rate: 50
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
ackermann_steering_controller:
type: ackermann_steering_controller/AckermannSteeringController
joint_state_broadcaster:
ros__parameters:
extra_joints: ["RIGHT_FRONT_WHEEL_JOINT", "LEFT_FRONT_WHEEL_JOINT"]
ackermann_steering_controller:
ros__parameters:
reference_timeout: 2.0
front_steering: true
open_loop: false
velocity_rolling_window_size: 10
use_stamped_vel: false
rear_wheels_names: [RIGHT_REAR_WHEEL_JOINT, LEFT_REAR_WHEEL_JOINT]
front_wheels_names: [RIGHT_HINGE_JOINT, LEFT_HINGE_JOINT]
odom_frame_id: odom
base_frame_id: base_link
enable_odom_tf: true
odom_only_twist: false
wheelbase: 0.324
front_wheel_track: 0.387
rear_wheel_track: 0.387
front_wheels_radius: 0.055
rear_wheels_radius: 0.055
</code></pre>
<p>In addition, here is what's on the log:</p>
<pre><code>[ruby <span class="math-container">$(which ign) gazebo-2] [INFO] [1704582360.211746217] [controller_manager]: Loading controller 'ackermann_steering_controller'
[ruby $</span>(which ign) gazebo-2] [INFO] [1704582360.222413325] [controller_manager]: Setting use_sim_time=True for ackermann_steering_controller to match controller manager (see ros2_control#325 for details)
[spawner-7] [INFO] [1704582360.288968173] [spawner_ackermann_steering_controller]: Loaded ackermann_steering_controller
[ruby <span class="math-container">$(which ign) gazebo-2] [INFO] [1704582360.290052009] [controller_manager]: Configuring controller 'ackermann_steering_controller'
[ruby $</span>(which ign) gazebo-2] [INFO] [1704582360.290166991] [ackermann_steering_controller]: ackermann odom configure successful
[ruby $(which ign) gazebo-2] [INFO] [1704582360.295780665] [ackermann_steering_controller]: configure successful
[spawner-7] [INFO] [1704582360.569778822] [spawner_ackermann_steering_controller]: Configured and activated ackermann_steering_controller
[INFO] [spawner-7]: process has finished cleanly [pid 51038]
</code></pre>
|
Transform between odom and base_link not made. ros2_controller Ackermann Steering Controller
|
<p><code>rospy.AnyMsg</code> was generally used to subscribe to serialized messages in ROS 1. These would come to the user-specified callback as an array of bytes that the user could do something with. This was helpful if you didn't need to deserialize the message and instead just store it or use it for bandwidth computations (eg rostopic bw)</p>
<p>In ROS 2, the correct way to get this behavior is by utilizing the <code>raw</code> flag on <code>Node.create_subscription</code>. You still need a message type for the subscription in this case, but you can construct this at runtime from a string argument:</p>
<pre><code>from rosidl_runtime_py.utilities import get_message
def callback(data):
# 'data' here is just bytes, it is up to the callback implementor
# to do something with it.
print(len(data))
node.create_subscription(
get_message('my_cool_message_type'),
topic,
callback,
qos_profile_sensor_data,
raw=True
)
</code></pre>
<p>If you do not have ready access to the message type as a string or a python object, you can use something like <code>ros2cli</code> uses to figure out the type at runtime: <a href="https://github.com/ros2/ros2cli/blob/e8bcf46c8a226ec35f8127fa22226ba0f73da47c/ros2topic/ros2topic/api/__init__.py#L109-L158" rel="nofollow noreferrer"><code>get_message_class</code></a></p>
<p>This uses graph introspection to determine what available message types are available on a given topic and then returns the corresponding message class.</p>
|
107476
|
2024-01-08T16:45:24.583
|
|ros|ros2|python3|
|
<p>Currently in ROS I am using <code>rospy.AnyMsg</code>. I would like to convert the ROS code to ROS2. I tried doing an <code>import AnyMsg from rclpy</code> but it does not work. I tried to search for <code>AnyMsg</code> for ROS2 and I could not find anything. Does <code>AnyMsg</code> exist in ROS2? If so, how do I access it? If not, is there an alternative and what is it?</p>
|
What is the ROS2 equivalent of rospy.AnyMsg?
|
<p>You should use <code>#include <gz/plugin/Register.hh></code> instead of <code>#include <gz/plugin/RegisterMore.hh></code>. The latter is if you are registering multiple classes in multiple translation units, but it assumes the former is included somewhere.</p>
|
107483
|
2024-01-08T20:37:21.693
|
|gazebo|c++|gazebo-plugin|
|
<p>I'm trying to make custom gz sim plugin by following the examples folder. After build the example I'm getting error</p>
<blockquote>
<p>gz sim -s -v 4 sample_system.sdf: symbol lookup error:
/home/JF/Projects/system_plugin/build/libSampleSystem.so: undefined
symbol: GzPluginHook</p>
</blockquote>
<p>Referring to this example <a href="https://github.com/gazebosim/gz-sim/tree/gz-sim7/examples/plugin/system_plugin" rel="nofollow noreferrer">https://github.com/gazebosim/gz-sim/tree/gz-sim7/examples/plugin/system_plugin</a>, any ideas? Using Gazebo Garden</p>
<p>SampleSystem.cc</p>
<pre><code>
#include "SampleSystem.hh"
#include <gz/plugin/RegisterMore.hh>
#include <gz/sim/components/Link.hh>
GZ_ADD_PLUGIN(
SampleSystem,
gz::sim::System,
SampleSystem::ISystemPreUpdate,
SampleSystem::ISystemUpdate,
SampleSystem::ISystemPostUpdate,
SampleSystem::ISystemReset)
SampleSystem::SampleSystem()
{
}
SampleSystem::~SampleSystem()
{
}
void SampleSystem::PreUpdate(const gz::sim::UpdateInfo &_info,
gz::sim::EntityComponentManager &_ecm)
{
gzmsg << "SampleSystem::PreUpdate" << std::endl;
}
void SampleSystem::Update(const gz::sim::UpdateInfo &_info,
gz::sim::EntityComponentManager &_ecm)
{
gzmsg << "SampleSystem::Update" << std::endl;
}
void SampleSystem::PostUpdate(const gz::sim::UpdateInfo &_info,
const gz::sim::EntityComponentManager &_ecm)
{
gzmsg << "SampleSystem::PostUpdate" << std::endl;
}
void SampleSystem::Reset(const gz::sim::UpdateInfo &_info,
gz::sim::EntityComponentManager &_ecm)
{
gzmsg << "SampleSystem::Reset" << std::endl;
}
</code></pre>
<p>SampleSystem.hh</p>
<pre><code>/*
* Copyright (C) 2018 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef SAMPLESYSTEM_HH_
#define SAMPLESYSTEM_HH_
//! [header]
#include <gz/sim/System.hh>
class SampleSystem:
// This class is a system.
public gz::sim::System,
// This class also implements the ISystemPreUpdate, ISystemUpdate,
// and ISystemPostUpdate interfaces.
public gz::sim::ISystemPreUpdate,
public gz::sim::ISystemUpdate,
public gz::sim::ISystemPostUpdate,
public gz::sim::ISystemReset
{
public: SampleSystem();
public: ~SampleSystem() override;
public: void PreUpdate(const gz::sim::UpdateInfo &_info,
gz::sim::EntityComponentManager &_ecm) override;
public: void Update(const gz::sim::UpdateInfo &_info,
gz::sim::EntityComponentManager &_ecm) override;
public: void PostUpdate(const gz::sim::UpdateInfo &_info,
const gz::sim::EntityComponentManager &_ecm) override;
public: void Reset(const gz::sim::UpdateInfo &_info,
gz::sim::EntityComponentManager &_ecm) override;
};
#endif
</code></pre>
<p>CMakeLists.txt</p>
<pre><code>cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
find_package(gz-cmake3 REQUIRED)
project(SampleSystem)
find_package(gz-plugin2 REQUIRED COMPONENTS register)
set(GZ_PLUGIN_VER ${gz-plugin2_VERSION_MAJOR})
find_package(gz-sim7 REQUIRED)
set(GZ_SIM_VER ${gz-sim7_VERSION_MAJOR})
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_library(SampleSystem SHARED SampleSystem.cc)
target_link_libraries(SampleSystem
gz-plugin<span class="math-container">${GZ_PLUGIN_VER}::gz-plugin$</span>{GZ_PLUGIN_VER}
gz-sim<span class="math-container">${GZ_SIM_VER}::gz-sim$</span>{GZ_SIM_VER})
</code></pre>
|
undefined symbol: GzPluginHook
|
<p>Attach during runtime to the controller manager process, not to the spawner.</p>
<p>Also figure out which .so file is loaded - whether it's the one from your workspace, or the one from clion's own build folder. For debugging, you'll want the latter (cmake-build-debug). This can be found when you attach to the controller manager, press pause button in clion, switch to the gdb panel and type <code>info sharedlibraries</code>. It will list all loaded .so files. To force loading clion's .so file, you can put the absolute path of the .so in environment variable LD_PRELOAD (e.g in the launch file using <code><env></code> tag).</p>
|
107490
|
2024-01-09T08:55:07.707
|
|ros|controller-manager|clion|
|
<p>I have following problem. I am using clion and ROS (1). I use franka_ros to develop a controller.</p>
<p>Hear I want to mention, that I followed all the steps provided by clion - documentation website, to set up ROS in clion. Everything works fine. I can debug simple executables. I could also attach to a simple running executable node.</p>
<p>Now, I want to debug my written controller, based on franka_ros. I use a launch file and the "controller_manager"-package to launch the complete world. Everything works fine.</p>
<p>But my problem is, that I cannot attach to the process and debug the controller. First thing I notice, that the executable of the controller spawner process is "python3" and available debuggers are "Python/Native". When I attach to the process with the debuggers I cannot stop at breakpoints or get any information of my controller at all. I think it might be a problem of having the "controller_manager"-package in between.</p>
<p>Does anybody has some ideas or experiences with that ? Any hint or recommendation would be nice!</p>
<p>Thanks!</p>
|
ROS Debug Clion - Controller
|
<p>I just solved it myself.</p>
<pre><code>sudo apt install ros-galactic-desktop
sudo apt autoremove
colcon build
sudo apt install ros-galactic-desktop
sudo apt update
sudo apt install python3-colcon-common-extensions
colcon build
</code></pre>
<p>I was just trying one more time with reinstalling ROS2 and Ubuntu suggested <code>sudo apt autoremove</code> which I did and I noticed in the dialog that it also removed colcon. I suspect maybe that it detected that colcon was defect/unused?
After reinstalling colcon with <code>sudo apt install python3-colcon-common-extensions</code> it build all the packages.</p>
<p>I suspect that the previous cmake deletion, the previous colcon was somehow affected by it and de facto defect software and the observed behavior was maybe undefined behavior by a defect colcon version which cmake-dependencies was ripped out of it.</p>
<p>I suspect that this is a highly individual error and
that would explain why I couldn't google and find anyone with the same error.</p>
|
107493
|
2024-01-09T10:10:47.153
|
|ros2|cmake|package|build|colcon|
|
<p>I am working for a drone university project in a team and we set up a project in ROS2 galactic (<a href="https://github.com/AlboAlby00/CrazyflieControllers" rel="nofollow noreferrer">https://github.com/AlboAlby00/CrazyflieControllers</a>).
I wanted to try out a new github repository which required an update to my current cmake version (3.16.3). So I did the following:
<code>sudo apt remove cmake</code>.
In the removal dialog I noticed that it also removed cmake stuff in ros galactic subfolders and my heart sank, because I suspected a little that this meant trouble.</p>
<p>I proceeded with the update and manual installation of cmake 3.28.1:
I manually downloaded and installed the latest cmake 3.26 (in the <code>/opt</code> folder I did <code>sudo bash cmake-3.28.1-linux-x86_64.sh</code>
<code>sudo ln -s /opt/cmake-3.28.1-linux-x86_64/bin/* /usr/local/bin</code>
).</p>
<p>After noticing that <code>colcon build</code> does not recognize all but two of the packages (there are actually seven and it worked before the cmake deletion), I try to reverse the manual installation by deleting everything (in <code>/opt</code> folder with <code>sudo rm -rf cmake-3.28.1-linux-x86_64/ cmake-3.28.1-linux-x86_64.sh</code> and in symlinked <code>/usr/local/bin</code> <code>sudo rm ccmake cmake cmake-gui cpack ctest</code> ) and reinstalled ROS2 to get back the old cmake: <code>sudo apt install ros-galactic-desktop</code></p>
<p><code>cmake --version</code> returns</p>
<pre><code>cmake version 3.16.3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
</code></pre>
<p>I even tried to build it in a new folder with no success.
In the new folder <code>~/Projects/droneROS2_ws/src</code> I do</p>
<p><code>git clone https://github.com/AlboAlby00/CrazyflieControllers</code></p>
<p><code>cd CrazyflieControllers && git checkout MPC</code> (I work on the MPC on a branch)</p>
<p>(you don't have to do <code>git submodule update --init --recursive</code> for my MPC branch, because I don't need the submodules in the <code>3rd</code> folder)</p>
<pre><code>~/Projects/droneROS2_ws/src/CrazyflieControllers$ ls
3rd crazyflie_controllers crazyflie_localization crazyflie_ros2_driver docs Readme.md
apt_dependencies.txt crazyflie_detectors crazyflie_msgs crazyflie_teleop KeyFrameTrajectory.txt requirements.txt
</code></pre>
<p><code>cd ../../</code></p>
<pre><code>~/Projects/droneROS2_ws$ colcon build
Starting >>> crazyflie_ros2_driver
Starting >>> crazyflie_teleop
Finished <<< crazyflie_ros2_driver [0.99s]
Finished <<< crazyflie_teleop [1.05s]
Summary: 2 packages finished [2.76s]
</code></pre>
<p>It is also supposed to build crazyflie_controllers for example in the <code>src</code> folder.</p>
<p>The package.xml of crazyflie_controllers is:</p>
<pre><code><?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>crazyflie_controllers</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="">alboalby00</maintainer>
<license>TODO: License declaration</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>ament_cmake_python</buildtool_depend>
<exec_depend>ros2launch</exec_depend>
<depend>rclcpp</depend>
<depend>rclpy</depend>
<depend>std_msgs</depend>
<depend>crazyflie_msgs</depend>
<depend>geometry_msgs</depend>
<depend>sensor_msgs</depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>
</code></pre>
<p>It works at the setup of my team members.
I sourced with <code>source /opt/ros/galactic/setup.bash</code> and removed previous colcon builds <code>rm -rf build/ install/ log/</code></p>
<p>My setup:
<code>lsb_release -a</code>
Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focal
<code>uname -a</code>Linux SurfBoard3 6.5.6-surface #3 SMP PREEMPT_DYNAMIC Sun Oct 15 20:52:00 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
<code>uname -r</code> 6.5.6-surface</p>
<p>I would really appreciate your help</p>
|
Colcon build does not build all of my packages (after I deleted and reinstalled older cmake)
|
<p>Thanks to @SteveMacenski. Upon your comment, I started checking around the Nav2 packages and then taking a close look at the documentation, I found a way to solve the issue.</p>
<p>To have this properly working, I need to parse this parameters file to the NopeOptions arguments, which solved my issue.</p>
<pre><code>rclcpp::NodeOptions()
.allow_undeclared_parameters(true)
.automatically_declare_parameters_from_overrides(true).arguments(
{"--ros-args", "-p", "use_sim_time:=true", "--params-file", "/tmp/foo.yaml"})
</code></pre>
<p>This way when the Node/LifeCycleNode is initialized, these params file is loaded as similar to when parsed command line</p>
|
107521
|
2024-01-10T11:43:39.920
|
|ros2|parameters|rclcpp|parameter-server|
|
<p>I'm currently facing an issue with the ros2 parameters. I'm not sure how to approach this, from Iron on ros2_controller creates a node without the node options <code>allow_undeclared_parameters</code> and <code>automatically_declare_parameters_from_overrides</code>. I would like to define a block of parameters for my controller, however, their namespace is only known at the runtime. This is making it hard for me to load the parameters using the spawner.</p>
<p>A simple case would be something like below:</p>
<pre><code>joints: ["joint_1", "joint_2"]
parameters:
joint_1:
type: rotary
frame: joint_1_link
joint_2:
type: rotary
frame: joint_2_link
</code></pre>
<p>To parse such a block, we need to know the <code>joints</code> parameter already at the time of declaration, and this is currently not possible. So, at the time of declaration, as this is not known, I'm not able to declare the parameter block and hence unable to set any of the respective parameters.</p>
<pre class="lang-cpp prettyprint-override"><code>std::vector<JointParams> joint_params;
auto joint_names = node->declare_parameter<std::vector<std::string>>("joints", std::vector<std::string>());
for (auto joint : joint_names)
{
RCLCPP_INFO(logger, "Adding Joint: %s", joint.c_str());
JointParams params;
params.name = name;
params.type = node->declare_parameter<std::string>("parameters." + name + ".type", std::string());
params.frame = node->declare_parameter<std::string>("parameters." + name + ".frame", std::string());
params.param_name = node->declare_parameter<std::string>(name + ".param_name", std::string());
joint_params.push_back(params);
}
</code></pre>
<p>Moreover, in the existing parameter callbacks(<code>add_pre_set_parameters_callback</code> , <code> add_on_set_parameters_callback</code> , and <code>add_post_set_parameters_callback</code>), we cannot declare or set any parameters, so I would like to know if there is a way to declare some parameters at runtime. If not, I propose to have a new callback method that helps to declare the parameters at runtime or a way to specify to allow undeclared parameters to a specific namespace.</p>
<p>Is there a better way to approach this problem?</p>
|
How to declare parameter that are only known at runtime
|
<p>If there is an API or a device protocol specification available, then it would be possible to develop your own driver for the hardware. This is how all existing drivers for ROS 2 have started.</p>
<p>Typically, people write a library that is independent of ROS, and then provide a ROS wrapper to make the sensor data available over ROS topics/services.</p>
<p>Example drivers that you may want to reference:</p>
<ul>
<li><a href="https://github.com/ros-drivers/velodyne/tree/humble-devel/velodyne_driver" rel="nofollow noreferrer">https://github.com/ros-drivers/velodyne/tree/humble-devel/velodyne_driver</a> - Velodyne LIDAR driver, the lidar connects over ethernet and the driver uses PCAP to receive packets and expand them into <code>sensor_msgs/LaserScan</code></li>
<li><a href="https://github.com/ros-drivers/ros2_ouster_drivers" rel="nofollow noreferrer">https://github.com/ros-drivers/ros2_ouster_drivers</a> - Ouster lidar drivers</li>
<li><a href="https://github.com/ros-drivers/urg_node" rel="nofollow noreferrer">https://github.com/ros-drivers/urg_node</a> - Hokuyo lidar driver, wraps the official <code>urg_c</code> library</li>
</ul>
<p>In the case that a manufacturer does not provide an API, then you will have to write the lower-level hardware driver yourself. An example of this in the above list is the Velodyne driver, where the manufacturer provides a datasheet describing the packet format and the driver interprets the packets accordingly.</p>
|
107528
|
2024-01-10T13:44:05.343
|
|ros2|lidar|
|
<p>I got a new LiDAR from a seller who unfortunately does not provide any ROS2 support. Rather there is only a Point Cloud Visualiser .exe in Windows. I would like to use the LiDAR in my project of developing Autonomous Farming Vehicle but dont know how I can use this in ROS2 without any Package or Driver. Is it possible to use it somehow or develop a ROS2 supported package of the LiDAR??</p>
|
Sensors in ROS2 without driver
|
<p>No, JTC does not support that yet. You have to consider that while planning the trajectory which you send to it.</p>
|
107531
|
2024-01-10T15:10:05.303
|
|ros2|ros2-control|joint-trajectory-controller|ros2-controllers|
|
<p>having setup my igus axis to control it with the joint_trajectory controller it seems that it completely ignores any limits i set in the urdf file.
Is there a fix for this?</p>
<p>urdf joint:</p>
<pre class="lang-xml prettyprint-override"><code> <joint name="<span class="math-container">${prefix}joint1" type="prismatic">
<parent link="$</span>{prefix}base_link"/>
<child link="<span class="math-container">${prefix}link1"/>
<origin xyz="0 $</span>{width1y/2} ${height2/2}" rpy="0 0 0"/>
<axis xyz="0 0 1"/>
<dynamics damping="0.7"/>
<limit lower="0" upper="2" velocity=".05" effort="10"/>
</joint>
</code></pre>
<p>controller:</p>
<pre class="lang-yaml prettyprint-override"><code>
joint_trajectory_position_controller:
ros__parameters:
joints:
- axis_joint1
command_interfaces:
- velocity
state_interfaces:
- position
- velocity
state_publish_rate: 200.0 # Defaults to 50
action_monitor_rate: 20.0 # Defaults to 20
gains:
axis_joint1:
p: 0.5
i: 0.0
d: 0.0
i_clamp: 0.0
ff_velocity_scale: 1.0
allow_partial_joints_goal: true # Defaults to false
open_loop_control: false
allow_integration_in_goal_trajectories: true
<span class="math-container">```</span>
</code></pre>
|
JTC ignores URDF velocity limit
|
<ol>
<li>The <code><plugin></code> should be in the world SDF file (see <a href="https://github.com/gazebosim/gz-sim/blob/ign-gazebo6/examples/worlds/spherical_coordinates.sdf" rel="nofollow noreferrer">example</a>).</li>
<li>The <code><gazebo></code> tag should be directly under <code><robot></code> in a URDF file and should reference the link it's modifying. In your case, it should be <code><gazebo reference="chassis"></code>. You can refer to <a href="http://sdformat.org/tutorials?tut=sdformat_urdf_extensions&cat=specification&" rel="nofollow noreferrer">this</a> documentation for more details on the <code><gazebo></code> tag.</li>
</ol>
|
107536
|
2024-01-11T02:21:33.203
|
|navigation|ros-humble|gps|gazebo-ignition|
|
<p>I'm trying to use the Navsat plugin but I can't get it working. I'm using ros-humble</p>
<p>I've been following the link below, but I am unable to see any navsat topic in gazebo
<a href="https://answers.gazebosim.org//question/28643/gps-sensor-plugin-in-ignition/" rel="nofollow noreferrer">https://answers.gazebosim.org//question/28643/gps-sensor-plugin-in-ignition/</a></p>
<p>In my robot urdf, I have the following code</p>
<pre><code> <link name="chassis">
....
<plugin filename="ignition-gazebo-navsat-system" name="ignition::gazebo::systems::NavSat"/>
<gazebo>
<sensor name="navsat_sensor" type="navsat">
<always_on>1</always_on>
<update_rate>1</update_rate>
<topic>navsat</topic>
</sensor>
</gazebo>
</link>
</code></pre>
<p>On my world sdf, I also included</p>
<pre><code> <world name="field">
...
<spherical_coordinates>
<surface_model>EARTH_WGS84</surface_model>
<world_frame_orientation>ENU</world_frame_orientation>
<latitude_deg>-22.986687</latitude_deg>
<longitude_deg>-43.202501</longitude_deg>
<elevation>0</elevation>
<heading_deg>0</heading_deg>
</spherical_coordinates>
</world>
</code></pre>
|
How to use Gazebo Ignition NavSat plugin
|
<p>Catkin packages has to be found before other packages:</p>
<pre><code>find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
sensor_msgs
# visualization_msgs
geometry_msgs
tf
)
find_package(Eigen3 REQUIRED)
find_package(OpenCV REQUIRED)
find_package(Open3D REQUIRED)
<span class="math-container">```</span>
</code></pre>
|
107552
|
2024-01-12T02:40:46.487
|
|catkin|cmake|roscpp|ros-noetic|
|
<p>when building my ros1 (noetic ubuntu 20.04) package, catkin cmake can't find Catkin packages automatically.
(setting the apth for all works, but it is not the right way: <code>set(roscpp_DIR "/opt/ros/noetic/share/roscpp/cmake")</code>):</p>
<pre><code>CMake Error at /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "roscpp" with any
of the following names:
roscppConfig.cmake
roscpp-config.cmake
Add the installation prefix of "roscpp" to CMAKE_PREFIX_PATH or set
"roscpp_DIR" to a directory containing one of the above files. If "roscpp"
provides a separate development package or SDK, be sure it has been
installed.
</code></pre>
<p>roscpp is installed:</p>
<pre><code>$ apt list | grep roscpp
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
cl-roscpp-msg/focal,focal 1.14.3+ds1-11ubuntu5 all
libroscpp-core-dev/focal 0.6.13-1build1 amd64
libroscpp-dev/focal 1.14.3+ds1-11ubuntu5 amd64
libroscpp-msg-dev/focal 1.14.3+ds1-11ubuntu5 amd64
libroscpp-serialization0d/focal 0.6.13-1build1 amd64
libroscpp2d/focal 1.14.3+ds1-11ubuntu5 amd64
python3-roscpp-msg/focal,focal 1.14.3+ds1-11ubuntu5 all
ros-noetic-roscpp-core/focal,now 0.7.3-1focal.20230620.181838 amd64 [installed,automatic]
ros-noetic-roscpp-dbgsym/focal 1.16.0-1focal.20230620.183307 amd64
ros-noetic-roscpp-serialization-dbgsym/focal 0.7.3-1focal.20230620.181650 amd64
ros-noetic-roscpp-serialization/focal,now 0.7.3-1focal.20230620.181650 amd64 [installed,automatic]
ros-noetic-roscpp-traits/focal,now 0.7.3-1focal.20230620.181518 amd64 [installed,automatic]
ros-noetic-roscpp-tutorials-dbgsym/focal 0.10.2-1focal.20230620.184353 amd64
ros-noetic-roscpp-tutorials/focal,now 0.10.2-1focal.20230620.184353 amd64 [installed,automatic]
ros-noetic-roscpp/focal,now 1.16.0-1focal.20230620.183307 amd64 [installed]
ros-noetic-swri-roscpp-dbgsym/focal 2.15.2-1focal.20231105.165502 amd64
ros-noetic-swri-roscpp/focal 2.15.2-1focal.20231105.165502 amd64
ros-roscpp-msg/focal,focal 1.14.3+ds1-11ubuntu5 all
</code></pre>
<h3>CMakeLists.txt</h3>
<pre><code>cmake_minimum_required(VERSION 3.9.1)
project(myproject VERSION 0.1.0 LANGUAGES CXX)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
SET(CMAKE_CXX_FLAGS "-std=c++17")
find_package(Eigen3 REQUIRED)
find_package(OpenCV REQUIRED)
find_package(Open3D REQUIRED)
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
sensor_msgs
geometry_msgs
tf
)
catkin_package(
INCLUDE_DIRS
include
CATKIN_DEPENDS
std_msgs
sensor_msgs
geometry_msgs
tf
DEPENDS
)
include_directories(
include
<span class="math-container">${catkin_INCLUDE_DIRS}
$</span>{EIGEN3_INCLUDE_DIR}
<span class="math-container">${OpenCV_INCLUDE_DIRS}
$</span>{Open3D_INCLUDE_DIRS}
)
set(target_name workspace_estimator)
add_executable(<span class="math-container">${target_name}
src/$</span>{target_name}_node.cpp
src/${target_name}.cpp
)
target_link_libraries(<span class="math-container">${target_name}
$</span>{catkin_LIBRARIES}
<span class="math-container">${OpenCV_LIBS}
$</span>{Open3D_LIBRARIES}
)
install(
DIRECTORY include/<span class="math-container">${PROJECT_NAME}/
DESTINATION "$</span>{CATKIN_PACKAGE_INCLUDE_DESTINATION}"
)
install(
DIRECTORY config launch
DESTINATION "${CATKIN_PACKAGE_SHARE_DESTINATION}"
)
</code></pre>
|
catkin cmake can't find ros packages
|
<p>Yes, it is possible. There's nothing special about the <code>nav2_behavior_tree</code> package. Here's one such recent example: <a href="https://github.com/open-navigation/opennav_coverage/tree/main/opennav_coverage_bt" rel="nofollow noreferrer">https://github.com/open-navigation/opennav_coverage/tree/main/opennav_coverage_bt</a></p>
|
107553
|
2024-01-12T04:05:14.797
|
|ros|navigation|ros2|ros-humble|nav2|
|
<p>I'm trying to create a <strong>my own custom bt plugin</strong>.
In the official tutorial <a href="https://navigation.ros.org/plugin_tutorials/docs/writing_new_bt_plugin.html" rel="nofollow noreferrer">https://navigation.ros.org/plugin_tutorials/docs/writing_new_bt_plugin.html</a>,
I can't see an instruction or an example on how to create a behavior tree plugin in a separate ros2 package just like in this nav2 repo tutorial <a href="https://github.com/ros-planning/navigation2_tutorials/tree/master" rel="nofollow noreferrer">https://github.com/ros-planning/navigation2_tutorials/tree/master</a> where the custom plugins (custom costmap, behavior, controller and planner) are created in a separate package.</p>
<p>So I'm wondering, is it possible to create the bt plugin/node in a separate package? or I need to install nav2 from source and try to create the bt plugin on the <em>/navigation2/nav2_behavior_tree/plugins</em> folder?</p>
|
Nav2 - How to create a custom behavior tree (BT) plugin/node in a separate ros2 package?
|
<p>I have faced similar problems using controller manager, check the config files, see if all the controller names are defined properly and are written the same in your launch file.</p>
|
107554
|
2024-01-12T04:16:20.673
|
|ros2|
|
<p><a href="https://github.com/ros-controls/ros2_controllers/tree/master/tricycle_controller" rel="nofollow noreferrer">https://github.com/ros-controls/ros2_controllers/tree/master/tricycle_controller</a></p>
<pre><code>ros2 launch articubot_one launch_sim.launch.py
[INFO] [launch]: All log files can be found below /home/amol/.ros/log/2024-01-11-22-15-09-978754-amol-pc-51469
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [51471]
[INFO] [joy_node-2]: process started with pid [51473]
[INFO] [teleop_node-3]: process started with pid [51475]
[INFO] [twist_mux-4]: process started with pid [51477]
[INFO] [gzserver-5]: process started with pid [51479]
[INFO] [gzclient-6]: process started with pid [51481]
[INFO] [spawn_entity.py-7]: process started with pid [51483]
[INFO] [spawner-8]: process started with pid [51517]
[INFO] [spawner-9]: process started with pid [51524]
[robot_state_publisher-1] [INFO] [1704991510.539295126] [robot_state_publisher]: got segment LH_Free_wheel
[robot_state_publisher-1] [INFO] [1704991510.539390449] [robot_state_publisher]: got segment RH_Free_wheel
[robot_state_publisher-1] [INFO] [1704991510.539399567] [robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1704991510.539404579] [robot_state_publisher]: got segment chassis
[robot_state_publisher-1] [INFO] [1704991510.539409356] [robot_state_publisher]: got segment laser_frame
[robot_state_publisher-1] [INFO] [1704991510.539414139] [robot_state_publisher]: got segment steering_wheel
[robot_state_publisher-1] [INFO] [1704991510.539419057] [robot_state_publisher]: got segment traction_wheel
[teleop_node-3] [INFO] [1704991510.565056993] [TeleopTwistJoy]: Teleop enable button 6.
[teleop_node-3] [INFO] [1704991510.565853235] [TeleopTwistJoy]: Turbo on button 7.
[teleop_node-3] [INFO] [1704991510.566464710] [TeleopTwistJoy]: Linear axis x on 1 at scale 0.500000.
[teleop_node-3] [INFO] [1704991510.566887056] [TeleopTwistJoy]: Turbo for linear axis x is scale 1.000000.
[teleop_node-3] [INFO] [1704991510.567365879] [TeleopTwistJoy]: Angular axis yaw on 0 at scale 0.500000.
[teleop_node-3] [INFO] [1704991510.567954660] [TeleopTwistJoy]: Turbo for angular axis yaw is scale 1.000000.
[twist_mux-4] [INFO] [1704991510.572422076] [twist_mux]: Topic handler 'topics.joystick' subscribed to topic 'cmd_vel_joy': timeout = 0.500000s , priority = 100.
[twist_mux-4] [INFO] [1704991510.574910450] [twist_mux]: Topic handler 'topics.navigation' subscribed to topic 'cmd_vel': timeout = 0.500000s , priority = 10.
[twist_mux-4] [INFO] [1704991510.575257542] [twist_mux]: Topic handler 'topics.tracker' subscribed to topic 'cmd_vel_tracker': timeout = 0.500000s , priority = 20.
[spawn_entity.py-7] [INFO] [1704991511.156391724] [spawn_entity]: Spawn Entity started
[spawn_entity.py-7] [INFO] [1704991511.156689624] [spawn_entity]: Loading entity published on topic robot_description
[spawn_entity.py-7] /opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/qos.py:307: UserWarning: DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL is deprecated. Use DurabilityPolicy.TRANSIENT_LOCAL instead.
[spawn_entity.py-7] warnings.warn(
[spawn_entity.py-7] [INFO] [1704991511.158477863] [spawn_entity]: Waiting for entity xml on robot_description
[spawn_entity.py-7] [INFO] [1704991511.169227154] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
[spawn_entity.py-7] [INFO] [1704991511.169488303] [spawn_entity]: Waiting for service /spawn_entity
[spawn_entity.py-7] [INFO] [1704991512.924717393] [spawn_entity]: Calling service /spawn_entity
[spawner-8] [INFO] [1704991513.156890162] [spawner_tri_cont]: Waiting for '/controller_manager' node to exist
[spawner-9] [INFO] [1704991513.162500009] [spawner_joint_broad]: Waiting for '/controller_manager' node to exist
[gzserver-5] [WARN] [1704991513.270410187] [rcl]: Found remap rule '~/out:=scan'. This syntax is deprecated. Use '--ros-args --remap ~/out:=scan' instead.
[gzserver-5] [WARN] [1704991513.274465144] [rcl]: Found remap rule '~/out:=scan'. This syntax is deprecated. Use '--ros-args --remap ~/out:=scan' instead.
[spawn_entity.py-7] [INFO] [1704991513.278257286] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [my_bot]
[gzserver-5] [INFO] [1704991513.299429049] [tricycle_controller]: Subscribe to [/cmd_vel]
[INFO] [spawn_entity.py-7]: process has finished cleanly [pid 51483]
[spawner-8] [INFO] [1704991515.164652001] [spawner_tri_cont]: Waiting for '/controller_manager' node to exist
[spawner-9] [INFO] [1704991515.169179368] [spawner_joint_broad]: Waiting for '/controller_manager' node to exist
[spawner-8] [INFO] [1704991517.171187670] [spawner_tri_cont]: Waiting for '/controller_manager' node to exist
[spawner-9] [INFO] [1704991517.176182756] [spawner_joint_broad]: Waiting for '/controller_manager' node to exist
[spawner-8] [INFO] [1704991519.179196699] [spawner_tri_cont]: Waiting for '/controller_manager' node to exist
[spawner-9] [INFO] [1704991519.182697099] [spawner_joint_broad]: Waiting for '/controller_manager' node to exist
[spawner-8] [ERROR] [1704991521.185940978] [spawner_tri_cont]: Controller manager not available
[spawner-9] [ERROR] [1704991521.189209220] [spawner_joint_broad]: Controller manager not available
[ERROR] [spawner-8]: process has died [pid 51517, exit code 1, cmd '/opt/ros/humble/lib/controller_manager/spawner tri_cont --ros-args'].
[ERROR] [spawner-9]: process has died [pid 51524, exit code 1, cmd '/opt/ros/humble/lib/controller_manager/spawner joint_broad --ros-args'].
</code></pre>
|
facing issue while using tricycle_controller in ros2 humble
|
<p>You can use <a href="https://python-can.readthedocs.io/en/stable/index.html" rel="nofollow noreferrer">python-can</a>. I find the documentation on <a href="https://python-can.readthedocs.io/en/stable/index.html" rel="nofollow noreferrer">https://python-can.readthedocs.io/en/stable/index.html</a> very well written, it should be easy to follow.<br />
I have used this library with ROS 2 without any problem. You can also use it in your ROS 1 package. Note that, drivers are already included in the linux kernel for PCAN.</p>
<p>Don't forget to enable your existing can interface. See <a href="https://python-can.readthedocs.io/en/stable/interfaces/socketcan.html" rel="nofollow noreferrer">https://python-can.readthedocs.io/en/stable/interfaces/socketcan.html</a></p>
<pre class="lang-bash prettyprint-override"><code>sudo ip link set can0 up type can bitrate 250000
</code></pre>
<p>Here is a sample python script to send a message;</p>
<pre class="lang-py prettyprint-override"><code>import can
bus = can.interface.Bus(interface='socketcan', channel='can0')
msg = can.Message(
arbitration_id=0xC0FFEE,
data=[0, 25, 0, 1, 3, 1, 4, 1],
is_extended_id=True
)
bus.send(msg)
</code></pre>
<p>For receiving can messages, I recommend using the <a href="https://python-can.readthedocs.io/en/stable/listeners.html#notifier" rel="nofollow noreferrer">Notifier</a> object. It creates a thread to read messages from the bus and distributes them to listeners, i.e., your callback function to process incoming can messages.</p>
|
107564
|
2024-01-12T14:40:27.780
|
|ros-melodic|ubuntu|python|linux|can|
|
<p>I am trying to use a PCAN-USB device (from Peak-System) to be able to send and receive CAN messages which I would like to use to control a robot using ROS at some point for work.From the research I have done, I have found out that there are different drivers and python libraries and different APIs to achieve what I am looking for. The problem is there is no guides or clear instructions on how to get started.</p>
<p>I go to a page and then it tells me to look at something else and this keeps happening. I would like to use the PEAK-System API and drivers, installed both already but I don't know how to make it work with python but and I am not sure if what I have downloaded is even the right thing.</p>
<p>Essentially what I am looking for is some guidance on how to check if the drivers and API is installed correctly and how to get a simple python script going, and then I'll have something to build on.</p>
<p>I have tried to give as much detail as possible and not make the question too broad sorry if it's still not specific enough.</p>
<p>Thanks.</p>
|
How to send and receive CAN messages on Ubuntu 18.04 using ROS Melodic
|
<p>Dictionaries are not a natively supported type. And we actually encourage things to be strongly typed, where a dictionary is not because it can contain approximately arbitrary data. When you receive a ROS datatype it will be a fully defined datatype with it's own structure.</p>
<p>The best practice is to define a <code>.srv</code> file to contain these along these lines to cover your description above.</p>
<pre><code>uint8 action
---
sensor_msgs/LaserScan lidar_data
geometry_msgs/Pose pose
</code></pre>
<p>Messages to consider:</p>
<ul>
<li><a href="https://github.com/ros2/common_interfaces/blob/rolling/sensor_msgs/msg/LaserScan.msg" rel="nofollow noreferrer">LaserScan</a></li>
<li><a href="https://github.com/ros2/common_interfaces/blob/rolling/geometry_msgs/msg/Pose.msg" rel="nofollow noreferrer">Pose</a></li>
</ul>
|
107580
|
2024-01-13T15:07:10.820
|
|ros2|ros-humble|ompl-ros-interface|
|
<p>I would like to be able to return a dictionary as a Response in my interface,
Is it possible to return a python dictionary or should I write code similar to this:</p>
<pre><code>uint8 action
---
item1Class dict
-- other msg types below ---
</code></pre>
<p>where item1Class is a struct</p>
<pre><code>This is probably not possible, essentially I want:
</code></pre>
<pre><code> observation = {
"lidar": lidar_data,
"pose": {
"positionX": X,
"positionY": Y,
"orientation": yaw,
},
}
</code></pre>
<pre><code>as a srv message where lidar is float32[] and all pose variable are floats.
Whats the best practice using Ros2 to achieve this. Or is this not what srv/msg was intended for?
</code></pre>
|
Ros2 Dictionary srv/msg type
|
<p>I think the simplest way is to make the system somehow ignores the cmd_vel published by Nav2. In my cases usually I would lime to achieve something similar by using an Emergency Stop. Whenever my micro-ROS detect E-Stop conditions it will ignore the cmd_vel and send stop command to the motors. Once the E-Stop is released then it will continue to listen to the cmd_vel. No issue with the Nav2 stack so far</p>
|
107592
|
2024-01-14T13:45:25.617
|
|navigation|ros2|ros-foxy|
|
<p>I have an RC-Car that has object detection and distance estimation implemented. I want the car to stop if it detects a red light while navigating from point A to B. Once the light changes, it should continue navigating to the final destination. I’m relatively new to the navigation stack, so I’m a bit lost with this problem. I’ve read some documentation and tutorials from the <a href="https://navigation.ros.org/index.html" rel="nofollow noreferrer">nav2 tutorials</a> and have found only these possible ways to implement this:</p>
<ol>
<li><p>Utilize the <a href="https://navigation.ros.org/behavior_trees/trees/follow_point.html" rel="nofollow noreferrer">Follow Dynamic Point</a> behavior to calculate a new updated path to the point in front of a traffic light using odometry information. In this approach, I’m not sure how exactly I can measure new coordinates. In case of an error, there could be some deviation from the initial trajectory, which might lead to rotation at the new endpoint.</p>
</li>
<li><p>Implement the <a href="https://github.com/ros-planning/navigation2/blob/main/nav2_behavior_tree/plugins/action/controller_cancel_node.cpp" rel="nofollow noreferrer">Cancel Control Action</a> and update the path as needed later. However, I’m unsure if it’s possible to do this using ROS2 Foxy (I can’t use another ROS2 distribution), as this plugin seems to be available starting from Humble.</p>
</li>
<li><p>Write a custom plugin using C++ to cancel the “FollowPath” action.</p>
</li>
</ol>
<p>Are there other ways to achieve this? I’m completely sure that due to my lack of expertise in navigation, I’m missing some crucial aspects and potential future problems. I would appreciate any information and thoughts!</p>
<p>P.S. Apologies if I missed a discussion where this issue was already addressed.</p>
|
How to stop the robot with nav2 foxy?
|
<p>I'm going to speculate its your TF system. TF is not a lifecycle system, so unless you're resetting the TF buffer / listener in <code>on_deactivate</code>, you're still processing incoming transformation information. Also, subscribers similarly have no lifecycle eq. I'd look at resetting those in on_deactivate as well.</p>
|
107602
|
2024-01-15T08:34:58.870
|
|ros2|rclcpp|spinning|
|
<p>My node which is a critical component of a larger system contains the following interfaces for communicating with other nodes</p>
<ol>
<li>Two action servers</li>
<li>One tf listner</li>
<li>One service server</li>
<li>Four subscribers</li>
<li>Two publishers</li>
</ol>
<p>[running in ros 2 foxy in docker container]</p>
<p>I recently implemented the lifecycle version of this node and the idea was to deactivate the node when not required and save on CPU usage. I followed the following practices while implementing the lifecycle version:</p>
<ul>
<li>Defined all parameters in constructor of class</li>
<li>Initializing pubs,subs,srvers etc all in on_configure callback.</li>
<li>Activating things which could be activated in on_activate callback and controlling rest with bools</li>
<li>Deactivating things which could be deactivated in on_deactivate callback and resetting the bools for all others</li>
<li>resetting all pointers in cleanup</li>
</ul>
<p>My external code which controls the lifecycle of this node uses <code>activate</code> and <code>deactivate</code> states while in operation and <code>configure</code> / <code>cleanup</code> only once per run.</p>
<p>The CPU usage before <code>on_configure</code> is less than 1% which is expected. It goes to 15% on <code>configure</code> but it doesn't change much on <code>activate</code> or <code>deactivate</code>.
(The compute might be going in spinnig and waiting i guess but not sure)</p>
<p>so activating and deactivating is not really giving me what i needed.
I tried moving a few things from cleanup and configure into deactivate and activate CBs and got some improvement like the tf_listner it saved me around 4-5% of cpu. But the rest is still being utilized under the hood in spinning I guess.</p>
<p>Can we do anything else to reduce the usage further ?</p>
|
Lifecycle node consuming cpu in deactivated state
|
<p>Your <code>/tf</code> timestamp values are not consistent. Most likely you have some nodes with <code>use_sim_time</code> parameter set to true, and other nodes with it set to false.</p>
|
107609
|
2024-01-15T14:15:12.250
|
|rviz|robot-localization|ros-humble|tf-tree|
|
<p>how are you all doing?</p>
<p>I've been trying to use the ros humble robot_localization package to estimate my robot's pose using odometry and imu data. The thing is, when the fixed frame is the base_footprint all the robot's TF are parsed ok.</p>
<p><a href="https://i.stack.imgur.com/JntuC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JntuC.png" alt="enter image description here" /></a></p>
<p>When I set my odom frame as the fixed frame some of my transformations break.</p>
<p><a href="https://i.stack.imgur.com/rwln2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rwln2.png" alt="enter image description here" /></a></p>
<p>But if I look at the broadcasted frames the tf tree seems normal.</p>
<p><a href="https://i.stack.imgur.com/w4004.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w4004.png" alt="enter image description here" /></a></p>
<p>Although it isn´t something critical to me, it is bothering me a lot.</p>
<p>Thanks in advance.</p>
|
Rviz Tf breaks when I change fixed frame to odom frame
|
<p>Your transformation matrix for y and z are correct, but the order of multiplication is important in intrinsic rotations. Here you are first rotating about z axis at 180, so pre-multiply the transformation matrix with your end effector matrix</p>
<pre><code>T1 =T_Z180*T0_7
</code></pre>
<p>and now do transformation about the y axis:</p>
<pre><code>Tout = T_Y90*T1
</code></pre>
<p>or you can always directly pre-multuply them in order:</p>
<pre><code>Tout = T_Y90*T_Z180*T0_7
</code></pre>
|
107617
|
2024-01-16T08:08:05.920
|
|c++|forward-kinematics|dh-parameters|rotation|transformation|
|
<p>I am working on a forward kinematics problem where I have already calculated the relevant transformation between the fixed base frame and the end effector frame of the robotic arm using Homogeneous Transformation Matrix. The convention I am following is</p>
<p><span class="math-container">$$ T^{n-1}_{n} = R(z, \theta_n) \cdot Trans(z, d_n) \cdot Trans(x, a_n) \cdot R(x, \alpha_n) $$</span></p>
<p>My issue starts here. The orientation of the end effector as per the urdf of the arm is different from above calculation. So, I have to make some changes to my transformation, i.e., <span class="math-container">$T^{0}_{7}$</span> in order to orient it in the same direction as per the urdf.</p>
<p>In order to do that, I have to rotate <span class="math-container">$T^{0}_{7}$</span> by <code>180 about Z-axis</code>, followed by <code>90 about Y-axis</code>.</p>
<p><strong>My code:</strong></p>
<p>(using <a href="https://eigen.tuxfamily.org/dox/group__QuickRefPage.html" rel="nofollow noreferrer">Eigen C++ library</a> for matrix multiplication)</p>
<pre><code>T0_7 = T0_1*T1_2*T2_3*T3_4*T4_5*T5_6*T6_7;
cout << T0_7 << endl;
T_Z180 << -1, 0, 0, 0,
0, -1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1;
T_Y90 << 0, 0, -1, 0,
0, 1, 0, 0,
1, 0, 0, 0,
0, 0, 0, 1;
cout << T0_7*T_Z180*T_Y90 << endl;
</code></pre>
<p>My question is - Am I doing final transformation correctly in the above code?</p>
<p>I would really appreciate some help with this.</p>
|
How to rotate a Homogeneous Transformation Matrix about multiple axes?
|
<p>I have fixed the issues:</p>
<ol>
<li><p>Teleop not working: I have installed <strong>bcr teleop</strong> for ROS2 branch:
<a href="https://github.com/blackcoffeerobotics/bcr_teleop/tree/ros2" rel="nofollow noreferrer">https://github.com/blackcoffeerobotics/bcr_teleop/tree/ros2</a></p>
<p>git clone -b ros2 <a href="https://github.com/blackcoffeerobotics/bcr_teleop/tree/ros2" rel="nofollow noreferrer">https://github.com/blackcoffeerobotics/bcr_teleop/tree/ros2</a></p>
</li>
<li><p>SWRI Tools, waypoint follower, mapviz, and other issues: I needed to create a new partition to install Ubuntu 22.04 Jammy and afterward install ROS2 Iron. Some methods were not implemented and are not fully integrated with ROS2 Galactic or Humble (Ubuntu 20.04). Therefore the only way I was able to fix the issues was <strong>upgrade the ROS2 distro.</strong></p>
</li>
</ol>
<p>Video of demonstration here: <a href="https://youtu.be/Hw4agX10k9s" rel="nofollow noreferrer">https://youtu.be/Hw4agX10k9s</a></p>
|
107630
|
2024-01-17T00:58:41.583
|
|gps|nav2|build-from-source|turtlebot-navigation|ros-galactic|
|
<p>I've been working through the <a href="https://navigation.ros.org/tutorials/docs/navigation2_with_gps.html" rel="nofollow noreferrer">ROS2 Galactic Navigation2 GPS Waypoint Follower tutorial</a> but am facing issues specifically with running the <strong>interactive waypoint follower script</strong> (Step 3 of Tutorial). My setup involves building <strong>SWRI tools from source for QoS compatibility</strong> as explained here <a href="https://robotics.stackexchange.com/questions/107599/issues-with-interactive-waypoint-follower-in-ros2-galactic-navigation2-gps-waypo">QoS Compatibility Galactic</a>, and I've made several modifications based on community suggestions for ROS2 Galactic.</p>
<p><strong>KEYS MODIFICATIONS AND STEPS</strong></p>
<ol>
<li><strong>Built SWRI Tools from Source:</strong> Due to QoS compatibility issues.</li>
<li><strong>Launched Mapviz Separately:</strong> Using mapviz.launch.py.
Inserted Bing API Key in Mapviz.</li>
<li><strong>Launched Robot Localization Separately:</strong> Using dual_ekf_navsat.launch.py.</li>
<li><strong>Launched Waypoint Follower:</strong> Launched only Gazebo, Sonoma world model, navigation stack, and RViz2 (<strong>gps_waypoint_follower.launch.py</strong>).</li>
</ol>
<p>Launched Mapviz and Robot Localization Separately: I had to comment out mapviz.launch.py and dual_ekf_navsat.launch.py from gps_waypoint_follower.launch.py and launch them separately. Launching them together <strong>prevented the map scenario from loading in Mapviz</strong>, as also noted in <a href="https://github.com/ros-planning/navigation2_tutorials/issues/73" rel="nofollow noreferrer">this issue</a></p>
<ol start="5">
<li><strong>Ran Modified Interactive Waypoint Follower Node:</strong> Adjusted for ROS2 Galactic by removing the "basic_navigator" argument from BasicNavigator in interactive_waypoint_follower.py.</li>
<li><strong>Modified waitUntilNav2Active Function</strong>: As per Steve's suggestion for <a href="https://robotics.stackexchange.com/questions/105711/nav2-interactive-waypoint-follower-example-can-not-get-robot-localization-state">compatibility with ROS2 Galactic and older versions</a> of the nav2_simple_commander package. This modification addresses the robot_localization/get_state service issue in Galactic.</li>
</ol>
<p><strong>CURRENT CHALLENGE</strong></p>
<p>Despite these adjustments, the interactive waypoint functionality <strong>isn't working as expected</strong>. After clicking a location in Mapviz to set a waypoint, <strong>the red arrow does not appear, and the robot doesn't move</strong>. The terminal shows <strong>GPS coordinates</strong> but no further action:</p>
<pre><code>[mapviz-1] [INFO] [1705449673.656384722] [mapviz]: OK
[mapviz-1] [INFO] [1705449684.771503521] [mapviz]: Point in wgs84: -122.455,38.1615
</code></pre>
<p>Image from my attempt (GPS coordinates displayed when clicked on mapviz, any error log on terminal):</p>
<p><a href="https://i.stack.imgur.com/0sRKL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0sRKL.png" alt="enter image description here" /></a></p>
<p><strong>QUESTIONS</strong></p>
<ol>
<li><p><strong>Mapviz Interaction:</strong> Is there a known compatibility issue with Mapviz and ROS2 Galactic that prevents waypoint command triggering?</p>
</li>
<li><p><strong>Tutorial Compatibility:</strong> Are there known issues with completing this tutorial in ROS2 Galactic, specifically with source-built SWRI tools?</p>
</li>
<li><p><strong>Alternative Fixes:</strong> Are there any known fixes or workarounds to get the tutorial running correctly in ROS2 Galactic, either from binaries or source builds?</p>
</li>
</ol>
<p>Any insights or assistance would be greatly appreciated. I'm trying to determine if this is a broader compatibility issue with ROS2 Galactic or if there are specific steps I'm missing.</p>
|
Interactive Waypoint Follower Script in Navigation2 GPS Waypoint Follower Tutorial Not Fully Working for ROS2 Galactic?
|
<p>Clone this into your workspace using the branch corresponding to your ROS distribution.</p>
<p><a href="https://github.com/ros-planning/moveit_msgs" rel="nofollow noreferrer">https://github.com/ros-planning/moveit_msgs</a></p>
|
107642
|
2024-01-17T11:25:48.600
|
|moveit|colcon|
|
<p>i tried <code>rosdep install --from-paths src --ignore-src -r -y</code> and <code>src/*/</code> , <code>src/*/* ..</code></p>
<p>but Cmake can not find it.</p>
<p>So, i tried install it.(move_msgs pkg)</p>
<p>but it was already the newest version</p>
<pre><code>CMake Error at CMakeLists.txt:6 (find_package):
By not providing "Findmoveit_msgs.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"moveit_msgs", but CMake did not find one.
Could not find a package configuration file provided by "moveit_msgs" with
any of the following names:
moveit_msgsConfig.cmake
moveit_msgs-config.cmake
Add the installation prefix of "moveit_msgs" to CMAKE_PREFIX_PATH or set
"moveit_msgs_DIR" to a directory containing one of the above files. If
"moveit_msgs" provides a separate development package or SDK, be sure it
has been installed.
<span class="math-container">```</span>
</code></pre>
|
error in installation moveit2 tutorial
|
<p>After including the <code>ros_control_interface</code> as a dependency in <code>package.xml</code> and <code>CMakeLists</code>, I decided to dump all header paths known by CMake by using this trick:</p>
<p><a href="https://stackoverflow.com/questions/68139352/how-to-print-variables-in-cmake">How to Print Variable in CMake</a></p>
<p>This revealed that bringing in <code>ros_control_interface</code> gave me access to just one MoveIt header I really needed:</p>
<pre><code>#include <moveit_ros_control_interface/ControllerHandle.h>
</code></pre>
<p>Basically I just looked for any header paths known to CMake that contained the string "moveit_ros_control_interface", and then followed a pattern used by other headers which were included successfully to find out the <code>#include</code> did not start with <code>moveit/</code>, etc.</p>
<p>This was of course not documented (but don't worry, I will update the docs when I have more time).</p>
<p>Upon including this header, I gained access to the following namespaces and classes, which is all that was needed to implement a controller handle, and a controller handle allocator:</p>
<ul>
<li><code>controller_interface::Controller</code></li>
<li><code>moveit_controller_manager::MoveItControllerHandle</code></li>
<li><code>moveit_ros_control_interface::ControllerHandleAllocator</code></li>
</ul>
<p>With this, MoveIt finally recognized my custom trajectory controller as a controller it can use. You can see my implementation here:</p>
<ul>
<li><a href="https://github.com/01binary/str1ker/blob/master/src/include/trajectoryController.h" rel="nofollow noreferrer">trajectoryController.h</a></li>
<li><a href="https://github.com/01binary/str1ker/blob/master/src/trajectoryController.cpp" rel="nofollow noreferrer">trajectoryController.cpp</a></li>
</ul>
|
107650
|
2024-01-17T17:10:24.153
|
|moveit|ros-noetic|
|
<p>I wrote my own Joint Trajectory Controller to use with MoveIt instead of the standard <code>velocity_controllers/JointTrajectoryController</code>.</p>
<p>The new controller is loaded and listed by the controller manager, which means that pluginlib is able to find it and load it.</p>
<p>When MoveIt <code>MoveGroup</code> node is launched with Gazebo & RViz and I click Plan & Execute trajectory in RViz, MoveIt then complains it can't find a controller to actuate the joints.</p>
<p>I debugged into Move Group node, and my custom controller is being listed as a "loaded controller", but it can't be used with MoveIt because any controller used with MoveIt needs an Allocator defined.</p>
<p>I found this mentioned in MoveIt 1 documentation for plug-ins:</p>
<p><a href="https://moveit.ros.org/documentation/plugins/#controllerhandleallocator" rel="nofollow noreferrer">https://moveit.ros.org/documentation/plugins/#controllerhandleallocator</a></p>
<blockquote>
<p>By implementing the <a href="https://github.com/ros-planning/moveit/blob/4ac0c7432d335f57aab6836cbcaaac3fccf4b6f9/moveit_plugins/moveit_ros_control_interface/include/moveit_ros_control_interface/ControllerHandle.h" rel="nofollow noreferrer">ControllerHandle.h</a> interface it is possible to offer allocations of handlers for action based controllers. The controller handler are based on the class <a href="https://github.com/ros-planning/moveit/blob/master/moveit_core/controller_manager/include/moveit/controller_manager/controller_manager.h" rel="nofollow noreferrer">MoveItControllerHandle</a>. These handlers communicate with the controller in order to e.g. send trajectories.</p>
</blockquote>
<blockquote>
<p>The interface is defined in <a href="https://github.com/ros-planning/moveit/blob/4ac0c7432d335f57aab6836cbcaaac3fccf4b6f9/moveit_plugins/moveit_ros_control_interface/include/moveit_ros_control_interface/ControllerHandle.h" rel="nofollow noreferrer">ControllerHandle.h</a>.</p>
</blockquote>
<blockquote>
<p>An examplary implementation of this interface is the <a href="https://github.com/ros-planning/moveit/blob/master/moveit_plugins/moveit_ros_control_interface/src/joint_trajectory_controller_plugin.cpp" rel="nofollow noreferrer">joint_trajectory_controller_plugin.cpp</a>. This is also currently the only implementation available.</p>
</blockquote>
<p>However, after adding the following MoveIt 1 dependencies in <code>package.xml</code> and <code>CMakeLists.txt</code>, the headers it's talking about are not found:</p>
<ul>
<li><code>moveit_core</code></li>
<li><code>moveit_ros_control_interface</code></li>
</ul>
<p>For instance, the following includes can't be found by the compiler (normally they would be in <code>${catkin_INCLUDE_DIRS}</code> after telling CMake about a package dependency):</p>
<pre><code>#include <moveit/controller_manager/controller_manager.h>
#include <moveit/moveit_plugins/moveit_ros_control_interface/controller_handle_allocator.h>
#include <moveit/moveit_plugins/moveit_ros_control_interface/moveit_controller_handle.h>
#include <moveit/moveit_plugins/moveit_ros_control_interface/follow_joint_trajectory_controller_handle.h>
</code></pre>
<p>These headers I am trying to include can be seen here:</p>
<p><a href="https://github.com/ros-planning/moveit/tree/master/moveit_plugins" rel="nofollow noreferrer">https://github.com/ros-planning/moveit/tree/master/moveit_plugins</a></p>
<p>What do I do next? Filed an issue in MoveIt repo here:</p>
<p><a href="https://github.com/ros-planning/moveit/issues/3555" rel="nofollow noreferrer">https://github.com/ros-planning/moveit/issues/3555</a></p>
|
How to write a MoveIt Controller Allocator
|
<p>The error was caused by the collision engine ode . I changed it to the bullet engine, now everything works fine.</p>
|
107660
|
2024-01-18T13:55:35.137
|
|gazebo-plugin|joint|errors|px4|
|
<p>I designed a model in Fusion and exported it to to SDF using SDFusion script.</p>
<p>Till now everything seems to work fine, the 2 of the 4 joints did not cause any problems and worked ok, but when I add the plugin for the other 2 joints I get this error:</p>
<pre><code> ODE INTERNAL ERROR 1: assertion "aabbBound >= dMinIntExact && aabbBound < dMaxIntExact" failed in collide() [collision_space.cpp:460]
Stack trace (most recent call last):
#31 Object "gz sim --verbose=1 -r -s /home/joseph/px4_14/PX4-Autopilot/Tools/simulation/gz/worlds/default.sdf", at 0x557039bab1cd, in _start
#30 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7ff289a76082, in __libc_start_main
#29 Object "gz sim --verbose=1 -r -s /home/joseph/px4_14/PX4-Autopilot/Tools/simulation/gz/worlds/default.sdf", at 0x557039bab17e, in
#28 Object "/lib/x86_64-linux-gnu/libruby-2.7.so.2.7", at 0x7ff289cf245d, in ruby_run_node
#27 Object "/lib/x86_64-linux-gnu/libruby-2.7.so.2.7", at 0x7ff289ced5f0, in
#26 Object "/lib/x86_64-linux-gnu/libruby-2.7.so.2.7", at 0x7ff289e5cd01, in rb_vm_exec
#25 Object "/lib/x86_64-linux-gnu/libruby-2.7.so.2.7", at 0x7ff289e565f0, in
#24 Object "/lib/x86_64-linux-gnu/libruby-2.7.so.2.7", at 0x7ff289e45815, in
#23 Object "/lib/x86_64-linux-gnu/libruby-2.7.so.2.7", at 0x7ff289e5f2ea, in
#22 Object "/lib/x86_64-linux-gnu/libruby-2.7.so.2.7", at 0x7ff289e524c4, in
#21 Object "/usr/lib/x86_64-linux-gnu/ruby/2.7.0/fiddle.so", at 0x7ff285a96714, in
#20 Object "/lib/x86_64-linux-gnu/libruby-2.7.so.2.7", at 0x7ff289e23939, in rb_nogvl
#19 Object "/usr/lib/x86_64-linux-gnu/ruby/2.7.0/fiddle.so", at 0x7ff285a968fb, in
#18 Object "/lib/x86_64-linux-gnu/libffi.so.7", at 0x7ff285a41409, in
#17 Object "/lib/x86_64-linux-gnu/libffi.so.7", at 0x7ff285a41ff4, in
#16 Object "/usr/lib/x86_64-linux-gnu/libgz-sim7-gz.so.7.6.0", at 0x7ff284fefc0d, in runServer
#15 Object "/lib/x86_64-linux-gnu/libgz-sim7.so.7", at 0x7ff284bdf85b, in gz::sim::v7::Server::Run(bool, unsigned long, bool)
#14 Object "/lib/x86_64-linux-gnu/libgz-sim7.so.7", at 0x7ff284beb20e, in
#13 Object "/lib/x86_64-linux-gnu/libgz-sim7.so.7", at 0x7ff284bfbdd2, in gz::sim::v7::SimulationRunner::Run(unsigned long)
#12 Object "/lib/x86_64-linux-gnu/libgz-sim7.so.7", at 0x7ff284bfb570, in gz::sim::v7::SimulationRunner::Step(gz::sim::v7::UpdateInfo const&)
#11 Object "/lib/x86_64-linux-gnu/libgz-sim7.so.7", at 0x7ff284bf4299, in gz::sim::v7::SimulationRunner::UpdateSystems()
#10 Object "/usr/lib/x86_64-linux-gnu/gz-sim-7/plugins/libgz-sim-physics-system.so", at 0x7ff2745d50a3, in gz::sim::v7::systems::Physics::Update(gz::sim::v7::UpdateInfo const&, gz::sim::v7::EntityComponentManager&)
#9 Object "/usr/lib/x86_64-linux-gnu/gz-sim-7/plugins/libgz-sim-physics-system.so", at 0x7ff2745beb6a, in gz::sim::v7::systems::PhysicsPrivate::Step(std::chrono::duration<long, std::ratio<1l, 1000000000l> > const&)
#8 Object "/usr/lib/x86_64-linux-gnu/gz-physics-6/engine-plugins/libgz-physics-dartsim-plugin.so", at 0x7ff25c7ecb0b, in gz::physics::dartsim::SimulationFeatures::WorldForwardStep(gz::physics::Identity const&, gz::physics::SpecifyData<gz::physics::RequireData<gz::physics::WorldPoses>, gz::physics::ExpectData<gz::physics::ChangedWorldPoses, gz::physics::Contacts, gz::physics::JointPositions> >&, gz::physics::CompositeData&, gz::physics::ExpectData<gz::physics::ApplyExternalForceTorques, gz::physics::ApplyGeneralizedForces, gz::physics::VelocityControlCommands, gz::physics::ServoControlCommands, std::chrono::duration<long, std::ratio<1l, 1000000000l> > > const&)
#7 Object "/lib/x86_64-linux-gnu/libdart.so.6", at 0x7ff25c4c2d20, in dart::simulation::World::step(bool)
#6 Object "/lib/x86_64-linux-gnu/libdart.so.6", at 0x7ff25c4a77b5, in dart::constraint::ConstraintSolver::solve()
#5 Object "/lib/x86_64-linux-gnu/libdart.so.6", at 0x7ff25c4a627d, in dart::constraint::ConstraintSolver::updateConstraints()
#4 Object "/lib/x86_64-linux-gnu/libdart-collision-ode.so.6", at 0x7ff25c610b6b, in dart::collision::OdeCollisionDetector::collide(dart::collision::CollisionGroup*, dart::collision::CollisionOption const&, dart::collision::CollisionResult*)
#3 Object "/lib/x86_64-linux-gnu/libode.so.8", at 0x7ff25be00456, in dxHashSpace::collide(void*, void (*)(void*, dxGeom*, dxGeom*))
#2 Object "/lib/x86_64-linux-gnu/libode.so.8", at 0x7ff25be08c57, in dDebug
#1 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7ff289a74858, in abort
#0 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7ff289a9500b, in gsignal
Aborted (Signal sent by tkill() 68794 1000)
</code></pre>
<p>And my sdf file is this:</p>
<pre><code><?xml version="1.0" ?>
<sdf version="1.6">
<model name="VA25_VTOL_8">
<link name="left_aileron">
<self_collide>false</self_collide>
<pose>0.7838276492938377 0.7437513761748877 0.3226151407425975 0.0 -0.0 0.0</pose>
<inertial>
<pose>0.0 0.0 0.0 0 0 0</pose>
<mass>0.2075195906736219</mass>
<inertia>
<ixx>0.004639328106225412</ixx>
<ixy>0.00011534778131801886</ixy>
<ixz>-3.3698935533152508e-06</ixz>
<iyy>3.622073888525393e-05</iyy>
<iyz>1.1542852124915726e-05</iyz>
<izz>0.004671151873854069</izz>
</inertia>
</inertial>
<collision name="left_aileron_collision">
<geometry>
<mesh>
<uri>model://VA25_VTOL_8/meshes/CAD/left_aileron.stl</uri>
<scale>0.01 0.01 0.01</scale>
</mesh>
</geometry>
</collision>
<visual name="left_aileron_visual">
<geometry>
<mesh>
<uri>model://VA25_VTOL_8/meshes/CAD/left_aileron.stl</uri>
<scale>0.01 0.01 0.01</scale>
</mesh>
</geometry>
<material>
<ambient>0 0 1 1.0</ambient>
<diffuse>0 0 1 1.0</diffuse>
</material>
</visual>
</link>
<link name="right_aileron">
<self_collide>false</self_collide>
<pose>0.7841266999404997 -0.6799887781862646 0.32260314824080005 0.0 -0.0 0.0</pose>
<inertial>
<pose>0.0 0.0 0.0 0 0 0</pose>
<mass>0.207508066232339</mass>
<inertia>
<ixx>0.004639128589166831</ixx>
<ixy>-0.00011534518553532963</ixy>
<ixz>-3.3698325271302566e-06</ixz>
<iyy>3.621969166158579e-05</iyy>
<iyz>-1.154250086589741e-05</iyz>
<izz>0.004670951608339374</izz>
</inertia>
</inertial>
<collision name="right_aileron_collision">
<geometry>
<mesh>
<uri>model://VA25_VTOL_8/meshes/CAD/right_aileron.stl</uri>
<scale>0.01 0.01 0.01</scale>
</mesh>
</geometry>
</collision>
<visual name="right_aileron_visual">
<geometry>
<mesh>
<uri>model://VA25_VTOL_8/meshes/CAD/right_aileron.stl</uri>
<scale>0.01 0.01 0.01</scale>
</mesh>
</geometry>
<material>
<ambient>0 0 1 1.0</ambient>
<diffuse>0 0 1 1.0</diffuse>
</material>
</visual>
</link>
<link name="left_ruddervator">
<self_collide>false</self_collide>
<pose>0.019245965210225736 0.15184614204919272 0.4017142660362421 0.0 -0.0 0.0</pose>
<inertial>
<pose>0.0 0.0 0.0 0 0 0</pose>
<mass>0.05522739640235409</mass>
<inertia>
<ixx>0.00038256835251192884</ixx>
<ixy>2.0938677507076166e-05</ixy>
<ixz>2.0893317350946816e-05</ixz>
<iyy>0.00020035459730011527</iyy>
<iyz>-0.00019115648057952797</iyz>
<izz>0.00020036995484959148</izz>
</inertia>
</inertial>
<visual name="left_ruddervator_visual">
<geometry>
<mesh>
<uri>model://VA25_VTOL_8/meshes/CAD/left_ruddervator.stl</uri>
<scale>0.01 0.01 0.01</scale>
</mesh>
</geometry>
<material>
<ambient>0 0 1 1.0</ambient>
<diffuse>0 0 1 1.0</diffuse>
</material>
</visual>
</link>
<link name="right_ruddervator">
<self_collide>false</self_collide>
<pose>0.019249698492502014 -0.1515642581504666 0.40148577356656384 0.0 -0.0 0.0</pose>
<inertial>
<pose>0.0 0.0 0.0 0 0 0</pose>
<mass>0.05522723094122592</mass>
<inertia>
<ixx>0.0003825683512394051</ixx>
<ixy>-2.089331982008309e-05</ixy>
<ixz>2.09386804012488e-05</ixz>
<iyy>0.0002003699179794211</iyy>
<iyz>0.0001911564803055427</iyz>
<izz>0.00020035456240694014</izz>
</inertia>
</inertial>
<visual name="right_ruddervator_visual">
<geometry>
<mesh>
<uri>model://VA25_VTOL_8/meshes/CAD/right_ruddervator.stl</uri>
<scale>0.01 0.01 0.01</scale>
</mesh>
</geometry>
<material>
<ambient>0 0 1 1.0</ambient>
<diffuse>0 0 1 1.0</diffuse>
</material>
</visual>
</link>
<link name="base">
<self_collide>false</self_collide>
<pose>0.9024726334202346 0.01159045634930561 0.2795115726981846 0.0 -0.0 0.0</pose>
<inertial>
<pose>0.0 0.0 0.0 0 0 0</pose>
<mass>38.85005456400121</mass>
<inertia>
<ixx>4.773862562333618</ixx>
<ixy>-0.002871126139243279</ixy>
<ixz>0.09901728719870735</ixz>
<iyy>2.399717603969929</iyy>
<iyz>-0.020853780404358212</iyz>
<izz>6.9366771796705144</izz>
</inertia>
</inertial>
<collision name="base_collision">
<geometry>
<mesh>
<uri>model://VA25_VTOL_8/meshes/CAD/base.stl</uri>
<scale>0.01 0.01 0.01</scale>
</mesh>
</geometry>
</collision>
<visual name="base_visual">
<geometry>
<mesh>
<uri>model://VA25_VTOL_8/meshes/CAD/base.stl</uri>
<scale>0.01 0.01 0.01</scale>
</mesh>
</geometry>
<material>
<ambient>.175 .175 .175 1.0</ambient>
<diffuse>.175 .175 .175 1.0</diffuse>
</material>
</visual>
<gravity>1</gravity>
<velocity_decay/>
<self_collide>0</self_collide>
<sensor name="imu_sensor" type="imu">
<always_on>1</always_on>
<update_rate>250</update_rate>
</sensor>
<sensor name="air_pressure_sensor" type="air_pressure">
<always_on>1</always_on>
<update_rate>50</update_rate>
<air_pressure>
<pressure>
<noise type="gaussian">
<mean>0</mean>
<stddev>0.01</stddev>
</noise>
</pressure>
</air_pressure>
</sensor>
</link>
<joint name="left_aileron_joint" type="revolute">
<parent>base</parent>
<child>left_aileron</child>
<pose>0.016164280041980846 0.034657323358010785 -0.005562735333249265 0 0 0</pose>
<axis>
<xyz>-0.037678878844781175 0.9992887623566787 0.00150715515379122</xyz>
<limit>
<lower>-0.6981317007977318</lower>
<upper>0.6981317007977318</upper>
</limit>
<use_parent_model_frame>0</use_parent_model_frame>
</axis>
</joint>
<joint name="right_aileron_joint" type="revolute">
<parent>base</parent>
<child>right_aileron</child>
<pose>0.015865229395315622 -0.03464405123119874 -0.005550742831451671 0 0 0</pose>
<axis>
<xyz>0.03767887884479353 0.9992887623566784 -0.0015071551537917574</xyz>
<limit>
<lower>-0.6981317007977318</lower>
<upper>0.6981317007977318</upper>
</limit>
<use_parent_model_frame>0</use_parent_model_frame>
</axis>
</joint>
<joint name="left_ruddervator_joint" type="revolute">
<parent>base</parent>
<child>left_ruddervator</child>
<pose>0.016004672326555003 0.003273461396103041 0.0033801627997988247 0 0 0</pose>
<axis>
<xyz>-0.08156122422289849 0.7047509371058911 0.7047509371058904</xyz>
<limit>
<lower>-0.6981317007977318</lower>
<upper>0.6981317007977318</upper>
</limit>
<use_parent_model_frame>0</use_parent_model_frame>
</axis>
</joint>
<joint name="right_ruddervator_joint" type="revolute">
<parent>base</parent>
<child>right_ruddervator</child>
<pose>0.016000939044278732 -0.0034122222669650706 0.003305665389560062 0 0 0</pose>
<axis>
<xyz>-0.08156122422289848 -0.7047509371058905 0.7047509371058909</xyz>
<limit>
<lower>-0.6981317007977318</lower>
<upper>0.6981317007977318</upper>
</limit>
<use_parent_model_frame>0</use_parent_model_frame>
</axis>
</joint>
<plugin filename="gz-sim-lift-drag-system" name="gz::sim::systems::LiftDrag">
<a0>0.05984281113</a0>
<cla>4.752798721</cla>
<cda>0.6417112299</cda>
<cma>0.0</cma>
<alpha_stall>0.3391428111</alpha_stall>
<cla_stall>-3.85</cla_stall>
<cda_stall>-0.9233984055</cda_stall>
<cma_stall>0</cma_stall>
<cp>-0.05 0.3 0.05</cp>
<area>0.50</area>
<air_density>1.2041</air_density>
<forward>1 0 0</forward>
<upward>0 0 1</upward>
<link_name>base</link_name>
<control_joint_name>left_aileron_joint</control_joint_name>
<control_joint_rad_to_cl>-1.0</control_joint_rad_to_cl>
</plugin>
<plugin filename="gz-sim-joint-position-controller-system" name="gz::sim::systems::JointPositionController">
<joint_name>left_aileron_joint</joint_name>
<sub_topic>servo_0</sub_topic>
</plugin>
<plugin filename="gz-sim-joint-position-controller-system" name="gz::sim::systems::JointPositionController">
<joint_name>right_aileron_joint</joint_name>
<sub_topic>servo_1</sub_topic>
</plugin>
</model>
</sdf>
</code></pre>
<p>As this file works as intended and raises no errors, until I add these lines for other 2 joints:</p>
<pre><code> <plugin filename="gz-sim-joint-position-controller-system" name="gz::sim::systems::JointPositionController">
<joint_name>left_ruddervator_joint</joint_name>
<sub_topic>servo_2</sub_topic>
</plugin>
<plugin filename="gz-sim-joint-position-controller-system" name="gz::sim::systems::JointPositionController">
<joint_name>right_ruddervator_joint</joint_name>
<sub_topic>servo_3</sub_topic>
</plugin>
</code></pre>
<p>I tried to adjust the collision objects, or delete them all as it looks like something with collision objects. But the result was still the same. My setup is Gazebo garden and ubuntu 20.04</p>
|
Adding joint plugins cause ODE internal error
|
<p>From the logs, you just launch the bringup nodes, so the robot was waiting the commands.
You should open a new terminal and launch the teleop launch. You can follow <a href="https://emanual.robotis.com/docs/en/platform/turtlebot3/basic_operation/#basic-operation" rel="nofollow noreferrer">this guide</a>, be sure to let the bringup terminal open and working.
To see that bringup works, you can look in the same guide the <a href="https://emanual.robotis.com/docs/en/platform/turtlebot3/bringup/#bringup" rel="nofollow noreferrer">previous page</a></p>
|
107661
|
2024-01-18T14:07:21.893
|
|ros-humble|turtlebot3|
|
<p>I want to use the turtlebot3. Therefor I've installed ROS2 Humble on my PC and the RaspberryPi 4. After the successful bringup of the Turtlebot it looks like this:</p>
<p><a href="https://i.stack.imgur.com/RIuB1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RIuB1.png" alt="enter image description here" /></a></p>
<p>But when I use the command ros2 topic list I only get this as a result:</p>
<p>/parameter_events</p>
<p>/rosout</p>
<p>I think this is also the reason why I cant control the TurtleBot with my Keyboard.
Do you have any ideas what I've done wrong?</p>
<p>I'm not quite sure what else you could need from me. Feel free to ask.</p>
|
Topic List and Service List empty
|
<p><code>ublox_msgs/serialization.hpp</code> is part of the repository you provided. How do you build your workspace? <code>colcon build</code> considers the dependencies and would have built the ublox_msgs package before.</p>
|
107664
|
2024-01-18T15:33:15.523
|
|ros|ros2|ros-humble|
|
<p>I'm trying to build an old package. I'm not able to build the package successfully. Here is the repo for the trial. I'm using ROS2-humble</p>
<pre><code>https://github.com/gokulp01/ros2-ublox-zedf9p.git
</code></pre>
<p>I would like to share my error for reference.</p>
<pre><code> from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/ublox_firmware.hpp:9,
from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/src/ublox_firmware6.cpp:21:
/home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/gps.hpp:43:10: fatal error: ublox_msgs/serialization.hpp: No such file or directory
43 | #include <ublox_msgs/serialization.hpp>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/component_interface.hpp:35,
from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/ublox_firmware.hpp:9,
from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/src/ublox_firmware.cpp:7:
/home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/gps.hpp:43:10: fatal error: ublox_msgs/serialization.hpp: No such file or directory
43 | #include <ublox_msgs/serialization.hpp>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/ublox_gps.dir/build.make:244: CMakeFiles/ublox_gps.dir/src/ublox_firmware6.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[2]: *** [CMakeFiles/ublox_gps.dir/build.make:230: CMakeFiles/ublox_gps.dir/src/ublox_firmware.cpp.o] Error 1
In file included from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/src/hpg_rov_product.cpp:13:
/home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/gps.hpp:43:10: fatal error: ublox_msgs/serialization.hpp: No such file or directory
43 | #include <ublox_msgs/serialization.hpp>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/src/tim_product.cpp:14:
/home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/gps.hpp:43:10: fatal error: ublox_msgs/serialization.hpp: No such file or directory
43 | #include <ublox_msgs/serialization.hpp>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/ublox_gps.dir/build.make:146: CMakeFiles/ublox_gps.dir/src/hpg_rov_product.cpp.o] Error 1
gmake[2]: *** [CMakeFiles/ublox_gps.dir/build.make:216: CMakeFiles/ublox_gps.dir/src/tim_product.cpp.o] Error 1
In file included from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/ublox_firmware8.hpp:16,
from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/src/ublox_firmware9.cpp:9:
/home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/gps.hpp:43:10: fatal error: ublox_msgs/serialization.hpp: No such file or directory
43 | #include <ublox_msgs/serialization.hpp>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/ublox_gps.dir/build.make:286: CMakeFiles/ublox_gps.dir/src/ublox_firmware9.cpp.o] Error 1
In file included from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/ublox_firmware7.hpp:16,
from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/src/ublox_firmware7.cpp:14:
/home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/gps.hpp:43:10: fatal error: ublox_msgs/serialization.hpp: No such file or directory
43 | #include <ublox_msgs/serialization.hpp>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/component_interface.hpp:35,
from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/hpg_ref_product.hpp:12,
from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/src/hpg_ref_product.cpp:15:
/home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/gps.hpp:43:10: fatal error: ublox_msgs/serialization.hpp: No such file or directory
43 | #include <ublox_msgs/serialization.hpp>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/ublox_firmware8.hpp:16,
from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/src/ublox_firmware8.cpp:16:
/home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/gps.hpp:43:10: fatal error: ublox_msgs/serialization.hpp: No such file or directory
43 | #include <ublox_msgs/serialization.hpp>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/ublox_gps.dir/build.make:132: CMakeFiles/ublox_gps.dir/src/hpg_ref_product.cpp.o] Error 1
In file included from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/component_interface.hpp:35,
from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/adr_udr_product.hpp:20,
from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/src/adr_udr_product.cpp:20:
/home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/gps.hpp:43:10: fatal error: ublox_msgs/serialization.hpp: No such file or directory
43 | #include <ublox_msgs/serialization.hpp>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/ublox_gps.dir/build.make:258: CMakeFiles/ublox_gps.dir/src/ublox_firmware7.cpp.o] Error 1
gmake[2]: *** [CMakeFiles/ublox_gps.dir/build.make:272: CMakeFiles/ublox_gps.dir/src/ublox_firmware8.cpp.o] Error 1
gmake[2]: *** [CMakeFiles/ublox_gps.dir/build.make:76: CMakeFiles/ublox_gps.dir/src/adr_udr_product.cpp.o] Error 1
In file included from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/src/raw_data_product.cpp:11:
/home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/gps.hpp:43:10: fatal error: ublox_msgs/serialization.hpp: No such file or directory
43 | #include <ublox_msgs/serialization.hpp>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/ublox_gps.dir/build.make:202: CMakeFiles/ublox_gps.dir/src/raw_data_product.cpp.o] Error 1
In file included from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/hp_pos_rec_product.hpp:14,
from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/src/hp_pos_rec_product.cpp:14:
/home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/gps.hpp:43:10: fatal error: ublox_msgs/serialization.hpp: No such file or directory
43 | #include <ublox_msgs/serialization.hpp>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/ublox_gps.dir/build.make:118: CMakeFiles/ublox_gps.dir/src/hp_pos_rec_product.cpp.o] Error 1
In file included from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/component_interface.hpp:35,
from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/adr_udr_product.hpp:20,
from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/src/node.cpp:58:
/home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/gps.hpp:43:10: fatal error: ublox_msgs/serialization.hpp: No such file or directory
43 | #include <ublox_msgs/serialization.hpp>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/ublox_gps.dir/build.make:174: CMakeFiles/ublox_gps.dir/src/node.cpp.o] Error 1
In file included from /home/fire/src/ros2-ublox-zedf9p/ublox_gps/src/gps.cpp:44:
/home/fire/src/ros2-ublox-zedf9p/ublox_gps/include/ublox_gps/gps.hpp:43:10: fatal error: ublox_msgs/serialization.hpp: No such file or directory
43 | #include <ublox_msgs/serialization.hpp>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/ublox_gps.dir/build.make:104: CMakeFiles/ublox_gps.dir/src/gps.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:141: CMakeFiles/ublox_gps.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed <<< ublox_gps [0.62s, exited with code 2]
Summary: 2 packages finished [5.83s]
1 package failed: ublox_gps
1 package had stderr output: ublox_gps
1 package not processed```
Any assistance would be greatly appreciated.
Thank you in advance
Adithya
</code></pre>
|
Colcon build unsuccessful
|
<p>This error is because you are compiling C++ code with GCC (C compiler). The <strong>meaning of the error</strong> is that GCC can not find <code>new</code> and <code>delete</code> operators during the linking phase, which is because GCC does not link to the C++ standard library by default.</p>
<p>When compiling your C++ file, replace <code>gcc</code> with <code>g++</code>. It should be:</p>
<pre><code>/usr/bin/g++ -g /path/to/file.cpp -o /path/to/desired_name
</code></pre>
<p>I just tried your code sample with <code>g++</code>, and it works with no problems.</p>
<p>If this is a small example, and you want to apply changes to a bigger project, the compiler should be correctly set in the package/project's CMakeLists.txt file. Please let me know if my suggestion did not fix this issue.</p>
|
107672
|
2024-01-19T01:36:51.500
|
|c++|
|
<p>This code is a very simple extract from what I am really writing. But I am getting stuck on references and dereferencing. To explain this. NodeHandle stands in for a very large class from my framework. Arm is a class I am writing which should contain a reference to a NodeHandle. I want a variable globalArm to be of type Arm. Then in the main program I want to create a NodeHandle and I want to use setNodeHandle to store the reference to that NodeHandle into the Arm.</p>
<p>Here is the code that won't work as is. I've tried a lot of permutations. (p.s. ChatGPT is no help!)</p>
<pre><code>#include <array>
class NodeHandle {
public:
std::array<int, 10000> data;
NodeHandle() {
// Initialize the array to zero
data.fill(0);
}
};
class Arm {
public:
NodeHandle* nodeHandle;
Arm() : nodeHandle(nullptr) {}
void setNodeHandle(NodeHandle& nh) {
nodeHandle = &nh;
}
};
// Global variable of type Arm
Arm globalArm;
int main() {
// Allocate NodeHandle on the heap
NodeHandle* nodeHandle = new NodeHandle();
// Set the NodeHandle reference in globalArm
globalArm.setNodeHandle(*nodeHandle);
return 0;
}
</code></pre>
<p>When I compile and Link it I get this:</p>
<pre><code>Starting build...
/usr/bin/gcc -fdiagnostics-color=always -g /Users/pitosalas/mydev/gpg_bran4/deleteme.cpp -o /Users/pitosalas/mydev/gpg_bran4/deleteme
ld: Undefined symbols:
operator delete(void*), referenced from:
_main in deleteme-907409.o
operator new(unsigned long), referenced from:
_main in deleteme-907409.o
___gxx_personality_v0, referenced from:
/private/var/folders/g0/kks4z5dx6hbfhwvrw0zsgbn00000gn/T/deleteme-907409.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Build finished with error(s).
</code></pre>
|
C++ Code is giving an error that I can't understand:
|
<p>I realized I was not using the correct path for sourcing setup.bash</p>
|
107673
|
2024-01-19T02:26:26.127
|
|ros2|message-filters|ros-galactic|
|
<p>I'm trying to figure out how to use message filters in ROS2 galactic in python. From this example <a href="https://github.com/ros2/message_filters/blob/rolling/test/test_approxsync.py" rel="nofollow noreferrer">https://github.com/ros2/message_filters/blob/rolling/test/test_approxsync.py</a> I see that</p>
<pre><code>import message_filters
</code></pre>
<p>should work, but I'm getting a error:</p>
<pre><code>ModuleNotFoundError: No Module name 'message_filters'
</code></pre>
<p>Is there a ROS2 package I'm missing? Is there a different way I should be importing and using message filters in ROS2?</p>
|
ROS2 message filters
|
<p>The iRobot models 627, i7, and j7 are consumer-grade robotic vacuum cleaners and are not natively compatible with ROS. Do not expect the same level of programmability or integration capabilities as the Create 3.</p>
<p>The Create series is designed for robotic development and is compatible with ROS 2. Create 3 is actually the base for Turtlebot 4. My answer is that it should be Create 3 or a custom robot you make.</p>
<p>If getting it is hard, and there are no alternatives in your region, why don't you try making your own mobile robot? This will help you much more than just trying ROS 2. This <a href="https://articulatedrobotics.xyz/mobile-robot-full-list/" rel="nofollow noreferrer">series</a> is a good resource for that.</p>
|
107674
|
2024-01-19T03:38:30.750
|
|ros2|irobot-create|
|
<p>I plan to buy an iRobot to test ROS2, but the Create 3 not available in my country, import tax and shipping cost may very high, also sometime custom will reject the import. But many other model from iRobot available like 627, I7, J7 ..., So what model compatible with ROS? Or I should by the Create 3.</p>
|
iRobot Roomba compatible with ROS2 other than the Create?
|
<p>In the context of collision checking, using primitive shapes (like boxes, cylinders, and spheres) defined in the URDF is faster and more efficient than using equivalent STL or OBJ (mesh) files that represent these geometries.</p>
<p>Primitive shapes have fewer parameters to be considered during collision detection, reducing the computational load. Mesh files, even those representing simple geometries, contain many more data points (vertices and edges), making the collision detection process more resource-intensive because the process will include checking every vertex.</p>
<p>It is recommended to use <strong>meshes for visualization</strong> and <strong>primitive models for collision checking</strong>. Inside the link we have <code><visual></code> and <code><collision></code> tags. The <code><visual></code> is used for rendering robot links in simulations, where the detailed geometry of mesh files is beneficial. The <code><collision></code> tag defines the geometry used for collision detection, where primitives simplicity is more advantageous due to their lower computation cost.</p>
<p>We can use programs like <a href="https://www.meshlab.net" rel="nofollow noreferrer">MeshLab</a> to see the number of vertices on STL meshes, and we can even use the same software to simplify the mesh, but primitives will still be more efficient.</p>
|
107679
|
2024-01-19T08:41:47.307
|
|moveit|simulation|stl|collision-detection|
|
<p>I am wondering whether collision checking using primitive shapes (defined in the URDF) is faster than using equivalent .STL or .obj geometries.</p>
<p>With equivalent i mean creating cylinders, spheres and boxes in a cad software to enclose the robot goemetry (in <em>solidworks</em> using different <a href="https://help.solidworks.com/2021/english/SolidWorks/sldworks/c_Configurations_Overview.htm" rel="nofollow noreferrer">configuratons </a> ) and exporting those geometries in .STL files</p>
|
Is collision checking easier when using primitves vs equivalent stls (moveit)
|
<p>I found this <a href="https://github.com/ros2/examples/blob/humble/rclcpp/actions/minimal_action_client/member_functions.cpp" rel="nofollow noreferrer">example</a> and I realized that the class <code>rclcpp_action::ClientGoalHandle<T>::WrappedResult</code> already has the attribute <code>code</code> (that can be either <code>rclcpp_action::ResultCode::SUCCEEDED</code> , <code>rclcpp_action::ResultCode::ABORTED</code> or <code>rclcpp_action::ResultCode::CANCELLED</code>) so there is no need of putting this information in the action interface.</p>
|
107697
|
2024-01-19T15:22:29.040
|
|ros2|c++|nav2|turtlebot4|
|
<p>I am migrating a node that send goals to nav2 (originally move_base) thru an action since I need to know if it has been reached or cancelled by the planner.</p>
<p>It will work with the Turtlebot4. I've been reading the nav2 documentation and launching the nav2 launch of Turtlebot4 and I guess that I need to call the action <code>/navigate_to_pose</code> of the node <code>bt_navigator</code>. However showing the interface, I see that the result is a <code>std_msgs/Empty</code>.</p>
<p>How can I easily send goals to Turtlebot4 from a cpp node and know the status of the navigation (i.e. goal reached/cancelled/travelling)?</p>
|
turtlebot4 nav2: how to call action navigateToPose from node in cpp
|
<p>Ok, i deleted my ubuntu distribution and tried to install and build harmonic sources from the scratch in a fresh ubuntu distro.</p>
<p>This did the trick, while doing everything everything step by step from the install instructions again. Only issue is one warning about optix:</p>
<pre><code>stderr: gz-rendering8
CMake Warning at /mnt/d/GIT_Repositories/gz-harmonic/install/share/cmake/gz-cmake3/cmake3/GzConfigureBuild.cmake:68 (message):
CONFIGURATION WARNINGS:
-- Skipping component [optix]: Missing dependency [OptiX].
^~~~~ Set SKIP_optix=true in cmake to suppress this warning.
Call Stack (most recent call first):
CMakeLists.txt:216 (gz_configure_build)
</code></pre>
<p>Is this a known warning and something to worry about?</p>
|
107713
|
2024-01-20T19:54:46.510
|
|gazebo|
|
<p>I'm desperately trying to build gazebo from source in my ubuntu distribution, but the build process fails every time. First I tried to install harmony without any luck, but trying to install fortress isn't much better. While building fortress it always fails within the ignition-physics5 build process, leading to following error:</p>
<pre><code>stderr: ignition-physics5
/usr/bin/ld: cannot find -lTINYXML2_LIBRARY_/usr/lib/x86_64-linux-gnu/libtinyxml2.so-NOTFOUND: No such file or directory
collect2: error: ld returned 1 exit status
gmake[2]: *** [dartsim/CMakeFiles/ignition-physics5-dartsim-plugin.dir/build.make:324: lib/libignition-physics5-dartsim-plugin.so.5.3.2] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:352: dartsim/CMakeFiles/ignition-physics5-dartsim-plugin.dir/all] Error 2
gmake: *** [Makefile:166: all] Error 2
Failed <<< ignition-physics5 [5.56s, exited with code 2]
Summary: 6 packages finished [55.3s]
1 package failed: ignition-physics5
1 package had stderr output: ignition-physics5
</code></pre>
<p>I already checked if tinyxml2 is installed:</p>
<pre><code>sudo apt-get install libtinyxml2-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libtinyxml2-dev is already the newest version (9.0.0+dfsg-3).
0 upgraded, 0 newly installed, 0 to remove and 42 not upgraded.
</code></pre>
<p>Looks like a missing dependency for me, but following the <a href="https://gazebosim.org/docs/fortress/install_ubuntu_src" rel="nofollow noreferrer">step by step instructions</a> multiple times now, I really don't know what else to do.
Colcon graph looks fine for me.</p>
<p>I'm running my Ubuntu distribution in a wsl2 environment, if that's from any concern.</p>
<p>Any any idea what I'm doing wrong here?</p>
|
Gazebo fortress ubuntu: Building from source fails
|
<p>I found that <a href="https://github.com/PickNikRobotics/rviz_visual_tools/blob/master/src/rviz_visual_tools.cpp#L2160" rel="nofollow noreferrer">publishWireframeCuboid</a> has the ability to publish a bounding box with <strong>different length/width/height values</strong>:</p>
<pre class="lang-cpp prettyprint-override"><code>bool publishBBOX(open3d::geometry::OrientedBoundingBox& bbox, int box_id, std::string box_ns)
{
rviz_visual_tools::RvizVisualToolsPtr visual_tools_;
Eigen::Isometry3d bbox_iso_pose;
bbox_iso_pose.translation() = bbox.center_;
bbox_iso_pose.linear() = bbox.R_;
geometry_msgs::Pose bbox_pose;
tf::poseEigenToMsg(bbox_iso_pose, bbox_pose);
visual_tools_->publishWireframeCuboid(
bbox_iso_pose, bbox.GetMinBound(), bbox.GetMaxBound(),
visual_tools_->getRandColor(), box_ns, box_id
);
visual_tools_->trigger();
return true;
}
</code></pre>
<p><a href="https://i.stack.imgur.com/EAtwA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EAtwA.png" alt="enter image description here" /></a></p>
|
107746
|
2024-01-22T08:19:24.253
|
|rviz|publisher|marker|markers.rviz|
|
<p>I want to visualize an <code>OrientedBoundingBox</code> from Open3D on RVIZ, I have seen the :</p>
<ol>
<li><a href="https://github.com/PickNikRobotics/rviz_visual_tools/blob/master/src/rviz_visual_tools.cpp#L2269" rel="nofollow noreferrer">RvizVisualTools::publishWireframeRectangle</a></li>
<li><a href="http://wiki.ros.org/rviz/Tutorials/Markers:%20Points%20and%20Lines" rel="nofollow noreferrer">RVIZ Line Segments</a></li>
</ol>
<p><code>publishWireframeRectangle</code> has two dimensions width, and height, while I still have length, and for <code>RVIZ Line Segment</code> I have to develop the function myself, I wonder if there is a <em>ready to use</em> function to publish RVIZ Marker for <code>OrientedBoundingBox</code> which is ready to use, can you please tell me if there is any? thanks in advance.</p>
|
Oriented Bounding Box in RVIZ
|
<p>So I managed to fix the issue. I removed the ros_control controllers I was using and replaced the control for the robot with the skid steer plugin which I found out about in <a href="https://www.youtube.com/watch?v=ad2jd8SCK-o" rel="nofollow noreferrer">this video</a> and now I can move my robot with the teleop keyboard node that's readily available to send messages on the <code>cmd_vel</code> topic which the robot is already subscribed to. The new code is available on my <a href="https://github.com/balen-muon/first_robot" rel="nofollow noreferrer">GitHub</a>. The <code>roslaunch ford_bot launch_all.launch</code> command will launch the robot and gazebo etc. and then you can use the <code>rosrun teleop_twist_keyboard teleop_twist_keyboard.py</code> command to control the robot.</p>
|
107752
|
2024-01-22T13:03:21.857
|
|ros-melodic|mobile-robot|wheeled-robot|ros-control|gazebo-ros-control|
|
<p>I have made a robot with 4 wheels and it uses ros_control. At the moment I can use a python script to make it move forward and backward but I don't know how to make the wheels turn as it only has the <code>/command</code> topic which accepts a Float64 data input so no linear and angular axis inputs like <code>/cmd_vel</code> etc. Am I able to make the robot subscribe to another topic, if yes, how do I do that?</p>
<p>Github code for the robot: <a href="https://github.com/balen-muon/first_robot" rel="nofollow noreferrer">here</a>.
The whole project can be launched using the following command if you want to run it on your own machine:</p>
<pre><code>roslaunch ford_bot launch_all.launch
</code></pre>
<p>Some guidance on this would be very much appreciated.</p>
|
How to turn the wheels on a robot that uses ros_control?
|
<p>It is possible but not recommended if you need to satisfy real-time requirements.
See e.g. <a href="https://github.com/PickNikRobotics/topic_based_ros2_control" rel="nofollow noreferrer">this package</a> (be aware, that was written for simulation).</p>
|
107759
|
2024-01-22T16:15:51.337
|
|ros2-control|ros2-controllers|
|
<p>I need to transmit high-level status updates strings about my hardware to another node using a publisher. Recognizing that blocking calls are not welcome within the read/write methods, I intend to employ a Node in conjunction with RealtimePublisher from the realtime_tools package. However, I'm uncertain whether it is possible to instantiate a node within the implementation of the SystemInterface.</p>
|
Are hardware components in ros2_control designed to include a ROS 2 node as a member?
|
<p>From the answer <a href="https://answers.ros.org/question/330920/ros-2-composable-node-pass-nodehandler/" rel="nofollow noreferrer">here</a> (rizkymille's answer):</p>
<blockquote>
<p>You need to get the node pointer and pass it to another class. But if you do this in the class constructor, a bad_weak_ptr error will always show up. You can prevent this by initiating the class in callback.</p>
<p>I'm gonna use ClassA and ClassB example above, say you want to extend the node to ClassB to use ClassB functions from ClassA. Here's the header code of ClassB:</p>
<pre><code>class ClassB {
public:
ClassB(rclcpp::Node::SharedPtr node); // constructor
// your code here
private:
rclcpp::Node::SharedPtr node_;
// your code here
</code></pre>
<p>and here's the definition code of ClassB:</p>
<pre><code>// constructor
ClassB::ClassB(rclcpp::Node::SharedPtr node) : node_(node) {
// your code here
}
</code></pre>
<p>Then in ClassA file:</p>
<pre><code>class ClassA : public rclcpp::Node {
public:
ClassA() : Node("class_a") {
// your code here
// use one-time timer to initiate class B
timer = this->create_wall_timer(500ms, std::bind(&ClassA::initialization, this));
}
private:
rclcpp::TimerBase::SharedPtr timer;
std::shared_ptr<ClassB> class_b;
void initialization() {
// get node pointer, pass into Class B
class_b = std::make_shared<ClassB>(shared_from_this());
// replace timer with loop callback after initialization finished
timer = this->create_wall_timer(500ms, std::bind(&UsingLibCpp::timer_callback, this));
}
void timer_callback() {
// your code here
// use Class B function
class_b->class_b_function();
}
</code></pre>
</blockquote>
|
107764
|
2024-01-22T19:40:08.517
|
|node|rclcpp|
|
<p>I have a class named UarmControl that inherits the Node class. Inside my UarmControl class, I want to send the node it self to another class named Uarm that I want to create inside my constructor. The constructor of the Uarm class looks like this:</p>
<pre><code>Uarm::Uarm(rclcpp::Node::SharedPtr& node, std::string &robot_ip)
</code></pre>
<p>Why is it not working to just put "this" as shown below?</p>
<pre><code>class UarmControl : public rclcpp::Node
{
public:
UarmControl() : Node("uarm_control")
{
timer_ = this->create_wall_timer(
10ms, std::bind(&UarmControl::timer_callback, this));
std::string robot_ip = "192.168.8.167";
Uarm uarm(this, robot_ip);
}
}
</code></pre>
<p><strong>EDIT:</strong>
This is the error I'm getting:</p>
<pre><code>error: no matching function for call to ‘Uarm::Uarm(UarmControl*, std::string&)’
34 | Uarm uarm(this, robot_ip);
note: no known conversion for argument 1 from ‘UarmControl*’ to ‘rclcpp::Node::SharedPtr&’ {aka ‘std::shared_ptr<rclcpp::Node>&’}
6 | Uarm(rclcpp::Node::SharedPtr& node, std::string &robot_ip);
</code></pre>
<p>So it seems that "this" does not refer to the node. I thought it would work because I read this on the ROS2 Humble MinimalPublisher C++ example page:
<a href="https://i.stack.imgur.com/vYGBa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vYGBa.png" alt="enter image description here" /></a></p>
<p>My goal is to replace the following code, so that the Uarm object is created within the node class. In this way I can access the Uarm functions inside my node...</p>
<pre><code>int main(int argc, char * argv[])
{
rclcpp::init(argc, argv);
std::shared_ptr<rclcpp::Node> node = std::make_shared<UarmControl>();
std::string robot_ip = "192.168.8.167";
Uarm uarm(node, robot_ip);
while(1)
{
rclcpp::spin_some(node);
uarm.set_joint_vel(q_dot);
}
rclcpp::shutdown();
return 0;
}
</code></pre>
|
Sending node object to a class inside the node
|
<p>This should be in the MoveIt GitHub repository. More specifically, you can find it <a href="https://github.com/ros-planning/moveit2/blob/4c024bc49ef20369f01d363c5884556932bf86da/moveit_ros/planning_interface/move_group_interface/src/move_group_interface.cpp#L636" rel="nofollow noreferrer">here</a> in the <code>move_group_interface.cpp</code> file. In simple terms, this method prepares the action goal, sends the goal, and handles the result.</p>
<p>The function takes only a reference to the <code>Plan</code> object, and the process does not really tell you what is happening under the hood. For a deeper understanding of how the motion planning request is constructed, look into the <code>constructMotionPlanRequest</code> function too. You can find it <a href="https://github.com/ros-planning/moveit2/blob/4c024bc49ef20369f01d363c5884556932bf86da/moveit_ros/planning_interface/move_group_interface/src/move_group_interface.cpp#L1012" rel="nofollow noreferrer">here</a>.</p>
|
107771
|
2024-01-23T08:13:42.720
|
|ros2|moveit|
|
<p>I'm studying moveit.
A trajectory was created through a method called plan, but I couldn't find the process, so I asked a question.
thank you</p>
|
Where can i find the code about move_group_interface.plan method?
|
<h1>In case of ROS2</h1>
<p>Moveit2 planners inherit the <code>planning_interface::PlanningContext</code> and <code>planning_interface::PlannerManager</code> classes as shown <a href="https://github.com/ros-planning/moveit2_tutorials/blob/main/doc/examples/creating_moveit_plugins/plugin_tutorial.rst" rel="nofollow noreferrer">here</a>.</p>
<p>When a planning problem has to be solved then the the <code>planning_interface::PlanningContext::solve</code> method of the <code>PlanningContext</code>of the planner is called.</p>
<p>In case of the pilz planner the <code>pilz_industrial_motion_planner::PlanningContextBase</code> inherits from <code>planning_interface::PlanningContext</code> and <code>pilz_industrial_motion_planner::CommandPlanner</code> inherits from <code>planning_interface::PlannerManager</code>.</p>
<p>The <a href="https://github.com/ros-planning/moveit2/blob/main/moveit_planners/pilz_industrial_motion_planner/include/pilz_industrial_motion_planner/planning_context_base.h#L120" rel="nofollow noreferrer">solve method</a> of <code>pilz_industrial_motion_planner::PlanningContextBase</code> directly calls the <a href="https://github.com/ros-planning/moveit2/blob/main/moveit_planners/pilz_industrial_motion_planner/src/trajectory_generator.cpp#L310" rel="nofollow noreferrer">generate method</a> of a <code>pilz_industrial_motion_planner::TrajectoryController</code> which then calls its own <code>pilz_industrial_motion_planner::TrajectoryController</code> <a href="https://github.com/ros-planning/moveit2/blob/main/moveit_planners/pilz_industrial_motion_planner/src/trajectory_generator.cpp#L358" rel="nofollow noreferrer">plan method</a> (Note, the plan method is virtual in the TrajectoryGenerator class and only implemented in the TrajectoryGenerator{<a href="https://github.com/ros-planning/moveit2/blob/main/moveit_planners/pilz_industrial_motion_planner/src/trajectory_generator_ptp.cpp#L252" rel="nofollow noreferrer">PTP</a>|<a href="https://github.com/ros-planning/moveit2/blob/main/moveit_planners/pilz_industrial_motion_planner/src/trajectory_generator_lin.cpp#L152" rel="nofollow noreferrer">LIN</a>|<a href="https://github.com/ros-planning/moveit2/blob/main/moveit_planners/pilz_industrial_motion_planner/src/trajectory_generator_circ.cpp#L195" rel="nofollow noreferrer">CIRC</a>} classes respectively).</p>
<p>Depending on the used motion planning strategy of pilz (e.g. point-to-point motion, linear trajectory or circular trajectory) the generator then plans the motion.</p>
<p>In summary, a simplified call stack looks like this (types are left out and names shortened):</p>
<pre><code>PlanningContext::solve(res)
↓ is implemented by pilz
PlanningContextBase::solve(res)
↓ calls
TrajectoryGenerator::generate(scene, req, res, sampling_time=0.1)
↓ calls
TrajectoryGenerator::plan(scene, req, plan_info, sampling_time, joint_trajectory)
</code></pre>
<p>where <code>res</code> is a reference to the motion plan response, <code>scene</code> is the planning scene of the context, <code>req</code> is the motion planning request of the context, <code>sampling_time</code> is the sampling rate of your question and <code>plan_info</code> is a pilz collection of some scene and req information.</p>
<p>Note, that the <code>sampling_time</code> parameter is introduced in the <code>TrajectoryGenerator::generate</code> method with a default value of 0.1 (the 100ms you mentioned) and is directly forwarded to the call of <code>TrajectoryGenerator::plan</code> but not changed (not even in the point-to-point, linear nor circular trajectory generators calls of the TrajectoryGenerator::generate method - the default value of 100ms of the parameter is used) nor read from anywhere like a ros parameter. Thus the value appears truly hardcoded in ROS2.</p>
<p>The implementation of moveit for ROS1 is different - so it still might be possible there.</p>
|
107782
|
2024-01-23T12:00:59.383
|
|ros|moveit|ros-industrial|
|
<p>When using ROS Noetic (ROS2 answer great though too) with the Pilz industrial planner, I noticed that the plan output trajectory has 100ms between samples. I searched the web (and the source-code) but couldn't figure out where this 100ms comes from. Is there a parameter to adjust it or is it hard-coded somewhere?</p>
<p>I didn't see a parameter for the other planners (CHOMP, STOMP, ...) either. I get that post-processing can "fill-in" these trajectories, but I'm curious how to increase the planner output density instead.</p>
<p>The pilz source-code has a "plan(...)" function that takes a sampling rate, which seems to be called by a "generate(...)" function which also takes a sampling rate, but I couldn't figure out what calls the "generate(...)" function.</p>
<p>Extra tags: frequency, duration, sampling rate, sample rate, hz, publish rate,</p>
|
ROS Planner Trajectory Sampling Rate
|
<p>So after a lot of research I managed to fix the issue with the laserscan points not showing in RViz. I used the LiDAR implementation from turtlebot3's description for the 'melodic-devel' version which is the version I am using and then I modified it to be fixed to the chassis etc so that it is correctly positioned in my urdf structure if that's the right way to put it. Now it shows the laser points but the robot won't move in RViz lol so now I have to fix that. I have updated the files on my <a href="https://github.com/balen-muon/first_robot" rel="nofollow noreferrer">GitHub</a> so you can have a look at the <code>lidar.xacro</code> file to see the lidar implementation if you are having the same problem.</p>
|
107789
|
2024-01-23T15:34:08.520
|
|gazebo|ros-melodic|rviz|lidar|
|
<p>I have a 4 wheeled robot with a LIDAR on the robot. I am able to move the robot in Gazebo and the lidar "scans"(if that's the right term for the blue lines coming out of it) are showing up in Gazebo. But when I open RVIZ and try to show the laserScan points(?) on in RVIZ nothing will show and the robot doesn't move either. So I am not really sure what I am doing wrong at the moment. I don't know much about robot_state_publisher and joint_state_publisher but I know they are running when I run the launch file. Although I have a working robot I am still very new to ROS so apologies if I've made a rookie mistake.</p>
<p>here is a link to my <a href="https://github.com/balen-muon/first_robot" rel="nofollow noreferrer">github</a> and the <a href="https://github.com/balen-muon/first_robot/blob/main/src/ford_bot/launch/gazebo.launch" rel="nofollow noreferrer">launch file that will run the robot</a>. Use teleop keyboard node to control the robot.</p>
<p>Some guidance on what the issue could be is very much appreciated. thanks.</p>
|
Robot won't move and laserScan won't show in RVIZ
|
<p>You are correct that the implication to the pattern does have to do with ownership. I'll summarize here, but there is a much more thorough explanation of the guidelines in <a href="https://herbsutter.com/2013/06/05/gotw-91-solution-smart-pointer-parameters/" rel="nofollow noreferrer">Herb Sutter's GoTW #91: Smart Pointer Parameters</a></p>
<p>The relevant section that the ROS 2 callbacks are enforcing are:</p>
<blockquote>
<p>Guideline: Don’t pass a smart pointer as a function parameter unless you want to use or manipulate the smart pointer itself, such as to share or transfer ownership.</p>
</blockquote>
<blockquote>
<p>Guideline: Prefer passing objects by value, *, or &, not by smart pointer.</p>
</blockquote>
<p>The new set of signatures are trying to be much more explicit about ownership. While the ownership may not be important in a single-producer, single-consumer situation, there are more complex applications. This is especially important in the case of <em>intraprocess communications</em> where the messages are held in an internal buffer and only distributed based on the signatures of the subscriptions. For more information on the implications on <em>intraprocess comms</em>, consult the <a href="https://design.ros2.org/articles/intraprocess_communications.html" rel="nofollow noreferrer">Intraprocess Communications Design Doc</a>. The most relevant section is <em>Number of message copies</em>, which has a table comparing various signatures.</p>
<p>Generally the signatures should be thought of as follows:</p>
<ul>
<li><code>const Msg &</code> - immutable, no ownership</li>
<li><code>unique_ptr<Msg></code> - mutable and takes ownership</li>
<li><code>shared_ptr<const Msg></code> - immutable, but allows subscription to share ownership (by copying into member)</li>
<li><code>const shared_ptr<const Msg> &</code> - immutable, but allows subscription to share ownership (by copying into member)</li>
<li><code>shared_ptr<Msg></code> - deprecated. It's potentially unsafe if multiple subscriptions take the same message.</li>
</ul>
<p>Finally, for a full enumeration of all of the available subscription types, it's best to consult the <code>AnySubscriptionCallbackPossibleTypes</code> structure in <code>rclcpp</code>: <a href="https://github.com/ros2/rclcpp/blob/rolling/rclcpp/include/rclcpp/any_subscription_callback.hpp#L57" rel="nofollow noreferrer">https://github.com/ros2/rclcpp/blob/rolling/rclcpp/include/rclcpp/any_subscription_callback.hpp#L57</a></p>
|
107802
|
2024-01-23T22:12:58.807
|
|ros2|
|
<p>I did an experiment where I tried all combinations of const, &, and SharedPtr as the input to the subscription callback. The message type is <code>nav_msgs::msg::Odometry</code> and the results are at the bottom of the code snippet.</p>
<pre><code>#include "rclcpp/rclcpp.hpp"
#include "nav_msgs/msg/odometry.hpp"
class SubToSharedPtr : public rclcpp::Node
{
public:
SubToSharedPtr()
: Node("sub_to_shared_ptr_node")
{
odom_sub_ = this->create_subscription<nav_msgs::msg::Odometry>(
"odom", rclcpp::SystemDefaultsQoS(),
std::bind(&SubToSharedPtr::odomCb, this, std::placeholders::_1)
);
}
private:
rclcpp::Subscription<nav_msgs::msg::Odometry>::SharedPtr odom_sub_;
void odomCb(const nav_msgs::msg::Odometry& msg)
{
}
};
int main(int argc, char** argv)
{
rclcpp::init(argc, argv);
auto node = std::make_shared<SubToSharedPtr>();
rclcpp::spin(node);
rclcpp::shutdown();
return 0;
}
// const SharedPtr& - doesn't work
// const SharedPtr - works
// SharedPtr - works
// SharedPtr& - doesn't work
// const & - works
// const - works
// & - doesn't work
// nothing - works
</code></pre>
<p>It seems like there is an important implication to this pattern (maybe something to do with ownership?). For example, all the ones with & doesn't work except for const & maybe because even though you are getting the actual variable (not a copy) you are promising not to change it, which is why it's acceptable.</p>
<p>Does anyone have an explanation for why this pattern exists?</p>
|
Compilation error when subscription callback's input is of certain type
|
<p>Based on section <code>3.7. Choosing the Proper Granularity of a BT</code> from the book <strong>Behavior Trees in Robotics and AI: An Introduction</strong> of Michele Colledanchise and Petter Ögren, I have some criteria to consider when I want to apply BT for actions:</p>
<ul>
<li>If sub-behaviors of the action always executed in the exact order then implement it as a Leaf node.</li>
<li>If sub-behaviors of the action can be devided and can be reused if other places, then implement it as a sub-BT.</li>
</ul>
|
107813
|
2024-01-24T10:50:38.203
|
|ros-melodic|action-server|
|
<p>I have an action called <em>take_pallet</em>, implemented by BT, which has several actions like: <code>MoveToPoint</code>, <code>Docking</code>, <code>Lifting</code>...</p>
<p>Currently, the <code>Lifting</code> action only lift the pallet up or down. But now, I want to add more complex logic for Lifting action, like check the height, add timeout, feedback status...</p>
<p>I wonder if I should implement this action using BT or just a simple ROS action and handle all the logic business inside execute_cb() function.</p>
<p>I would prefer the second option, since using BT may improve reusability and you won't have to rebuild your code if something change in the BT script, but I will have to define more BT node like <code>HeightChecking</code> node, <code>TimeOut</code> node... which will time consuming and maybe I won't reuse those action nodes.</p>
<p>Any rules or guidelines for this situation? At which control level should I use BT for robotics applications?</p>
<p>Edit: I'm using BehaviorTreeCpp v3.8 by Davide Faconti. <a href="https://github.com/BehaviorTree/BehaviorTree.CPP/tree/v3.8" rel="nofollow noreferrer">github</a></p>
|
When should I implement actions as Behavior Tree (BT)?
|
<p>To plot the information published on a specific topic, we need to know the <strong>topic name</strong> and <strong>message type and member names</strong>. Suppose we have a topic called <code>/topic_name</code> that carries messages of type <code>std_msgs/Float64</code>. In your case, you can know the message type with the following command.</p>
<pre><code>ros2 topic info /topic_name
</code></pre>
<p>This command outputs the following:</p>
<pre><code>Type: std_msgs/msg/Float64
Publisher count: 1
Subscription count: 0
</code></pre>
<p>We now know the message type is <code>std_msgs/msg/Float64</code>. Next, we need to know how the data is structured inside this message type to know the names of the individual pieces of information. This can be done with the following command: (notice to replace <code>std_msgs/msg/Float64</code> with your message type)</p>
<pre><code>ros2 interface show std_msgs/msg/Float64
</code></pre>
<p>This command prints the following.</p>
<pre><code># This was originally provided as an example message.
# It is deprecated as of Foxy
# It is recommended to create your own semantically meaningful message.
# However if you would like to continue using this please use the equivalent in example_msgs.
float64 data
</code></pre>
<p>This message type has a single member named <strong>data</strong> and of type Float64. This name is what we want to give to rqt_plot with the topic name.</p>
<p>Then, we reached the answer to your question. Open the rqt_plot window, and what you need to plot is as follows. <code>/topic_name/message_member_name</code>. <strong>In our case, this would be <code>/topic_name/data</code>.</strong> Press the green plus button to plot this data.</p>
<hr />
<p>Notice for the sake of a complete answer. If the internal data is an array like <code>std_msgs/Float64MultiArray</code>, we can retrieve its individual elements as <code>/topic_name/data[0]</code>, <code>/topic_name/data[1]</code>, and so on when giving inputs to rqt_plot.</p>
|
107814
|
2024-01-24T11:08:07.673
|
|ros2|
|
<p>i am using ROS2 foxy on Ubuntu 20.04, i have implemented a publisher node, which publishes data into a msg, i start the publisher and i can see the published data using ros2 topic echo /topic_name, but i want to see the plotted data using ros2 run rqt_plot rqt_plot, i call this line the plotting figure is opened and i select the required topic but it is not showing anything, do you have any idea?</p>
|
ROS2 rqt_plot is not showing anything
|
<p>I'll follow up with a solution to this problem for anyone else who needs to implement a similar node.<br />
First, make sure you add your loadable configuration, <code>load_params.y[a]ml</code> to your <code>config</code> folder, as such:</p>
<pre><code>colcon_ws
└── src
├── my_pkg
│ ├── config
│ │ └── load_params.yml
│ ├── my_pkg
│ │ ├── __init__.py
│ │ ├── my_node.py
│ │ └── __pycache__
│ │ ├── __init__.cpython-38.pyc
│ │ └── my_node.cpython-38.pyc
│ ├── launch
│ │ ├── backend_launcher.launch.py
│ │ └── frontend_launcher.launch.xml
│ ├── package.xml
│ ├── resource
│ │ └── my_pkg
│ ├── setup.cfg
│ ├── setup.py
│ └── test
│ ├── test_copyright.py
│ ├── test_flake8.py
│ └── test_pep257.py
</code></pre>
<p>In your <code>setup.py</code>, modify it accordingly to have a copy of <code>config</code> in your <code>install</code> share space (doesn't hurt to add your launchers too):</p>
<pre class="lang-py prettyprint-override"><code>import os
from glob import glob
...
setup(
name=package_name,
version='0.0.0',
packages=[package_name],
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name, ['package.xml']),
# Include all configuration files
('share/' + package_name + '/config', glob('config/*')),
# Include all launch files
(os.path.join('share', package_name, 'launch'), glob(os.path.join('launch', '*launch.[pxy][yma]*')))
],
...
)
</code></pre>
<p>Once you've done this, you can invoke, in <em>any</em> Python file that you have placed in <code>install</code> (be it a node or launch.py) the following:</p>
<pre class="lang-py prettyprint-override"><code>import yaml
from ament_index_python.packages import get_package_share_directory
...
share_dir = get_package_share_directory(PKG_NAME) # modify this accordingly
fname = share_dir + f"/config/load_params.yaml" # use os.path.join if you want
with open(fname, 'r') as file:
configs = yaml.safe_load(file)
# # note that you will most likely extract a field as the following
# # or, using ['<ns>/<node>'] instead of ['/**']
# # you can also simply discard the typical ros2 param syntax
# # # if you won't use any of the fields in a parameter declaration
# config_field = configs['/**']['ros__parameters']['field_name']
</code></pre>
<p>Using this in launch backends helps with conditional statements tied in with launch file generation that are <strong>not</strong> intrinsic properties of the sub-launch files themselves (e.g. how many launch files are you spawning).<br />
In nodes, this allows your nodes to access <em>configurations</em> rather than <em>node parameters</em>, according to the distinction made in <a href="https://robotics.stackexchange.com/a/107852/31285">the previously given answer</a><br />
Hope this helps anyone else who is stumped!</p>
|
107818
|
2024-01-24T14:09:37.230
|
|ros2|yaml|parameters|rclpy|
|
<p>I'm having a problem regarding code migration from ROS Noetic to ROS Foxy.<br />
The problem is related to parameter access from scripts. I'm using Python nodes for my code.<br />
Originally these sorts of YAML parameters were acceptable for <code>rospy</code>:</p>
<hr />
<p>YAML file section:</p>
<pre class="lang-yaml prettyprint-override"><code> tf_static: [
{"frame_id": "map",
"child_frame_id": "odom",
"translation": [0.0,0.0,0.0],
"rotation": [0.0,0.0,0.0,1.0]
},
{"frame_id": "base_link",
"child_frame_id": "cam_link",
"translation": [0.06,0.0,0.08],
"rotation": [-0.5,0.5,-0.5,0.5]
},
]
a: {
b: 1,
c: 2.0,
d: "hello",
e: true
}
</code></pre>
<p>rospy script section (using if-else rather than get_param w/ defaults for better visibility wherever necessary):</p>
<pre class="lang-py prettyprint-override"><code> if rospy.has_param('tf_static'):
tf_static = rospy.get_param('tf_static')
else: #defaults
tf_static = [
{"frame_id": "map",
"child_frame_id": "odom",
"translation": [0.0,0.0,0.0],
"rotation": [0.0,0.0,0.0,1.0]
},
{"frame_id": "base_link",
"child_frame_id": "cam_link",
"translation": [0.05,0.0,0.08],
"rotation": [-0.5,0.5,-0.5,0.5]
},
]
another_param_dict = rospy.get_param('a', default={'b':1,'c':2.0,'d':"hello",'e':True})
just_a_field = tf_static[0]['frame_id'] # just an example
just_another_field = another_param_dict['d'] # just another example to expand
</code></pre>
<hr />
<p>Considering that <code>parameter.py</code> in the <a href="https://github.com/ros2/rclpy/blob/9536f8ec66020a552cf9ad421a11629ad8804a16/rclpy/rclpy/parameter.py#L185" rel="nofollow noreferrer">source code</a> does not include this functionality with <code>get_parameter_value</code>, and <code>parameter_dict_from_yaml_file</code> simply points to a YAML file to go through the same thing recursively, this becomes a great hassle.<br />
Declaration is another problem, considering nothing in this case is allowed in the first place. I <em>can</em> (only) get <code>a</code> to work, by explicitly specifying <code>a.b</code>, <code>a.c</code>, <code>a.d</code>, and <code>a.e</code>, but a list of dictionaries is "non-standard" (not by YAML conventions, of course) so I am completely stuck there.</p>
<pre class="lang-py prettyprint-override"><code># self refers to the Node, i.e. `class my_node(Node)`
...
# ridiculously messy, and only works with "standard" types
self.declare_parameter('a.b',"1")
self.declare_parameter('a.c',"2.0")
self.declare_parameter('a.d',"hello")
self.declare_parameter('a.e',"true")
self.b = self.get_parameter('a.b').get_parameter_value().integer_value
self.c = self.get_parameter('a.c').get_parameter_value().double_value
self.d = self.get_parameter('a.d').get_parameter_value().string_value
self.e = self.get_parameter('a.e').get_parameter_value().bool_value
</code></pre>
<p>Furthermore, the <strong>original</strong> idea of using lists of dictionaries for me was to have as many of these descriptions as I wanted for my static frame definitions so I could simply enter them in my YAML file in this manner. Now I can't even think about using many parameters without typing them in one by one in my rclpy node initialization.</p>
<p>Is this seriously what we are stuck with for moving on with ROS 2, or is there a way to properly get parameters from YAML files? I seriously am considering hacking into the parameter file using <code>ament</code> packages, or some relative address definitions, and <code>yaml</code> to just parse the parameter file myself and eliminate the problem. I am not even interested in modifying these parameters at runtime either.</p>
|
YAML-standard parameter specification not one of the allowed types
|
<p>I solved the issue.
I thought I was working with Gazebo Fortress, but a software I was working with installed Gazebo Garden instead.</p>
<p>When I installed the <code>ros-gz-bridge</code> from the apt repository, it installed only the supported package that is officially supported by ROS Humble, which is the Gazebo Fortress one.</p>
<p>I installed the ros-gz-bridge from <a href="https://github.com/gazebosim/ros_gz/tree/humble" rel="nofollow noreferrer">sources</a> and now the bridge is working as expected.</p>
|
107827
|
2024-01-24T17:10:23.347
|
|ros2|ros-humble|gz-sim|
|
<p>I am running <code>ros_gz_bridge</code> to read some data from Gazebo, in particular I have run:</p>
<pre><code>ros2 run ros_gz_bridge parameter_bridge /model/x500_vision_0/odometry@nav_msgs/msg/Odometry[gz.msgs.Odometry
[INFO] [1706113773.667589591] [ros_gz_bridge]: Creating GZ->ROS Bridge: [/model/x500_vision_0/odometry (gz.msgs.Odometry) -> /model/x500_vision_0/odometry (nav_msgs/msg/Odometry)] (Lazy 0)
</code></pre>
<p>The problem is that when I run</p>
<pre><code>ros2 topic echo /model/x500_vision_0/odometry
</code></pre>
<p>I do not see any message published on the topic.</p>
<p>I have already checked that the name of the topic is correct, and when I run</p>
<pre><code>gz topic -et /model/x500_vision_0/odometry
</code></pre>
<p>I can see the messages exchanged within Gazebo.</p>
<p>So why is the bridge not publishing the messages on the ROS2 network?</p>
<p><strong>EDIT:</strong></p>
<p>Some more info about my setup.</p>
<p>I am working with ROS2 Humble and with Gazebo Sim version 7.7.0:</p>
<pre><code> gz sim --version
Gazebo Sim, version 7.7.0
Copyright (C) 2018 Open Source Robotics Foundation.
Released under the Apache 2.0 License.
</code></pre>
<p>I have installed Gazebo trough the apt package provided with ros2:</p>
<pre><code>sudo apt install ros-humble-ros-gz
</code></pre>
<p>The world that I am running is a custom world that includes some static objects and a quadrotor equipped with the odometry plugin.</p>
<p>It all run inside a Docker based on the image <code>osrf/ros:humble-desktop</code></p>
|
ros_gz_bridge does not publish on ros2 topic
|
<p>the problem solves by giving the following argument <code>fcu_url:="udp://:14540@127.0.0.1:14557</code> just make sure dependant packages are installed and run <code>roslaunch mavros px4.launch fcu_url:="udp://:14540@127.0.0.1:14557"</code>. so by default the is <code>/dev/ttyACM0</code> which mean the launch file expect an <code>flight controller</code> is connected to it. but we are taking the data from the simulation, not the physical hardware.</p>
|
107842
|
2024-01-25T05:11:16.217
|
|gazebo|ros-noetic|mavros|px4|
|
<p>I am try to simulate UAV in gazebo using <code>px4</code> and <code>mavros</code> <code>roslaunch mavros px4.launch</code>
got the following error</p>
<pre><code>... logging to /home/mubashir/.ros/log/595548e6-bb3f-11ee-bab8-f3b849e8f78c/roslaunch-pc-8488.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://pc:39963/
SUMMARY
========
CLEAR PARAMETERS
* /mavros/
PARAMETERS
* /mavros/camera/frame_id: base_link
* /mavros/cmd/use_comp_id_system_control: False
* /mavros/conn/heartbeat_rate: 1.0
* /mavros/conn/system_time_rate: 1.0
* /mavros/conn/timeout: 10.0
* /mavros/conn/timesync_rate: 10.0
* /mavros/distance_sensor/hrlv_ez4_pub/field_of_view: 0.0
* /mavros/distance_sensor/hrlv_ez4_pub/frame_id: hrlv_ez4_sonar
* /mavros/distance_sensor/hrlv_ez4_pub/id: 0
* /mavros/distance_sensor/hrlv_ez4_pub/orientation: PITCH_270
* /mavros/distance_sensor/hrlv_ez4_pub/send_tf: True
* /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/x: 0.0
* /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/y: 0.0
* /mavros/distance_sensor/hrlv_ez4_pub/sensor_position/z: -0.1
* /mavros/distance_sensor/laser_1_sub/id: 3
* /mavros/distance_sensor/laser_1_sub/orientation: PITCH_270
* /mavros/distance_sensor/laser_1_sub/subscriber: True
* /mavros/distance_sensor/lidarlite_pub/field_of_view: 0.0
* /mavros/distance_sensor/lidarlite_pub/frame_id: lidarlite_laser
* /mavros/distance_sensor/lidarlite_pub/id: 1
* /mavros/distance_sensor/lidarlite_pub/orientation: PITCH_270
* /mavros/distance_sensor/lidarlite_pub/send_tf: True
* /mavros/distance_sensor/lidarlite_pub/sensor_position/x: 0.0
* /mavros/distance_sensor/lidarlite_pub/sensor_position/y: 0.0
* /mavros/distance_sensor/lidarlite_pub/sensor_position/z: -0.1
* /mavros/distance_sensor/sonar_1_sub/horizontal_fov_ratio: 1.0
* /mavros/distance_sensor/sonar_1_sub/id: 2
* /mavros/distance_sensor/sonar_1_sub/orientation: PITCH_270
* /mavros/distance_sensor/sonar_1_sub/subscriber: True
* /mavros/distance_sensor/sonar_1_sub/vertical_fov_ratio: 1.0
* /mavros/fake_gps/eph: 2.0
* /mavros/fake_gps/epv: 2.0
* /mavros/fake_gps/fix_type: 3
* /mavros/fake_gps/geo_origin/alt: 408.0
* /mavros/fake_gps/geo_origin/lat: 47.3667
* /mavros/fake_gps/geo_origin/lon: 8.55
* /mavros/fake_gps/gps_rate: 5.0
* /mavros/fake_gps/mocap_transform: True
* /mavros/fake_gps/satellites_visible: 5
* /mavros/fake_gps/tf/child_frame_id: fix
* /mavros/fake_gps/tf/frame_id: map
* /mavros/fake_gps/tf/listen: False
* /mavros/fake_gps/tf/rate_limit: 10.0
* /mavros/fake_gps/tf/send: False
* /mavros/fake_gps/use_mocap: True
* /mavros/fake_gps/use_vision: False
* /mavros/fcu_protocol: v2.0
* /mavros/fcu_url: /dev/ttyACM0:57600
* /mavros/gcs_url:
* /mavros/global_position/child_frame_id: base_link
* /mavros/global_position/frame_id: map
* /mavros/global_position/gps_uere: 1.0
* /mavros/global_position/rot_covariance: 99999.0
* /mavros/global_position/tf/child_frame_id: base_link
* /mavros/global_position/tf/frame_id: map
* /mavros/global_position/tf/global_frame_id: earth
* /mavros/global_position/tf/send: False
* /mavros/global_position/use_relative_alt: True
* /mavros/image/frame_id: px4flow
* /mavros/imu/angular_velocity_stdev: 0.0003490659 // 0...
* /mavros/imu/frame_id: base_link
* /mavros/imu/linear_acceleration_stdev: 0.0003
* /mavros/imu/magnetic_stdev: 0.0
* /mavros/imu/orientation_stdev: 1.0
* /mavros/landing_target/camera/fov_x: 2.0071286398
* /mavros/landing_target/camera/fov_y: 2.0071286398
* /mavros/landing_target/image/height: 480
* /mavros/landing_target/image/width: 640
* /mavros/landing_target/land_target_type: VISION_FIDUCIAL
* /mavros/landing_target/listen_lt: False
* /mavros/landing_target/mav_frame: LOCAL_NED
* /mavros/landing_target/target_size/x: 0.3
* /mavros/landing_target/target_size/y: 0.3
* /mavros/landing_target/tf/child_frame_id: camera_center
* /mavros/landing_target/tf/frame_id: landing_target
* /mavros/landing_target/tf/listen: False
* /mavros/landing_target/tf/rate_limit: 10.0
* /mavros/landing_target/tf/send: True
* /mavros/local_position/frame_id: map
* /mavros/local_position/tf/child_frame_id: base_link
* /mavros/local_position/tf/frame_id: map
* /mavros/local_position/tf/send: False
* /mavros/local_position/tf/send_fcu: False
* /mavros/mission/pull_after_gcs: True
* /mavros/mission/use_mission_item_int: True
* /mavros/mocap/use_pose: True
* /mavros/mocap/use_tf: False
* /mavros/mount/debounce_s: 4.0
* /mavros/mount/err_threshold_deg: 10.0
* /mavros/mount/negate_measured_pitch: False
* /mavros/mount/negate_measured_roll: False
* /mavros/mount/negate_measured_yaw: False
* /mavros/odometry/fcu/odom_child_id_des: base_link
* /mavros/odometry/fcu/odom_parent_id_des: map
* /mavros/plugin_blacklist: ['safety_area', '...
* /mavros/plugin_whitelist: []
* /mavros/px4flow/frame_id: px4flow
* /mavros/px4flow/ranger_fov: 0.118682
* /mavros/px4flow/ranger_max_range: 5.0
* /mavros/px4flow/ranger_min_range: 0.3
* /mavros/safety_area/p1/x: 1.0
* /mavros/safety_area/p1/y: 1.0
* /mavros/safety_area/p1/z: 1.0
* /mavros/safety_area/p2/x: -1.0
* /mavros/safety_area/p2/y: -1.0
* /mavros/safety_area/p2/z: -1.0
* /mavros/setpoint_accel/send_force: False
* /mavros/setpoint_attitude/reverse_thrust: False
* /mavros/setpoint_attitude/tf/child_frame_id: target_attitude
* /mavros/setpoint_attitude/tf/frame_id: map
* /mavros/setpoint_attitude/tf/listen: False
* /mavros/setpoint_attitude/tf/rate_limit: 50.0
* /mavros/setpoint_attitude/use_quaternion: False
* /mavros/setpoint_position/mav_frame: LOCAL_NED
* /mavros/setpoint_position/tf/child_frame_id: target_position
* /mavros/setpoint_position/tf/frame_id: map
* /mavros/setpoint_position/tf/listen: False
* /mavros/setpoint_position/tf/rate_limit: 50.0
* /mavros/setpoint_raw/thrust_scaling: 1.0
* /mavros/setpoint_velocity/mav_frame: LOCAL_NED
* /mavros/startup_px4_usb_quirk: False
* /mavros/sys/disable_diag: False
* /mavros/sys/min_voltage: 10.0
* /mavros/target_component_id: 1
* /mavros/target_system_id: 1
* /mavros/tdr_radio/low_rssi: 40
* /mavros/time/time_ref_source: fcu
* /mavros/time/timesync_avg_alpha: 0.6
* /mavros/time/timesync_mode: MAVLINK
* /mavros/vibration/frame_id: base_link
* /mavros/vision_pose/tf/child_frame_id: vision_estimate
* /mavros/vision_pose/tf/frame_id: odom
* /mavros/vision_pose/tf/listen: False
* /mavros/vision_pose/tf/rate_limit: 10.0
* /mavros/vision_speed/listen_twist: True
* /mavros/vision_speed/twist_cov: True
* /mavros/wheel_odometry/child_frame_id: base_link
* /mavros/wheel_odometry/count: 2
* /mavros/wheel_odometry/frame_id: odom
* /mavros/wheel_odometry/send_raw: True
* /mavros/wheel_odometry/send_twist: False
* /mavros/wheel_odometry/tf/child_frame_id: base_link
* /mavros/wheel_odometry/tf/frame_id: odom
* /mavros/wheel_odometry/tf/send: False
* /mavros/wheel_odometry/use_rpm: False
* /mavros/wheel_odometry/vel_error: 0.1
* /mavros/wheel_odometry/wheel0/radius: 0.05
* /mavros/wheel_odometry/wheel0/x: 0.0
* /mavros/wheel_odometry/wheel0/y: -0.15
* /mavros/wheel_odometry/wheel1/radius: 0.05
* /mavros/wheel_odometry/wheel1/x: 0.0
* /mavros/wheel_odometry/wheel1/y: 0.15
* /rosdistro: noetic
* /rosversion: 1.16.0
NODES
/
mavros (mavros/mavros_node)
auto-starting new master
process[master]: started with pid [8503]
ROS_MASTER_URI=http://localhost:11311
setting /run_id to 595548e6-bb3f-11ee-bab8-f3b849e8f78c
process[rosout-1]: started with pid [8520]
started core service [/rosout]
process[mavros-2]: started with pid [8528]
[ INFO] [1706159125.586876777]: FCU URL: /dev/ttyACM0:57600
[ INFO] [1706159125.588129257]: serial0: device: /dev/ttyACM0 @ 57600 bps
[FATAL] [1706159125.588247399]: FCU: DeviceError:serial:open: No such file or directory
================================================================================REQUIRED process [mavros-2] has died!
process has finished cleanly
log file: /home/mubashir/.ros/log/595548e6-bb3f-11ee-bab8-f3b849e8f78c/mavros-2*.log
Initiating shutdown!
================================================================================
[mavros-2] killing on exit
[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done
</code></pre>
<p>I am using ros noetic with gazebo11</p>
|
FCU: DeviceError:serial:open: No such file or directory
|
<p>There's unfortunately no magic answer for doing this. Within a package we don't specifically call out what are executable resources versus build resources to install. Upstream debian packaging does this manually listing each installed file.</p>
<p>For most ROS packages if this is a level of optimization that you'd like to do our recommendation is to split the package into two different ones, one that installs runtime dependencies and one that installs the build time dependencies. Then the downstream package can depend on the appropriate package with the correct <a href="https://ros.org/reps/rep-0149.html#dependency-tags" rel="nofollow noreferrer">type of dependency(build, exec, etc</a>. Having done that you can't just use a merged install target to take advantage of this. If you do an isolated install, you can look at your dependencies and selectively copy the ones that provide runtime dependencies and skip the ones that only provide build time resources.</p>
<p>But if you're really interested in doing this the correct way to do it is to use one of the frameworks that are designed and optimized for doing off target builds. You're looking at cross compile toolchains that keep track of build time versus runtime elements and isntall them to different workspaces and manage your path appropriately at runtime.</p>
<p>Escalating from there you can step up to using something like OpenEmbedded (<a href="https://discourse.ros.org/c/openembedded/26" rel="nofollow noreferrer">OE working group</a>), building debian packages, or other mechanisms. In general you need to spend the extra effort to separate your build and install processes.</p>
|
107854
|
2024-01-25T14:11:03.613
|
|ros2|ros-humble|installation|colcon|
|
<p><strong>I need to deploy and update a ROS2 system to an embedded device with limited connectivity.</strong></p>
<p>This ROS2 system is made up of many custom packages written both in C++ and Python. At the moment I am just compiling the packages with <code>colcon build --merge-install</code> and sending a compressed archive of the <code>install</code> directory to the device.</p>
<p>The device supports over-the-air updates but, at the moment, the size of the ROS2 install archive makes the update too slow. However, I noticed that in the <code>install</code> directory are copied many text files, such as headers, scripts, etc.. together with the binary files.</p>
<p>Is there any option to have <code>colcon</code> only copy the files strictly necessary to run the program? If not, which are the files that can be safely removed?</p>
<p>PS
I know that I could sort this out by trial and error, but I would prefer a less time consuming approach.</p>
|
How to strip down the install directory of a ROS2 package
|
<p>I have found the solution, the problem was indeed with the GPU. I had the <code>--env="NVIDIA_DRIVER_CAPABILITIES=all"</code> option missing when I launched the container. I was able to find it thanks to <a href="https://community.gazebosim.org/t/running-gazebo-on-a-remote-machine-using-docker/1564/5" rel="nofollow noreferrer">this</a> answer.</p>
<p>Now I launch the container using all the following options, Gazebo does use my GPU and my CPU usage goes down to around 10%.</p>
<pre><code>--env="DISPLAY=<span class="math-container">$DISPLAY"
--env="QT_X11_NO_MITSHM=1"
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw"
--volume="$</span>XAUTHORITY:<span class="math-container">$XAUTHORITY"
--env="XAUTHORITY=$</span>XAUTHORITY"
--runtime=nvidia
--net=host
--env="NVIDIA_DRIVER_CAPABILITIES=all"
--gpus all
</code></pre>
|
107875
|
2024-01-26T11:46:42.017
|
|gazebo|docker|gazebo-ignition|ignition-fortress|ignition-citadel|
|
<p>I have run into a problem that when I start an empty world with Gazebo (I have tested this with Citadel, Fortress and Harmonic) inside a docker container my CPU usage shoots up to 70%. When I start Gazebo on my computer without a container the CPU usage is much smaller, about 10%. This is when the GUI is turned on.</p>
<p><a href="https://i.stack.imgur.com/uTqrv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uTqrv.png" alt="enter image description here" /></a></p>
<p>I have an NVIDIA GeForce RTX 3050 graphics card, and I think I set the system up so the container can use it. Both the nvidia-smi and the glxgears commands give the expected outputs. When I look at the GPU usage after starting Gazebo I see that it goes up to about the same level both when I start Gazebo on my computer and inside the container. Unfortunately I cannot see the processes running inside the container with the nvidia-smi command, but based on the usage I assume that Gazebo does use my GPU.</p>
<p>Has anyone encountered this problem before? Did you find what causes this, is it possible that my GPU setup is still missing something?</p>
<p>Thanks in advance!</p>
|
Very high CPU usage when running Gazebo in a docker container
|
<p>I found solution: i need to create timer which will fire async after defined time and check in timer's callback if future is ready with wait_for(0s). Also i need (i think) to store request ids for when i call service when timer is not yet finished, so i can clear all queued requests. Timer and vector are initialized in node's constructor.</p>
<pre><code>auto futureAndRequestID =
client->async_send_request(request, [this](rclcpp::Client<my_interface::srv::myService>::SharedFuture future) {
auto result = future.get();
//do stuff when service returns
});
rclcpp::Client<my_interface::srv::myService>::SharedFuture future = futureAndRequestID.future;
vectorOfIds->push_back(futureAndRequestID.request_id);
timer = create_wall_timer(5s, [this, future]() {
if (future.wait_for(0s) != std::future_status::ready) {
//"TimeOut"
for (const auto id : *vectorOfIds) {
client->remove_pending_request(id);
}
vectorOfIds->clear();
}
timer->cancel();
});
</code></pre>
|
107877
|
2024-01-26T12:38:28.780
|
|ros2|rosservice|
|
<p>Following <a href="https://github.com/ros2/demos/blob/40e3732791c8c72215a5eb954e9e25be1a5ebb73/demo_nodes_cpp/src/services/add_two_ints_client_async.cpp#L62..L73" rel="nofollow noreferrer">this example</a> how do i create an async timeout to service? I want client to wait for 5s asynchronously to get response, if it is not received log something and clear request.</p>
|
How to create timeout to ROS2 async client service?
|
<p>Ok, after trying I ended up with an implementation that works. I was almost there, actually.</p>
<p>The solution summarizes as:</p>
<ul>
<li>Multithreaded executor.</li>
<li>Two callback groups <code>MutuallyExclusive</code>, one for each action (<code>nav2_msgs::action::NavigateToPose</code>, <code>nav2_msgs::action::ComputePathToPose</code>). The other subscribers/timers can share callback group with one of them.</li>
<li>The asynchronous call to <code>NavigateToPose</code> action server remains the same as <a href="https://github.com/ros2/examples/blob/humble/rclcpp/actions/minimal_action_client/member_functions.cpp" rel="nofollow noreferrer">this example</a>.</li>
<li>The synchronous call to <code>ComputePathToPose</code> action server is implemented as posted in the question.</li>
</ul>
<p>However, I don't understand which was the error. Somehow, the two action clients sharing the same reentrant callback group were incompatible. Also, I'm not sure if the solution is overkilling in some sense, but it works.</p>
<p>I don't know how much popular was <code>nav_msgs::GetPlan</code>, in my case it was very useful to evaluate potential goals before deciding where to navigate. The new way of implementing this feature in ROS2 and Nav2 is way more complicated and it is not documented anywhere. I hope this entry can help others that want to implement this or similar features.</p>
|
107881
|
2024-01-26T16:26:54.140
|
|ros2|nav2|rclcpp|
|
<p>I've been migrating to ROS Humble a ROS 1 exploration project in C++.</p>
<p>This project considers a list of goal candidates and to evaluate them we use to call the service <code>nav_msgs::GetPlan</code> to the move_base global planner ("move_base/NavfnROS/make_plan"). It provided the information of whether all the candidate goals are reachable and their path length without actually sending any goal to the action server.</p>
<p>Now in Nav2 there is no this service anymore, the closest thing I found is the action <code>nav2_msgs::action::ComputePathToPose</code>.</p>
<p>Also, there is the "typical" (asyncronous) action client that actually sends the goal to the be reached by the robot (<code>nav2_msgs::action::NavigateToPose</code>).</p>
<p>I managed to call the action <code>nav2_msgs::action::ComputePathToPose</code> synchronously (I want to evaluate all the candidates and decide afterwards). It required a Multithreaded executor and a callback_group (reentrant). The code of this synchronous call follows in case it is useful:</p>
<pre class="lang-cpp prettyprint-override"><code>double ExplorationBase::computePathLength(const geometry_msgs::msg::Pose &goal_pose)
{
if (not compute_path_client_->wait_for_action_server(std::chrono::milliseconds(50)))
{
RCLCPP_ERROR(this->get_logger(), "Action server compute_path_to_pose not available after waiting 50ms");
return -1;
}
if (not compute_path_client_->action_server_is_ready())
{
RCLCPP_ERROR(this->get_logger(), "Action server compute_path_client_ not ready");
return -1;
}
// Populate a goal
auto goal_msg = ComputePath::Goal();
goal_msg.goal.header.frame_id = "map";
goal_msg.goal.pose = goal_pose;
goal_msg.use_start = false; // use current robot pose as path start
goal_msg.planner_id = "GridBased";
// Wait 50ms for the server to accept the goal
auto goal_handle_future = compute_path_client_->async_send_goal(goal_msg);
if (goal_handle_future.wait_for(std::chrono::milliseconds(1000)) == std::future_status::timeout)
{
RCLCPP_ERROR(this->get_logger(), "compute_path_to_pose: send goal call failed :(");
return -1;
}
GoalHandleComputePath::SharedPtr goal_handle = goal_handle_future.get();
if (!goal_handle)
{
RCLCPP_ERROR(this->get_logger(), "compute_path_to_pose: Goal was rejected by the server");
return -1;
}
// Wait 50ms more for the server to be done with the goal
auto result_future = compute_path_client_->async_get_result(goal_handle);
if (result_future.wait_for(std::chrono::milliseconds(50)) == std::future_status::timeout)
{
RCLCPP_ERROR(this->get_logger(), "compute_path_to_pose: get result call failed :(");
return -1;
}
// get the result
GoalHandleComputePath::WrappedResult wrapped_result = result_future.get();
switch (wrapped_result.code)
{
case rclcpp_action::ResultCode::SUCCEEDED:
break;
case rclcpp_action::ResultCode::ABORTED:
RCLCPP_ERROR(this->get_logger(), "compute_path_to_pose: Goal was aborted");
return -1;
case rclcpp_action::ResultCode::CANCELED:
RCLCPP_ERROR(this->get_logger(), "compute_path_to_pose: Goal was canceled");
return -1;
default:
RCLCPP_ERROR(this->get_logger(), "compute_path_to_pose: Unknown result code");
return -1;
}
// compute path length
double length = 0.0;
if (wrapped_result.result->path.poses.size() >= 1)
{
for (unsigned int i = 1; i < wrapped_result.result->path.poses.size(); i++)
{
double &x1 = wrapped_result.result->path.poses[i - 1].pose.position.x;
double &y1 = wrapped_result.result->path.poses[i - 1].pose.position.y;
double &x2 = wrapped_result.result->path.poses[i].pose.position.x;
double &y2 = wrapped_result.result->path.poses[i].pose.position.y;
double d = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
length += d;
}
}
return length;
}
</code></pre>
<p>However, eventually I experience a runtime error:</p>
<p><code>what(): Executing action client but nothing is ready</code></p>
<p>I do not know which is the issue here. In both actions, I added <code>wait_for_action_server(50ms)</code> and check <code>action_server_is_ready()</code> before calling each of the action servers. Also, added <code>try-catch</code> in all code related with these actions and still experience this problem.</p>
<p>I'd appreciate some help, thanks.</p>
|
Nav2: Migrate from nav_msg::getPlan
|
<p>I needed to put the calculated value directly instead sum the xacros variables....did not find another way to fix it.</p>
<p>The fix is below:</p>
<pre><code> <!-- calculate moments of inertia -->
<xacro:property name="wheel_mass" value="74"/>
<xacro:property name="wheel_radius" value="0.536"/>
<!-- <xacro:property name="ixx_iyy_inertia" value="0.5 * <span class="math-container">${wheel_mass} * $</span>{wheel_radius} * <span class="math-container">${wheel_radius}"/>
<xacro:property name="izz_inertia" value="$</span>{wheel_mass} * <span class="math-container">${wheel_radius} * $</span>{wheel_radius}"/> -->
<xacro:property name="ixx_iyy_inertia" value="10.629952"/>
<xacro:property name="izz_inertia" value="21.259904"/>
</code></pre>
|
107884
|
2024-01-26T21:51:22.613
|
|gazebo|xacro|sdformat|sdf|ros-iron|
|
<p>I am encountering an issue in ROS2 Iron that wasn't present in ROS2 Galactic, related to the conversion of a URDF file (generated from XACRO) to SDF, specifically regarding the inertia elements. I am using ROS2 Iron on Ubuntu 22.04</p>
<p><strong>Problem Description:</strong></p>
<p>In ROS2 Galactic, the conversion of my URDF file (generated from a XACRO file with inertia calculations) to SDF was successful. However, <strong>after upgrading to ROS2 Iron, the same URDF to SDF conversion process leads to errors</strong>.</p>
<p><strong>Steps Taken:</strong></p>
<p>1- I created a simple XACRO file with basic inertia calculations and successfully converted it to a URDF file using the command:</p>
<pre><code>xacro simple_wheel.xacro > simple_wheel.urdf
</code></pre>
<p>2 - When converting the generated URDF file to SDF using the following command:</p>
<pre><code>gz sdf -p simple_wheel.urdf > simple_wheel.sdf
</code></pre>
<p>3- I received errors related to the inertia elements:</p>
<pre><code>Error: Inertial: inertia element ixx is not a valid double
at line 334 in ./urdf_parser/src/link.cpp
Error: Could not parse inertial element for Link [simple_wheel]
at line 435 in ./urdf_parser/src/link.cpp
</code></pre>
<p>The URDF file includes correctly formatted inertia elements, but they seem to be misinterpreted during the SDF conversion.</p>
<p><strong>Specific Questions:</strong></p>
<ol>
<li>Are there known issues or changes in ROS2 Iron affecting the URDF to SDF conversion process, especially regarding inertia elements?</li>
<li>Do I need to <strong>follow a different procedure or use specific tools in ROS2 Iron for accurate SDF conversion?</strong></li>
<li>Is there a recommended workaround or solution to ensure that inertia elements are correctly processed during the URDF to SDF conversion in ROS2 Iron?</li>
</ol>
<p><strong>XACRO File Snippet for Reference:</strong></p>
<pre><code><?xml version="1.0"?>
<robot name="simple_robot" xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:property name="wheel_mass" value="74"/>
<xacro:property name="wheel_radius" value="0.536"/>
<xacro:property name="ixx_iyy_inertia" value="0.5 * <span class="math-container">${wheel_mass} * $</span>{wheel_radius} * <span class="math-container">${wheel_radius}"/>
<xacro:property name="izz_inertia" value="$</span>{wheel_mass} * <span class="math-container">${wheel_radius} * $</span>{wheel_radius}"/>
<!-- link definitions -->
</robot>
</code></pre>
<p>I appreciate any insights or suggestions</p>
|
Inertia Element Conversion Issues in URDF to SDF in ROS2 Iron (Worked in Galactic)
|
<p>Include <code>gazebo_ros2_control</code> plugin as</p>
<pre><code><gazebo>
<plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
<parameters>$(find ros2_control_demo_example_7)/config/r6bot_controller.yaml</parameters>
</plugin>
</gazebo>
</code></pre>
<p>Remove the <code>control_node</code> from <code>r6bot_controller.launch.py</code>.</p>
<p>Also, Include <code>gazebo_ros2_control/GazeboSystem</code> hardware plugin as</p>
<pre><code><plugin>gazebo_ros2_control/GazeboSystem</plugin>
</code></pre>
|
107890
|
2024-01-27T15:40:20.757
|
|ros2|robotic-arm|ros-humble|gazebo-11|ros2-control|
|
<p>I am trying to run the <code>ros2_control_demo_example_7</code> package of <a href="https://control.ros.org/humble/doc/ros2_control_demos/example_7/doc/userdoc.html" rel="nofollow noreferrer">ros2_control_demos</a> with some modifications to spawn <code>r6bot</code> robot inside gazebo. I am not using <code>gazebo_ros2_control</code> plugin since on using it I am getting error as pointed out <a href="https://robotics.stackexchange.com/questions/103767/class-gazebo-ros2-control-gazebosystem-with-base-class-type-hardware-interface">here</a>. As suggested there, I am using <code>ros2_control_node</code> in place of <code>gazebo_ros2_control</code> plugin.</p>
<p>I have also included the physical properties of each joint in the urdf:</p>
<pre><code><dynamics damping="0.15" friction="0"/>
</code></pre>
<p>Also, defined the material properties of each link in the gazebo description as below:</p>
<pre><code> <gazebo reference="${prefix}base_link">
<selfCollide>true</selfCollide>
<mu1 value="0.0"/>
<mu2 value="0.0"/>
<kp value="10000000.0"/>
<kd value="1.0"/>
<turnGravityOff>false</turnGravityOff>
</gazebo>
</code></pre>
<p>Everything seems to be working in the terminal but I am getting below output in the gazebo:</p>
<p><a href="https://i.stack.imgur.com/0nwhf.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0nwhf.gif" alt="enter image description here" /></a></p>
<p><strong>r6bot_controller.launch.py</strong></p>
<pre><code>def generate_launch_description():
gaz_pkg_share = FindPackageShare(package='ros2_control_demo_example_7').find('ros2_control_demo_example_7')
world_file_name = 'empty.world'
world_path = os.path.join(gaz_pkg_share, 'worlds', world_file_name)
# Set the path to the SDF model files.
gazebo_models_path = os.path.join(gaz_pkg_share, 'models')
if 'GAZEBO_MODEL_PATH' in os.environ:
os.environ['GAZEBO_MODEL_PATH'] = os.environ['GAZEBO_MODEL_PATH'] + ':' + gazebo_models_path
else:
os.environ['GAZEBO_MODEL_PATH'] = gazebo_models_path
# Get URDF via xacro
robot_description_content = Command(
[
PathJoinSubstitution([FindExecutable(name="xacro")]),
" ",
PathJoinSubstitution(
[
FindPackageShare("ros2_control_demo_example_7"),
"urdf",
"r6bot.urdf.xacro",
]
),
]
)
robot_description = {"robot_description": robot_description_content}
robot_controllers = PathJoinSubstitution(
[
FindPackageShare("ros2_control_demo_example_7"),
"config",
"r6bot_controller.yaml",
]
)
rviz_config_file = PathJoinSubstitution(
[FindPackageShare("ros2_control_demo_description"), "r6bot/rviz", "view_robot.rviz"]
)
gazebo = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[PathJoinSubstitution([FindPackageShare("gazebo_ros"), "launch", "gazebo.launch.py"])]
),
launch_arguments={"verbose": "true",
"paused":"false",
"gui":"true",
"world":world_path,
"headless":"false",
"use_sim_time":"true"}.items(),
)
spawn_entity = Node(
package="gazebo_ros",
executable="spawn_entity.py",
arguments=["-topic", "robot_description", "-entity", "r6bot"],
output="screen",
)
control_node = Node(
package="controller_manager",
executable="ros2_control_node",
parameters=[robot_description, robot_controllers],
remappings=[
(
"/forward_position_controller/commands",
"/position_commands",
),
],
output="both",
)
joint_state_publisher_node = Node(
package="joint_state_publisher_gui",
executable="joint_state_publisher_gui",
condition=IfCondition("true"),
)
robot_state_pub_node = Node(
package="robot_state_publisher",
executable="robot_state_publisher",
output="both",
parameters=[robot_description],
)
rviz_node = Node(
package="rviz2",
executable="rviz2",
name="rviz2",
output="log",
arguments=["-d", rviz_config_file],
)
joint_state_broadcaster_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["joint_state_broadcaster", "--controller-manager", "/controller_manager"],
)
robot_controller_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["r6bot_controller", "-c", "/controller_manager"],
)
# Delay rviz start after `joint_state_broadcaster`
delay_rviz_after_joint_state_broadcaster_spawner = RegisterEventHandler(
event_handler=OnProcessExit(
target_action=joint_state_broadcaster_spawner,
on_exit=[rviz_node],
)
)
# Delay start of robot_controller after `joint_state_broadcaster`
delay_robot_controller_spawner_after_joint_state_broadcaster_spawner = RegisterEventHandler(
event_handler=OnProcessExit(
target_action=joint_state_broadcaster_spawner,
on_exit=[robot_controller_spawner],
)
)
nodes = [
joint_state_publisher_node,
control_node,
robot_state_pub_node,
gazebo,
spawn_entity,
joint_state_broadcaster_spawner,
delay_rviz_after_joint_state_broadcaster_spawner,
delay_robot_controller_spawner_after_joint_state_broadcaster_spawner,
]
return LaunchDescription(nodes)
</code></pre>
<p><strong>r6bot_controller.yaml</strong></p>
<pre><code>controller_manager:
ros__parameters:
update_rate: 10 # Hz
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
r6bot_controller:
type: ros2_control_demo_example_7/RobotController
forward_position_controller:
type: forward_command_controller/ForwardCommandController
forward_position_controller:
ros__parameters:
joints:
- joint_1
- joint_2
- joint_3
- joint_4
- joint_5
- joint_6
interface_name: position
r6bot_controller:
ros__parameters:
joints:
- joint_1
- joint_2
- joint_3
- joint_4
- joint_5
- joint_6
command_interfaces:
- position
state_interfaces:
- position
</code></pre>
<p><strong>ros2 control</strong></p>
<p>(Here I am using <code>ros2_control_demo_example_8/RRBotTransmissionsSystemPositionOnlyHardware</code> plugin, defined in the <a href="https://github.com/ros-controls/ros2_control_demos/blob/humble/example_8/hardware/rrbot_transmissions_system_position_only.cpp" rel="nofollow noreferrer">ros2_control_demo_example_8</a> package)</p>
<pre><code><ros2_control name="${name}" type="system">
<hardware>
<plugin>ros2_control_demo_example_8/RRBotTransmissionsSystemPositionOnlyHardware</plugin>
<param name="actuator_slowdown">100.0</param>
</hardware>
<joint name="joint_1">
<command_interface name="position">
<param name="min">{-2*pi}</param>
<param name="max">{2*pi}</param>
</command_interface>
<state_interface name="position">
<param name="initial_value">0.0</param>
</state_interface>
</joint>
<joint name="joint_2">
<command_interface name="position">
<param name="min">{-2*pi}</param>
<param name="max">{2*pi}</param>
</command_interface>
<state_interface name="position">
<param name="initial_value">0.0</param>
</state_interface>
</joint>
<joint name="joint_3">
<command_interface name="position">
<param name="min">{-pi}</param>
<param name="max">{pi}</param>
</command_interface>
<state_interface name="position">
<param name="initial_value">0.0</param>
</state_interface>
</joint>
<joint name="joint_4">
<command_interface name="position">
<param name="min">{-2*pi}</param>
<param name="max">{2*pi}</param>
</command_interface>
<state_interface name="position">
<param name="initial_value">0.0</param>
</state_interface>
</joint>
<joint name="joint_5">
<command_interface name="position">
<param name="min">{-2*pi}</param>
<param name="max">{2*pi}</param>
</command_interface>
<state_interface name="position">
<param name="initial_value">0.0</param>
</state_interface>
</joint>
<joint name="joint_6">
<command_interface name="position">
<param name="min">{-2*pi}</param>
<param name="max">{2*pi}</param>
</command_interface>
<state_interface name="position">
<param name="initial_value">0.0</param>
</state_interface>
</joint>
<transmission name="transmission1">
<plugin>transmission_interface/SimpleTransmission</plugin>
<actuator name="actuator1" role="actuator1"/>
<joint name="joint_1" role="joint_1">
<mechanical_reduction>4.0</mechanical_reduction>
<offset>0.0</offset>
</joint>
</transmission>
<transmission name="transmission2">
<plugin>transmission_interface/SimpleTransmission</plugin>
<actuator name="actuator2" role="actuator2"/>
<joint name="joint_2" role="joint_2">
<mechanical_reduction>4.0</mechanical_reduction>
<offset>0.0</offset>
</joint>
</transmission>
<transmission name="transmission3">
<plugin>transmission_interface/SimpleTransmission</plugin>
<actuator name="actuator3" role="actuator3"/>
<joint name="joint_3" role="joint_3">
<mechanical_reduction>4.0</mechanical_reduction>
<offset>0.0</offset>
</joint>
</transmission>
<transmission name="transmission4">
<plugin>transmission_interface/SimpleTransmission</plugin>
<actuator name="actuator4" role="actuator4"/>
<joint name="joint_4" role="joint_4">
<mechanical_reduction>4.0</mechanical_reduction>
<offset>0.0</offset>
</joint>
</transmission>
<transmission name="transmission5">
<plugin>transmission_interface/SimpleTransmission</plugin>
<actuator name="actuator5" role="actuator5"/>
<joint name="joint_5" role="joint_5">
<mechanical_reduction>4.0</mechanical_reduction>
<offset>0.0</offset>
</joint>
</transmission>
<transmission name="transmission6">
<plugin>transmission_interface/SimpleTransmission</plugin>
<actuator name="actuator6" role="actuator6"/>
<joint name="joint_6" role="joint_6">
<mechanical_reduction>4.0</mechanical_reduction>
<offset>0.0</offset>
</joint>
</transmission>
</ros2_control>
</code></pre>
<p>I am expecting robotic arm to spawn inside gazebo with below configuration:
<a href="https://i.stack.imgur.com/AK1ts.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AK1ts.png" alt="enter image description here" /></a></p>
<p>Am I missing something or doing something wrong? Is this happening because of PID or other parameters? I would really appreciate some advice on this.</p>
|
Robotic arm moves on loading inside Gazebo
|
<p>The solution was switch the default complex physics:</p>
<pre><code> <physics type="ode">
<real_time_update_rate>1000.0</real_time_update_rate>
<max_step_size>0.013</max_step_size> <!-- Smaller for more accuracy -->
<real_time_factor>1</real_time_factor>
<ode>
<solver>
<type>quick</type>
<iters>100</iters> <!-- Reduced from 150 to potentially soften the simulation, lower to reduce computational load -->
<precon_iters>0</precon_iters>
<sor>1.4</sor> <!-- Lower to potentially reduce rigidity -->
<use_dynamic_moi_rescaling>1</use_dynamic_moi_rescaling>
</solver>
<constraints>
<cfm>0.001</cfm> <!-- Lower for a tighter simulation, reducing "sponginess" -->
<erp>0.15</erp> <!-- Increase to ensure error correction is more effective -->
<contact_max_correcting_vel>500.000000</contact_max_correcting_vel> <!-- Lower to reduce the aggressiveness of contact corrections -->
<contact_surface_layer>0.01</contact_surface_layer> <!-- Lower to minimize penetration without increasing rigidity -->
</constraints>
</ode>
</physics>
</code></pre>
<p>for this basic one, based on <a href="https://github.com/osrf/car_demo/blob/master/car_demo/worlds/mcity.world" rel="nofollow noreferrer">Prius Repository</a></p>
<pre><code> <physics name='default_physics' default='0' type='ode'>
<max_step_size>0.001</max_step_size>
<real_time_factor>1</real_time_factor>
<real_time_update_rate>1000</real_time_update_rate>
</physics>
</code></pre>
<p>However I am still facing an issue, which is the joints of my truck does not let it static, even if I publish a cmd_vel = 0 to emulate a handbrake. It starts falling down on reverse as the video below shows:</p>
<p><a href="https://youtu.be/hWP9Ogt1YDM" rel="nofollow noreferrer">Truck Sliding on Reverse</a></p>
<p><strong>I am trying to implement a fake anchor, kind of handbrake, to attach the truck to the ground, but not sure if it is going to work.</strong></p>
<p>Otherwise I will need to switch the simple ackermman gazeboplugin for a more complex dynamic truck model, which assigns torque, force, power, etc to the truck's whell joints such as <a href="https://github.com/osrf/car_demo/blob/master/car_demo/plugins/PriusHybridPlugin.cc" rel="nofollow noreferrer">Prius Hybrid Plugins</a></p>
|
107907
|
2024-01-29T03:27:12.417
|
|gazebo|simulation|xacro|ros-iron|nav2d-tutorials|
|
<p>I am simulating a truck in Gazebo, which operates well in a minimal empty world, responding effectively to <strong>cmd_vel</strong> commands sent via the <strong>bcr_teleop</strong> package. However, when the simulation is run in more complex environments, such as the default Sonoma Raceway or custom off-road terrains, the truck hardly moves.</p>
<p>The truck model, defined in a <strong>.xacro</strong> file, includes four active wheels (first and fourth) responsible for traction and four passive wheels (second and third) that are intended to be pulled without providing additional traction. Despite adjusting various parameters, the truck's mobility remains significantly restricted in these complex environments.</p>
<p>Here are the key adjustments I've made in an attempt to improve performance:</p>
<p><strong>PID Tuning for Active Wheels:</strong></p>
<ul>
<li>Increased the P gain in the steering PID from <strong>1500</strong> to <strong>1700</strong> for better steering response.</li>
<li>Increased the P gain in the linear velocity PID from <strong>1000</strong> to <strong>1200</strong> for better velocity control.</li>
</ul>
<p><strong>Friction and Collision Settings for Active Wheels:</strong></p>
<p>-Increased the friction coefficients (<strong>mu</strong> and <strong>mu2</strong>) from <strong>1.0</strong> to <strong>1.5</strong> to enhance traction.</p>
<p>-Increased the spring stiffness constant (<strong>kp</strong>) from <strong>5000000.0</strong> to <strong>7000000.0</strong> for better surface contact.</p>
<ul>
<li>Increased the damping coefficient (<strong>kd</strong>) from <strong>1.0</strong> to <strong>3.0</strong> for improved shock absorption.</li>
</ul>
<p>Despite these adjustments, the truck's movement in complex environments like Sonoma Raceway or off-road terrains <strong>is minimal compared to its performance in an empty world</strong>. This leads me to suspect that the issue might involve interaction with the environment's surface properties or other Gazebo-specific physics settings affecting vehicle-ground interactions.</p>
<p><strong>VIDEO OF THIS BEHAVIOR:</strong></p>
<p><a href="https://youtu.be/73ZJi3PyP-I" rel="nofollow noreferrer">Truck Only moves on Empty world, not over terrains</a></p>
<p>Given the truck's design, with passive wheels on the second and third shafts, I'm curious if the terrain's properties in these complex environments are contributing to the limited mobility. <strong>Is there a particular Gazebo setting or simulation parameter</strong> that I might be overlooking that could account for this discrepancy in performance across different environments?</p>
<p>Any insights, suggestions, or <strong>diagnostic tips</strong> would be greatly appreciated, as I aim to achieve realistic truck movement across various terrains in Gazebo.</p>
|
Why Does My Gazebo Simulated Truck Move Well in an Empty World But Not in Complex Environments Like Sonoma Raceway?
|
<p>I'll explain the error first and then get to further details.</p>
<blockquote>
<p>ERROR: the following packages/stacks could not have their rosdep keys resolved to system dependencies: lidar_odometry: Cannot locate</p>
</blockquote>
<p>This error is expected, mainly because the package <code>lidar_odometry</code> is not a system dependency, instead it is a simple ROS 2 package. When you ask the <code>rosdep</code> tool to find the dependencies for the packages located in src, and install them, it fails to find any dependencies for the package named <code>lidar_odometry</code>, since it is not yet listed in the rosdistro.</p>
<p>You can try to simply run the nodes from the <code>lidar_odometry</code> package, it should be working fine if you have the PCL library installed, as you said in your question.</p>
<p>You would simply need to install the libraries mentioned in the README, clone it into the src directory of your workspace, and run <code>colcon build</code> from the root of your workspace.</p>
|
107920
|
2024-01-29T12:20:57.633
|
|ros2|pcl|dependencies|
|
<p>Im trying to use the github package for 2D LiDAR-based odometry in ROS2 humble. This is the package github <a href="https://github.com/dawan0111/Simple-2D-LiDAR-Odometry" rel="nofollow noreferrer">Simple-2D-LiDAR-Odometry</a></p>
<p>I installed the dependencies required with</p>
<pre><code>sudo apt-get install libeigen3-dev libpcl-dev
</code></pre>
<p>Then when try to run <code>rosdep install -i --from-path src --rosdistro humble -y</code> I got the following error:</p>
<blockquote>
<pre><code>ERROR: the following packages/stacks could not have their rosdep keys resolved to system dependencies: lidar_odometry: Cannot locate
</code></pre>
<p>rosdep definition for [PCL]</p>
</blockquote>
<p>I tried to search everything but still no help. The package .xml file is</p>
<pre><code><?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>lidar_odometry</name>
<version>1.0.0</version>
<description>2D LiDAR Odometry package. using GICP</description>
<maintainer email="msd030428@gmail.com">KDW</maintainer>
<license>Apache 2.0</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<depend>rclcpp</depend>
<depend>nav_msgs</depend>
<depend>sensor_msgs</depend>
<depend>geometry_msgs</depend>
<depend>Eigen3</depend>
<depend>PCL</depend>
<depend>laser_geometry</depend>
<depend>pcl_conversions</depend>
<depend>tf2</depend>
<depend>tf2_eigen</depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>
</code></pre>
<p>Any help?</p>
|
How to solve the ERROR Cannot locate rosdep definition for [PCL] in ROS2 Humble?
|
<p>We did a port of the UUV Plume Simulator Package to Ros2 and it is available here:</p>
<p><a href="https://github.com/tiko5000/uuv_plume_simulator_ros2" rel="nofollow noreferrer">https://github.com/tiko5000/uuv_plume_simulator_ros2</a></p>
|
107940
|
2024-01-30T11:53:41.463
|
|gazebo|ros-humble|underwater|auv|usv|
|
<p>I want to develop and test adaptive path planning algorithms for AUVs or also USVs.</p>
<p>So far I did this in ROS1 with the <a href="https://github.com/uuvsimulator" rel="nofollow noreferrer">UUV Simulator</a> and especially the <a href="https://github.com/uuvsimulator/uuv_plume_simulator" rel="nofollow noreferrer">uuv_plume_simulator</a>.</p>
<p>Now I am looking for ways to do this in ROS2.</p>
<p>I managed to get a simulation of an AUV working with ROS2 Humble and Gazebo Ignition but I couldn't find a solution comparable to the UUV Plume Simulator.</p>
<p>Are there Gazebo (Ignition/Garden/Harmonic) Plugins or Projects that already deal with the simulation of the distribution of water properties like salinity/turbidity/temperature or the simulation of freshwater/hotwater/oil/particle spill or plumes?
Ideally these properties would be also influenced by currents.</p>
<p>So far i only came across the <a href="https://gazebosim.org/api/sim/8/classgz_1_1sim_1_1systems_1_1EnvironmentPreload.html" rel="nofollow noreferrer">EnvironmentPreload</a> Plugin for Gazebo Harmonic but it seems to only offer the a static distribution of values.</p>
<p>Any recommendations are highly appreciated.</p>
|
Underwater Property Simulation with ROS2 e.g Particle Plume
|
<p>You can build from source, I have a video about this actually</p>
<p><a href="https://www.youtube.com/watch?v=kQLPupPkQiU" rel="nofollow noreferrer">https://www.youtube.com/watch?v=kQLPupPkQiU</a></p>
|
107943
|
2024-01-30T14:16:44.930
|
|ros2|ubuntu|ros-humble|jetson|
|
<p>is it possible to run ubuntu 22.04 to install and run ROS2 on a Jetson Nano Orin? I have mainly seen solutions using Docker but it would be much easier for me to not have to go through docker and better for my use case, as I will be using RViz and Gazebo a lot.</p>
|
Is it possible to run ROS2 Humble and Ubuntu 22.04 on a Jetson Nano Orin (other than through Docker)?
|
<p>There is currently no ros2_controller supporting omniwheels. If it has standard wheels, use the diff_drive controller as in <a href="https://control.ros.org/humble/doc/ros2_control_demos/example_2/doc/userdoc.html" rel="nofollow noreferrer">this demo</a>. Consider the wheels_per_side <a href="https://github.com/ros-controls/ros2_controllers/blob/humble/diff_drive_controller/src/diff_drive_controller_parameter.yaml" rel="nofollow noreferrer">parameter</a>.</p>
|
107952
|
2024-01-31T10:32:31.580
|
|ros-humble|differential-drive|ros2-control|skid-steer|
|
<p>I have a 4 wheeled robot with mecanum wheels (in real life), I have been able to simulate it and get it to work with the ROS2 DiffDrive plugin (replicating the skid steer plugin from ROS1) but now that I want to implement ROS2 Control with it I cannot get it to work. I have been following the Articubot tutorials but his robot only has 2 wheels. I can't find anything online regarding a 4 wheeled robot that would make use of the DiffDrive plugin on ROS2 while using ROS2 Control. At the moment My aim is to only simulate the robot in gazebo so that I can better understand how ROS2 control works but I am stuck.</p>
<p><a href="https://github.com/balen-muon/ford_bot" rel="nofollow noreferrer">GitHub Repo</a></p>
<p>I hope the question is clear.</p>
<p>Some guidance on how to make ROS2 Control work with this robot with be very much appreciated. Thanks</p>
|
How to make 4 wheeled robot work with DiffDrive plugin and ROS2 Control?
|
<p>I've been building rviz from source with Ogre 1.12 on Ubuntu 22.04, but 1.12 is the standard there so rosdep automatically pulls in libogre-1.12-dev instead of 1.9. But it shouldn't be too hard to get it building in 20.04- I just tried it in docker.</p>
<p>You could just run the rosdep command with <code>--simulate</code> as another argument and manually install what it suggests except for libogre-1.9-dev. Otherwise edit rviz/package.xml to specify 1.12 instead of the system default:</p>
<pre><code><build_depend>libogre-1.12-dev</build_depend>
</code></pre>
<p>and</p>
<pre><code><build_export_depend>libogre-1.12-dev</build_export_depend>
</code></pre>
|
107964
|
2024-01-31T13:16:56.047
|
|rviz|ros-noetic|
|
<p>I use Ubuntu 20.04 and ROS Noetic. I have just learned how to build rviz from source <a href="http://wiki.ros.org/Installation/Source" rel="nofollow noreferrer">here</a> but when I try to use different version of Ogre, it still builds with Ogre 1.9.0. How to correctly build rviz with a different version of Ogre?</p>
<p>What I did was that I uninstalled Ogre 1.9.0:</p>
<pre><code>sudo apt remove libogre-1.9.0v5
</code></pre>
<p>And installed Ogre 1.12:</p>
<pre><code>sudo apt install libogre-1.12
</code></pre>
<p>Then try to build rviz as guided but this step in the documentation, still installs Ogre v1.9.0:</p>
<pre><code>rosdep install --from-paths ./src --ignore-packages-from-source --rosdistro noetic
</code></pre>
<p>How to avoid it and use some a specific other version of Ogre instead?</p>
|
How to build rviz from source using a different version of Ogre?
|
<p>I have fixed this issue using my own custom configuration file based on <a href="https://docs.ros.org/en/jade/api/robot_localization/html/navsat_transform_node.html" rel="nofollow noreferrer">navsat transform node</a> documentation:</p>
<pre><code># For parameter descriptions, please refer to the template parameter files for each node.
ekf_filter_node_odom:
ros__parameters:
frequency: 30.0
two_d_mode: true # Recommended to use 2d mode for nav2 in mostly planar environments
publish_acceleration: false
#print_diagnostics: true
debug: false
publish_tf: true
map_frame: map
odom_frame: odom
base_link_frame: base_footprint # the frame id used by the turtlebot's diff drive plugin
world_frame: map #odom
odom0: /odom
odom0_config: [false, false, false,
false, false, false,
true, true, true,
false, false, true,
false, false, false]
odom0_differential: false
odom0_nodelay: true
odom0_relative: false
odom0_queue_size: 10
imu0: /imu
imu0_config: [false, false, false,
true, true, true,
false, false, false,
true, true, true,
false, false, false]
imu0_differential: false # If using a real robot you might want to set this to true, since usually absolute measurements from real imu's are not very accurate
imu0_nodelay: true
imu0_relative: false
imu0_queue_size: 10
imu0_remove_gravitational_acceleration: true
use_control: false
process_noise_covariance: [1e-3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 1e-3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 1e-3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1]
ekf_filter_node_map:
ros__parameters:
use_sim_time: true
sensor_timeout: 0.1
transform_time_offset: 0.0
transform_timeout: 0.0
frequency: 30.0
two_d_mode: false #true # Recommended to use 2d mode for nav2 in mostly planar environments
#print_diagnostics: true
publish_acceleration: false
debug: false
publish_tf: true
reset_on_time_jump: true
map_frame: map
odom_frame: odom
base_link_frame: base_footprint # the frame id used by the turtlebot's diff drive plugin
world_frame: map
odom0: /odometry/local # = "fused odometry + Imu in previous node"
odom0_config: [false, false, false,
true, true, true,
true, true, true,
true, true, true,
false, false, false]
odom0_queue_size: 10
odom0_nodelay: true
odom0_differential: false #imu # If using a real robot you might want to set this to true, since usually absolute measurements from real imu's are not very accurate
odom0_relative: false
odom1: gps #odometry/gps # try gps if not fix
odom1_config: [false, false, false,
false, false, false,
true, true, true,
false, false, true,
false, false, false]
odom1_queue_size: 10
odom1_nodelay: true
odom1_differential: false
odom1_relative: false
use_control: false
process_noise_covariance: [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 1e-3, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1]
navsat_transform:
ros__parameters:
use_sim_time: true
frequency: 30.0
delay: 3.0
magnetic_declination_radians: 0.0 #0.266512
yaw_offset: 0.0
zero_altitude: true
broadcast_utm_transform: true
publish_filtered_gps: true
use_odometry_yaw: false #true
wait_for_datum: false #true
#datum: [38.161491, -122.4546443, 0.0] # pre-set datum if needed, [lat, lon, yaw]
</code></pre>
<p>I hope it helps other developers who are fitting the nav2 GPS tutorial for his/her robot (not Turtlebot).</p>
|
107978
|
2024-01-31T23:45:00.653
|
|robot-localization|gps|nav2|navsat-transform-node|ekf-localization-node|
|
<p>I'm encountering a peculiar issue with robot movement in RViz2 using Nav2, where the robot exhibits erratic back-and-forth movements accompanied by small jumps during the simulation. This behavior is particularly noticeable when the localization nodes/configurations are running and deviate significantly from the expected smooth navigation.</p>
<p>Environment:</p>
<p><strong>ROS Version:</strong> ROS 2 Iron
<strong>Simulation Environment:</strong> Gazebo
<strong>Robot Model</strong>: Custom model equipped with GPS and IMU sensors
<strong>Localization Setup:</strong> Nav2 with EKF for integrating odometry and GPS data</p>
<p><strong>Issue Description:</strong></p>
<p>In the simulation, the robot's representation in RViz2 shows unexpected erratic movements, including back-and-forth motions and occasional small jumps. This issue arises with the activation of the localization nodes and seems to be tied to how sensor data is being processed or the specific setup of the localization parameters.</p>
<p><strong>Steps to Reproduce:</strong></p>
<p>Initiate the Gazebo simulation with the custom robot model.
Activate the Nav2 localization nodes, employing the EKF setup for odometry and GPS data integration according to the tutorial: <a href="https://navigation.ros.org/tutorials/docs/navigation2_with_gps.html" rel="nofollow noreferrer">Nav2 GPS Tutorial</a></p>
<p><strong>Troubleshooting Attempts:</strong></p>
<ul>
<li>Modulated the process noise covariance values within the EKF settings
(increase values to reduce noise sensibility, and have even commented
out all the covariance values).</li>
<li>Tested variations in the two_d_mode
parameter (set to false).</li>
<li>Reassessed the IMU data fusion
configurations (set roll,pitch,yaw to True).</li>
<li>Confirmed the effective
integration of GPS data.</li>
<li>Checked the synchronization and timing of the sensor data streams.</li>
<li>Verified the accuracy of magnetic declination and yaw offset
parameters.</li>
<li>Increased the frequency of localization nodes from 30 Hz to 250 Hz.</li>
</ul>
<p>Despite these adjustments (isolated tests one by one modification), the erratic movement behavior persists, affecting the robot's localization and navigation performance.My robot model is correct since it opens without shake/jump/back-and-forth move before running the <strong>dual_ekf_navsat.launch.py</strong> launch file.</p>
<p><strong>Questions:</strong></p>
<ul>
<li>What might be the <strong>underlying cause of the erratic back-and-forth
movements</strong> and small jumps observed in the robot's visualization in
RViz2?</li>
<li>Are there <strong>particular Nav2 or EKF configuration parameters</strong> that could
influence the robot's movement stability in such a manner?</li>
<li>Has anyone faced similar challenges with robot movement in RViz2 and
discovered a resolution?</li>
</ul>
<p><strong>Additional Resources:</strong></p>
<p><strong>Configuration Files:</strong></p>
<ul>
<li><p><a href="https://gist.github.com/marcusvinicius178/ef0479ce04f091e6a3e82974b3fa155a" rel="nofollow noreferrer">dual_ekf_navsat.yaml</a></p>
</li>
<li><p><a href="https://gist.github.com/marcusvinicius178/4ce139065bf9d4f5a74de9bb3b7ca9bc" rel="nofollow noreferrer">truck_simulation_launch.py</a></p>
</li>
</ul>
<p><strong>Demonstration Video:</strong> <a href="https://youtu.be/TPlap_X3WJE" rel="nofollow noreferrer">Video of back-and-forth movement and small jumps here</a>
<strong>URDF Ackermann Plugin Code Snippet:</strong></p>
<pre><code> <gazebo>
<plugin name='ackermann_drive' filename='libgazebo_ros_ackermann_drive.so'>
<ros>
<!-- <namespace>/demo</namespace> -->
<parameter name="cmd_vel_topic" value="cmd_vel"/>
<parameter name="odom_topic" value="odom"/>
<parameter name="distance_topic" value="distance"/>
</ros>
<update_rate>30.0</update_rate>
<!-- wheels -->
<front_left_joint>first_wheel_left_joint</front_left_joint>
<front_right_joint>first_wheel_right_joint</front_right_joint>
<rear_left_joint>fourth_wheel_left_joint</rear_left_joint>
<rear_right_joint>fourth_wheel_right_joint</rear_right_joint>
<left_steering_joint>front_left_steer_joint</left_steering_joint>
<right_steering_joint>front_right_steer_joint</right_steering_joint>
<!-- Max absolute steer angle for tyre in radians-->
<!-- Any cmd_vel angular z greater than this would be capped -->
<max_steer>0.6458</max_steer>
<!-- Max absolute steering angle of steering wheel -->
<max_steering_angle>7.85</max_steering_angle>
<!-- Max absolute linear speed in m/s -->
<max_speed>20</max_speed>
<!-- PID tuning -->
<left_steering_pid_gain>1700 0 1</left_steering_pid_gain>
<left_steering_i_range>0 0</left_steering_i_range>
<right_steering_pid_gain>1700 0 1</right_steering_pid_gain>
<right_steering_i_range>0 0</right_steering_i_range>
<linear_velocity_pid_gain>1200 0 1</linear_velocity_pid_gain>
<linear_velocity_i_range>0 0</linear_velocity_i_range>
<!-- output -->
<publish_odom>true</publish_odom>
<publish_odom_tf>true</publish_odom_tf>
<publish_wheel_tf>true</publish_wheel_tf>
<publish_distance>true</publish_distance>
<odometry_frame>odom</odometry_frame>
<robot_base_frame>base_footprint</robot_base_frame>
</plugin>
</gazebo>
<!-- Sometimes is needed to comment the joint state publisher below, otherwise there is REDUNDANCY of joints published
and therefore the truck starts shaking, vibrate, etc-->
<gazebo>
<plugin name="truck_joint_state" filename="libgazebo_ros_joint_state_publisher.so">
<ros>
<remapping>~/out:=joint_states</remapping>
</ros>
<update_rate>30</update_rate>
<joint_name>front_right_steer_joint</joint_name>
<joint_name>front_left_steer_joint</joint_name>
<joint_name>first_wheel_left_joint</joint_name>
<joint_name>first_wheel_right_joint</joint_name>
<joint_name>fourth_wheel_left_joint</joint_name>
<joint_name>fourth_wheel_right_joint</joint_name>
</plugin>
</gazebo>
</robot>
</code></pre>
<p><strong>Illustrative Figure of Back-and-forth (without robot start moving):</strong></p>
<p><a href="https://i.stack.imgur.com/7ljst.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7ljst.png" alt="enter image description here" /></a></p>
<p>Additionally, I observed that in the TF tree below <a href="https://i.stack.imgur.com/TRZJa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TRZJa.png" alt="truck TF" /></a>, the frontal and fourth shafts' wheels are siblings of base_link, but in the URDF, they are children of base_link. This discrepancy did not affect the robot's movement in ROS 2 Galactic, but it might be contributing to the issue in ROS 2 Iron. Here's the output of check_urdf for reference:</p>
<pre><code>robot name is: arocs_truck
---------- Successfully Parsed XML ---------------
root Link: base_footprint has 1 child(ren)
child(1): base_link
child(1): cabin_link
child(1): bar_link
child(1): left_lidar_link
child(2): right_lidar_link
child(2): camera_link
child(1): camera_change_orientation_view
child(3): gps_link
child(4): kinect_link
child(1): kinect_depth_frame
child(5): real_kinect_link
child(1): real_kinect_depth_frame
child(2): first_shaft_horizontal_shaft_link
child(1): front_left_steering_link
child(1): first_wheel_left_link
child(2): front_right_steering_link
child(1): first_wheel_right_link
child(3): fourth_shaft_horizontal_shaft_link
child(1): fourth_wheel_left_link
child(2): fourth_wheel_right_link
child(4): front_left_far_sonar_link
child(5): imu_link
child(6): radar_link
child(7): second_shaft_horizontal_shaft_link
child(1): second_wheel_left_link
child(2): second_wheel_right_link
child(8): sick_link
child(9): third_shaft_horizontal_shaft_link
child(1): third_wheel_left_link
child(2): third_wheel_right_link
</code></pre>
<p>I am not <strong>running amcl nodes</strong>, therefore there are no concurrent publishers of Odom to map transform, etc...</p>
<p>I would greatly appreciate any insights, advice, or potential solutions to rectify this issue. Thank you for your assistance!</p>
|
Erratic Robot Movement in RViz2 with Nav2: Back and Forth Motion and Small Jumps
|
<p>First of all: Galactic is EOL and doesn't receive any updates any more. Please upgrade to a more recent distro.</p>
<p>You are right. The command interfaces is of velocity type (angular speed of the wheels). For odometry calculations, you can use it <code>open_loop</code> (without any sensors), or with sensors: Depending on the parameter <code>position_feedback</code> the state interface has to be of type position or velocity.</p>
<p>For more details check the <a href="https://control.ros.org/master/doc/ros2_controllers/diff_drive_controller/doc/userdoc.html" rel="nofollow noreferrer">documentation</a></p>
|
107979
|
2024-02-01T01:38:21.240
|
|ros2-control|diff-drive-controller|ros2-controllers|
|
<p>Can anyone clarify the units of diff_drive_controller, Command interfaces in velocity are in rad/sec ? and state interfaces for encoders are rotations ? and velocity is again rad/sec ?</p>
<p>Also is there a way in galactic distro under ros2_control to mention the gear reduction so the cmd_vels are generated accordingly or is it going to be part of write function ?</p>
|
ROS2_Control question
|
<p>Thanks Anubhav Singh for the help, since the node parameters where now set properly, I was able to identify the problem. <code>JointLimitsAggregator</code> of the Pilz motion planner doesn't collect other limits then positions and velocities on default.</p>
<p>I've added the function <code>updateAccelerationLimitFromJointModel</code> which does basically the same as the other update functions in order to get the accelerations. Basically the Pilz industrial motion planner cannot be run in MoveIt as is and I am stunned, that nobody has noticed it.</p>
<pre><code>void pilz_industrial_motion_planner::JointLimitsAggregator::updateAccelerationLimitFromJointModel(const moveit::core::JointModel* joint_model, JointLimit& joint_limit)
{
switch (joint_model->getVariableBounds().size())
{
case 0:
RCLCPP_WARN_STREAM(LOGGER, "no bounds set for joint " << joint_model->getName());
break;
case 1:
joint_limit.has_acceleration_limits = joint_model->getVariableBounds()[0].max_acceleration_;
break;
default:
RCLCPP_WARN_STREAM(LOGGER, "Multi-DOF-Joint '" << joint_model->getName() << "' not supported.");
joint_limit.has_acceleration_limits = true;
joint_limit.max_acceleration = 0;
break;
}
}
</code></pre>
<p>The function gets then used in <code>pilz_industrial_motion_planner::JointLimitsAggregator::getAggregatedLimits(const rclcppp::Node::SharedPtr& node, const std::string& param_namespace, const std::vector<const moveit::core::JointModel*>& joint_models)</code> in the same vain as the other update functions.</p>
<p>Unfortunately, no boundary check can be performed yet, since that would require additional implementation of a helper function in <code>moveit_core</code>. But that would go beyond the scope of this question.</p>
|
107983
|
2024-02-01T09:27:05.570
|
|moveit|ros-humble|ros2-control|
|
<p>I want to control a UR5 using <a href="https://github.com/UniversalRobots/Universal_Robots_ROS2_Driver" rel="nofollow noreferrer">Universal Robots Driver</a> and <a href="https://github.com/ros-planning/moveit2/tree/humble" rel="nofollow noreferrer">MoveIt2</a> using Pilz Industrial Motion Planner (ROS2 Humble). If I plan a path using RViz with e.g. PTP I receive errors which disable successful planning.</p>
<p>Errors at start-up:</p>
<pre><code>[move_group-9] [ERROR] [1706777537.271727051] [move_group]: Parameter 'robot_description_planning.cartesian_limits.max_trans_vel', is not set in the config file.
[move_group-9] [ERROR] [1706777537.271727051] [move_group]: Parameter 'robot_description_planning.cartesian_limits.max_trans_acc', is not set in the config file.
[move_group-9] [ERROR] [1706777537.271727051] [move_group]: Parameter 'robot_description_planning.cartesian_limits.max_trans_dec', is not set in the config file.
[move_group-9] [ERROR] [1706777537.271727051] [move_group]: Parameter 'robot_description_planning.cartesian_limits.max_rot_vel', is not set in the config file.
</code></pre>
<p>Error at planning request:</p>
<pre><code>[move_group-9] [ERROR] [1706777811.530897247] [moveit.ros_planning_pipeline]: Exception caught: 'acceleration limit not set for group up_group'
</code></pre>
<p>I've done some digging in the code. <code>pilz_industrial_motion_planner</code> uses for some reason a modified and probably deprecated local copy of <code>ros2_control</code>s <code>joint_limits</code>. Before using the current version the print-out for the most strict joint limit was incomplete.</p>
<p>RCLCPP_ERROR(LOGGER, most_strict_limit_.to_string().c_str()):</p>
<pre><code>has position limits: true [-2.99159, 2.99159]
has velocity limits: true [3.14159]
</code></pre>
<p>When using the current version of <code>joint_limits</code>:</p>
<pre><code>has position limits: true [-2.99159, 2.99159]
has velocity limits: true [3.14159]
has acceleration limits: false [nan]
has jerk limits: false [nan]
has effort limits: false [nan]
angle wraparound: false
</code></pre>
<p>I've got the <code>joint_limits.yaml</code> from <a href="https://github.com/UniversalRobots/Universal_Robots_ROS2_Description/blob/humble/config/ur5e/joint_limits.yaml" rel="nofollow noreferrer">UR Description</a> but I added acceleration limits of an arbitrary value and also set <code>has_acceleration:limits: true</code>. The robot URDF is build using these limits. I've got the impression, that <code>ros2_control</code> also uses the limits from this file, but this doesn't seem to be the case.
Additionally when I look at the parameters using <code>ros2 param get <node> <param></code>, parameters of <code>move_group</code> like <code>robot_description_planning.joint_limits.shoulder_pan_joint.max_velocity</code> are not set, even if they got a value if I print them out.</p>
<p>How do I get <code>ros2_control/joint_limits</code> to read and interpret the values from <code>joint_limits.yaml</code>?</p>
<p>How does the node parameters play into that?</p>
|
How to use `ros2_control`s `joint_limits`?
|
<p>I have finally realised the problem, which lies within the diff drive plugin, specifically <publish_odom_tf> parameter (odom is still published with the<publish_odom> parameter). I've now set it to false since it was also publishing to the /tf topic. This publication was interfering with the robot state publisher's data to /tf causing RViz to continuously switch between two conflicting TF data sets, resulting in twitching behaviour.</p>
<pre><code><gazebo>
<plugin name="diff_drive" filename="libgazebo_ros_diff_drive.so">
<ros>
<namespace>$(arg robot_namespace)</namespace>
<remapping>cmd_vel:=cmd_vel</remapping>
<remapping>odom:=odom</remapping>
</ros>
<legacy_mode>false</legacy_mode>
<update_rate>200.0</update_rate>
<num_wheel_pairs>2</num_wheel_pairs>
<left_joint>wheel4j</left_joint>
<left_joint>wheel2j</left_joint>
<right_joint>wheel3j</right_joint>
<right_joint>wheel1j</right_joint>
<wheel_separation>0.8</wheel_separation>
<wheel_diameter>0.261</wheel_diameter>
<robot_base_frame>base_link</robot_base_frame>
<max_wheel_torque>50</max_wheel_torque>
<command_topic>cmd_vel</command_topic>
<odometry_topic>odom</odometry_topic>
<odometry_frame>odom</odometry_frame>
<publish_odom_tf>false</publish_odom_tf>
<publish_wheel_tf>true</publish_wheel_tf>
<publish_odom>true</publish_odom>
<max_wheel_acceleration>2.0</max_wheel_acceleration>
<!-- 0 for Encoder, 1 for world :odom source-->
<odometry_source>0</odometry_source>
</plugin>
</gazebo>
</code></pre>
<p>Alternate solution, changing the odometry source from encoder to world, solved the issue as well.</p>
|
107989
|
2024-02-01T13:26:07.353
|
|ros2|rviz|controller-manager|ros2-control|multi-robot|
|
<p>I am currently facing an issue when attempting to launch two robots simultaneously in Gazebo Classic using ROS 2. In my setup, the first robot (Frank's Emika) is successfully launched in a Gazebo world and operates smoothly with MoveIt. Additionally, there is a second custom robot that functions correctly when launched on its own.</p>
<p>The problem arises when I attempt to launch the second robot in the same Gazebo world where the panda robot is already running.I placed the second robot under the namespace /r1. In this scenario, the panda robot starts exhibiting an unusual twitching behavior in RViz (not in Gazebo itself), shown by an oscillating motion of the joints returning to their initial positions. Although both robots function properly and can be controlled independently when placed in the same world.</p>
<p><strong>Observation in RViz:</strong>
<a href="https://i.stack.imgur.com/8F6vK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8F6vK.png" alt="enter image description here" /></a>
This graph output displays the position of joint 2 of the Panda robot. In this graph, -1.5 represents the current position, and 0 corresponds to the initial position when I launched the Panda robot. The plot is similar for all the other joints.</p>
<p>Here is the console output on the panda robots terminal when i launch the second robot:</p>
<pre><code>[gzserver-1] [INFO] [1706790610.766430316] [gazebo_ros2_control]: Loading gazebo_ros2_control plugin
[gzserver-1] [INFO] [1706790610.822027052] [r1.gazebo_ros2_control]: Starting gazebo_ros2_control plugin in namespace: /r1
[gzserver-1] [INFO] [1706790610.823049610] [r1.gazebo_ros2_control]: Starting gazebo_ros2_control plugin in ros 2 node: gazebo_ros2_control
[gzserver-1] [INFO] [1706790610.823101325] [r1.gazebo_ros2_control]: Loading parameter files /home/vishalhridwin/temp_ws/install/catcher_description/share/catcher_description/config/mel_controller.yaml
[gzserver-1] [INFO] [1706790610.864285255] [r1.gazebo_ros2_control]: connected to service!! robot_state_publisher
[gzserver-1] [INFO] [1706790610.866664274] [r1.gazebo_ros2_control]: Received urdf from param server, parsing...
[gzserver-1] [INFO] [1706790610.886319189] [r1.gazebo_ros2_control]: Loading joint: catch_arm1
[gzserver-1] [INFO] [1706790610.886392803] [r1.gazebo_ros2_control]: State:
[gzserver-1] [INFO] [1706790610.886421568] [r1.gazebo_ros2_control]: position
[gzserver-1] [INFO] [1706790610.886445826] [r1.gazebo_ros2_control]: velocity
[gzserver-1] [INFO] [1706790610.886465964] [r1.gazebo_ros2_control]: effort
[gzserver-1] [INFO] [1706790610.886486585] [r1.gazebo_ros2_control]: Command:
[gzserver-1] [INFO] [1706790610.886505581] [r1.gazebo_ros2_control]: position
[gzserver-1] [INFO] [1706790610.886551886] [r1.gazebo_ros2_control]: velocity
[gzserver-1] [INFO] [1706790610.886589954] [r1.gazebo_ros2_control]: Loading joint: catch_arm2
[gzserver-1] [INFO] [1706790610.886614122] [r1.gazebo_ros2_control]: State:
[gzserver-1] [INFO] [1706790610.886634775] [r1.gazebo_ros2_control]: position
[gzserver-1] [INFO] [1706790610.886670389] [r1.gazebo_ros2_control]: velocity
[gzserver-1] [INFO] [1706790610.886703765] [r1.gazebo_ros2_control]: effort
[gzserver-1] [INFO] [1706790610.886728126] [r1.gazebo_ros2_control]: Command:
[gzserver-1] [INFO] [1706790610.886747158] [r1.gazebo_ros2_control]: position
[gzserver-1] [INFO] [1706790610.886779746] [r1.gazebo_ros2_control]: velocity
[gzserver-1] [INFO] [1706790610.886805900] [resource_manager]: Initialize hardware 'GazeboSystem'
[gzserver-1] [INFO] [1706790610.886848819] [resource_manager]: Successful initialization of hardware 'GazeboSystem'
[gzserver-1] [INFO] [1706790610.886887136] [resource_manager]: 'configure' hardware 'GazeboSystem'
[gzserver-1] [INFO] [1706790610.886906218] [resource_manager]: Successful 'configure' of hardware 'GazeboSystem'
[gzserver-1] [INFO] [1706790610.886924245] [resource_manager]: 'activate' hardware 'GazeboSystem'
[gzserver-1] [INFO] [1706790610.886941041] [resource_manager]: Successful 'activate' of hardware 'GazeboSystem'
[gzserver-1] [INFO] [1706790610.887021263] [r1.gazebo_ros2_control]: Loading controller_manager
[gzserver-1] [WARN] [1706790611.019279699] [r1.gazebo_ros2_control]: Desired controller update period (0.00769231 s) is slower than the gazebo simulation period (0.001 s).
[gzserver-1] [INFO] [1706790611.022298827] [r1.gazebo_ros2_control]: Loaded gazebo_ros2_control.
[gzserver-1] [INFO] [1706790611.163636897] [r1.diff_drive]: Wheel pair 1 separation set to [0.800000m]
[gzserver-1] [INFO] [1706790611.163792415] [r1.diff_drive]: Wheel pair 1 diameter set to [0.261000m]
[gzserver-1] [INFO] [1706790611.203814186] [r1.diff_drive]: Subscribed to [/r1/cmd_vel]
[gzserver-1] [INFO] [1706790611.240743795] [r1.diff_drive]: Advertise odometry on [/r1/odom]
[gzserver-1] [INFO] [1706790611.302695382] [r1.diff_drive]: Publishing odom transforms between [odom] and [base_link]
[gzserver-1] [INFO] [1706790611.303161972] [r1.diff_drive]: Publishing wheel transforms between [base_link], [wheel1j] and [wheel4j]
[gzserver-1] [INFO] [1706790611.303193262] [r1.diff_drive]: Publishing wheel transforms between [base_link], [wheel3j] and [wheel2j]
[gzserver-1] [INFO] [1706790611.833345190] [r1.controller_manager]: Loading controller 'joint_state_broadcaster'
[gzserver-1] [INFO] [1706790611.981875822] [r1.controller_manager]: Setting use_sim_time=True for joint_state_broadcaster to match controller manager (see ros2_control#325 for details)
[gzserver-1] [INFO] [1706790612.056728698] [r1.controller_manager]: Configuring controller 'joint_state_broadcaster'
[gzserver-1] [INFO] [1706790612.056936313] [r1.joint_state_broadcaster]: 'joints' or 'interfaces' para
meter is empty. All available state interfaces will be published
[gzserver-1] [INFO] [1706790614.947369212] [r1.controller_manager]: Loading controller 'mel_catcher_controller'
[gzserver-1] [WARN] [1706790615.110404934] [r1.mel_catcher_controller]: [Deprecated]: "allow_nonzero_velocity_at_trajectory_end" is set to true. The default behavior will change to false.
[gzserver-1] [INFO] [1706790615.110914849] [r1.controller_manager]: Setting use_sim_time=True for mel_catcher_controller to match controller manager (see ros2_control#325 for details)
[gzserver-1] [INFO] [1706790615.183666240] [r1.controller_manager]: Configuring controller 'mel_catcher_controller'
[gzserver-1] [INFO] [1706790615.193009128] [r1.mel_catcher_controller]: No specific joint names are used for command interfaces. Using 'joints' parameter.
[gzserver-1] [INFO] [1706790615.193091370] [r1.mel_catcher_controller]: Command interfaces are [position velocity] and state interfaces are [position velocity].
[gzserver-1] [INFO] [1706790615.193130146] [r1.mel_catcher_controller]: Using 'splines' interpolation method.
[gzserver-1] [INFO] [1706790615.199339760] [r1.mel_catcher_controller]: Controller state will be published at 50.00 Hz.
[gzserver-1] [INFO] [1706790615.223281978] [r1.mel_catcher_controller]: Action status changes will be monitored at 20.00 Hz.
</code></pre>
<p>Let me know if I could provide any other info. My guess is, it has something to do with the time synchronization b/w the two robot's controllers, but not sure what to do.</p>
|
Unusual Robot Behavior in RViz when Launching Multiple Robots in Gazebo and ROS 2
|
<p>It turns out a straightforward way of overcoming the problem is to use the multi-threaded executor. This requires the publishing node to be created in the script instead of via <code>LaunchDescription</code>. The hardware-dependent library can then be mocked in <code>conftest.py</code> using <code>pytest-stub</code>.</p>
<pre class="lang-py prettyprint-override"><code>from rclpy.executors import MultiThreadedExecutor
class ExampleSubscriber(Node):
def __init__(self):
super().__init__('minimal_subscriber')
self.msgs_rx = []
self.subscription = self.create_subscription(
msg_type=Example,
topic='example',
callback=lambda msg: self.msgs_rx.append(msg),
qos_profile=10)
class TestExampleLink(unittest.TestCase):
@classmethod
def setUpClass(cls):
rclpy.init()
@classmethod
def tearDownClass(cls):
rclpy.shutdown()
def setUp(self):
self.node = rclpy.create_node('test_example_link')
self.executor = MultiThreadedExecutor(num_threads=4)
self.publisher = ExampleNode(publishing_interval=1)
self.subscriber = ExampleSubscriber()
self.executor.add_node(self.publisher)
self.executor.add_node(self.subscriber)
def tearDown(self):
self.node.destroy_node()
def test_stats_mt(self):
try:
end_time = time.time() + 10
while time.time() < end_time:
self.executor.spin_once(timeout_sec=0.1)
if len(self.subscriber.msgs_rx) > 0:
break
self.assertGreater(len(self.subscriber.msgs_rx), 0, 'Failed to receive any messages')
# remaining asserts go here
finally:
self.executor.shutdown()
self.publisher.destroy_node()
self.subscriber.destroy_node()
</code></pre>
<p>conftest.py:</p>
<pre class="lang-py prettyprint-override"><code>from pytest_stub.toolbox import stub_global
class CPUTemperature():
temperature = 42.0
stub_global({
'gpiozero': {
'CPUTemperature': CPUTemperature,
}
})
</code></pre>
|
107994
|
2024-02-01T17:19:16.120
|
|ros2|python|rostest|unit-testing|
|
<p>I have just started working with ROS2 in python on an existing project and have to write unit tests to begin with. The production code will run on a raspberry pi, but testing is being done in an Ubuntu VM on Parallels. My first attempt starts the publisher from within the test, subscribes to it and then checks the message content. The publisher reports, among other things, the CPU temperature, which it gets from the <code>gpiozero</code> module. This crashes when run on the VM because it tries to access the pi-specific hardware. Although this particular issue could be resolved by using the platform-independent psutil package, it will occur in other situations, so I think I need a solution that enables me to use stub packages when running tests, ideally without any modification to the actual code.</p>
<p>As the publisher is started in a different process, I think I have established that none of the 'mocking' approaches of unittest or pytest will work. My only solution at the moment is to put this code in the package script before it attempts to <code>import gpiozero</code>:</p>
<pre class="lang-py prettyprint-override"><code>if os.environ.get('PYTEST_CURRENT_TEST') is not None:
sys.path.insert(0, os.getcwd()+'/test')
import gpiozero
</code></pre>
<p>I have been trying to find a way that doesn't require this addition to the source. LaunchDescription might offer such a solution, but I have been unable to see it.</p>
<p>Is there a standard way of doing this?</p>
|
Mocking call to third-party module from Publisher
|
<p>SLAM Toolbox uses a <code>MessageFilter</code> that won't return laser scans to the callback unless an appropriate odometry transformation can be made. The issue you're running into is that you don't have "enough" setup to actually run the SLAM Toolbox stack, you need odometry.</p>
<p>You can fake this out for the purposes of a demo (probably?) by setting the <code>odom_frame</code> parameter to your lidar's base frame. It won't work-work - you can't move the lidar and build a map - but you should be able to see that something shows up then, until you attach to an actual robot base.</p>
|
107996
|
2024-02-01T17:50:53.793
|
|rviz|slam|lidar|
|
<p>I apologize for the discomfort. But I'm desperate with this LIDAR (LD19).</p>
<p>I am a beginner in ROS2. My entire life I have only used CoppeliaVREP.</p>
<p>I will detail the steps we followed and if you can help me, I would be grateful.</p>
<p>Basically I wanted to generate a map from the measurements of my LIDAR LD-19. As long as it is not connected to any type of robot. Lidar is static.</p>
<p>This is my Tf Tree
<a href="https://i.stack.imgur.com/iiNmh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iiNmh.png" alt="enter image description here" /></a></p>
<p>According to the documentation for this Lidar, I was able to take readings from its LaserScan on the Rviz.</p>
<p>Document
<a href="https://github.com/Myzhar/ldrobot-lidar-ros2" rel="nofollow noreferrer">https://github.com/Myzhar/ldrobot-lidar-ros2</a></p>
<p>According to some responses from some users, this lidar seems to be problematic compared to slam_toolbox, which waits for standard Lidar observations of the type Hokuyo, Velodyne, SICK, etc.
Then it is necessary to configure your TF tree, odom etc.</p>
<p>This way I got a standard yaml file template from the slam toolbox.</p>
<p><a href="https://github.com/SteveMacenski/slam_toolbox/tree/ros2/config" rel="nofollow noreferrer">https://github.com/SteveMacenski/slam_toolbox/tree/ros2/config</a></p>
<p>I used mapper_params_online_async.yaml</p>
<p>Later I created a ROS2 package, with this launch, to change this default yaml file and start SLAM_toolbox</p>
<pre><code>return LaunchDescription([
Node(
package='slam_toolbox',
executable='async_slam_toolbox_node',
name='slam_toolbox',
output='screen',
parameters=[{'use_sim_time': False}, config_path],
remappings=[('/scan', '/lidar_node/scan')],
# Adicione a seguinte linha para usar o quadro base como fonte de odometria
arguments=['--odom', 'ldlidar_base']
),
Node(
package='tf2_ros',
executable='static_transform_publisher',
name='static_transform_publisher',
output='screen',
arguments=['0', '0', '0', '0', '0', '0', 'ldlidar_base', 'ldlidar_link']
)`
</code></pre>
<p>I changed some Yaml parameters manually too</p>
<pre><code>odom_frame: odom
map_frame: map
base_frame: ldlidar_base
lidar_frame: ldlidar_link
scan_topic: /scan
use_map_saver: true
mode: mapping #localization
</code></pre>
<p>When running the launch file with the LD19 node active I had the following messages</p>
<pre><code> async_slam_toolbox_node-1] [INFO] [1706802034.671548971] [slam_toolbox]: Message Filter dropping message: frame 'ldlidar_link' at time 1706802034.471 for reason 'the timestamp on the message is earlier than all the data in the transform cache'
[async_slam_toolbox_node-1] [INFO] [1706802035.169091151] [slam_toolbox]: Message Filter dropping message: frame 'ldlidar_link' at time 1706802035.069 for reason 'discarding message because the queue is full'
[async_slam_toolbox_node-1] [INFO] [1706802035.369192791] [slam_toolbox]: Message Filter dropping message: frame 'ldlidar_link' at time 1706802035.169 for reason 'the timestamp on the message is earlier than all the data in the transform cache'
[async_slam_toolbox_node-1] [INFO] [1706802035.669001600] [slam_toolbox]: Message Filter dropping message: frame 'ldlidar_link' at time 1706802035.469 for reason 'the timestamp on the message is earlier than all the data in the transform cache'
</code></pre>
<p>What it seems to me is that the messages from my ldlidar_scan node are not up to the standard that slam_toolbox expects and it is discarding the messages. I'm already desperate because I really need this mapping.
As I said, the LaserScan on the Rviz is perfect, only the mapping is not working properly.</p>
<p>Can anybody help me?</p>
<p>If anyone knows of an easier way to generate a SLAM or real-time mapping, I'd welcome any suggestions.</p>
|
Lidar LD19 Hardware Configuration with slam_toolbox
|
<p>The way you pass the topic in your launch file is through the ROS 2 param approach.</p>
<p>But the <code>create</code> node expects to simply get it through a classical command-line argument, like you would write:</p>
<pre><code>ros2 run ros_gz_sim create -topic /robot_description
</code></pre>
<p>The equivalent in a launch file would be:</p>
<pre><code> spawn = Node(
package='ros_gz_sim',
executable='create',
arguments=['-topic', '/robot_description'], # <- this
output='screen',
</code></pre>
|
108000
|
2024-02-01T23:34:49.127
|
|gazebo|roslaunch|spawn-model|spawn|gz-sim|
|
<p>I am trying to launch a Gazebo simulator and spawn a model in the simulator form the <code>/robot_description</code> topic. This already worked sometimes but now I get the following error after calling the launch file:</p>
<pre><code>[create-2] [ERROR] [1706829850.265189123] [ros_gz_sim]: Must specify either -file, -param, -stdin or -topic
</code></pre>
<p>This is how I try to spawn my robot in my launch file:</p>
<pre><code> spawn = Node(
package='ros_gz_sim',
executable='create',
parameters=[{'topic': 'robot_description'}],
output='screen',
)
</code></pre>
<p>I am using Ros Humble and Gazebo Fortress on Ubuntu 22.04. What could be the problem? How could I try to debug this?</p>
|
How to spawn robot in Gazebo from robot_description topic?
|
<p>The mechanisms for controlling RMW implementation selection are handled in the <a href="https://github.com/ros2/rmw_implementation" rel="nofollow noreferrer"><code>rmw_implementation</code> package</a> .</p>
<p>At the time that you are building <code>rmw_implementation</code>, it checks the CMake variable <code>RMW_IMPLEMENTATION</code> to determine which will be the "default" for that build.</p>
<p>Since we are building with cmake, you can pass it as a flag to the cmake invocation <code>cmake .. -DRMW_IMPLEMENTATION=rmw_cyclonedds_cpp</code>. CMake flags can also be passed via <code>colcon</code> with: <code>--cmake-args</code> or <code>--ament-cmake-args</code>:</p>
<pre><code>colcon build --ament-cmake-args -DRMW_IMPLEMENTATION=rmw_cyclonedds_cpp
</code></pre>
|
108010
|
2024-02-02T13:00:21.333
|
|ros2|build-from-source|dds|
|
<p>I'm building ros2 humble from source, I would like to change the default DDS to <code>rmw_cyclonedds_cpp</code>, so with my self built version of ROS2, the user does not have to specify <code>RMW_IMPLEMENTATION</code> and use <code>rmw_cyclonedds_cpp</code> as default.</p>
<p>What source change do I need to or to set some environment variable during ROS2 source building?</p>
<p>I have read this, but did not find the answer for my need.</p>
<p><a href="https://docs.ros.org/en/humble/How-To-Guides/Working-with-multiple-RMW-implementations.html" rel="nofollow noreferrer">https://docs.ros.org/en/humble/How-To-Guides/Working-with-multiple-RMW-implementations.html</a></p>
|
How to change default DDS during ros2 source compiling?
|
<p>As you can see, no files from your package seem to be installed in the <code>install</code> folder.
This is because your <code>package.xml</code> specifies relying on <code>ament_cmake</code>, and thus only the <code>CMakeLists.txt</code> file is used to compile / install your package.</p>
<p>The two Python-related files, <code>setup.cfg</code> and <code>setup.py</code>, are never read by <code>colcon</code>, and could (should) be deleted without <code>colcon</code> complaining.</p>
<p>I would advise using CMake indeed, but then you have to add the install steps to <code>CMakeLists.txt</code>. A reason to use CMake even if you only install files is that it supports symbolic install while Python does not.</p>
<p>You can find in any CMake-based ROS 2 package, what the syntax is to install files or directories.</p>
|
108021
|
2024-02-02T20:07:38.167
|
|ros2|ros-humble|colcon|rospackage|launch|
|
<p>I am trying to get my ROS2 project into working order. Here are the details of my setup:<br />
Building in docker based on osrf/ros:humble-desktop-full<br />
my package is laid out like this</p>
<pre><code>├── CMakeLists.txt
├── LICENSE
├── launch
│ ├── __pycache__
│ │ └── brobot.launch.cpython-310.pyc
│ └── brobot.launch.py
├── package.xml
├── setup.cfg
├── setup.py
└── src
├── brobot_image_acquisition.py
├── config
│ └── camera_parameters.yaml
├── control_panel.py
├── joy_driver2.py
├── roboclaw_driver.py
├── spinPics
│ ├── leftCam
│ └── rightCam
└── utils
└── roboclaw_python
├── __pycache__
│ ├── roboclaw.cpython-310.pyc
│ └── roboclaw_3.cpython-310.pyc
├── read_motor_data.py
├── roboclaw.py
├── roboclaw.pyc
├── roboclaw_3.py
├── roboclaw_bareminimum.py
├── roboclaw_mixedpwm.py
├── roboclaw_mixedspeedaccel.py
├── roboclaw_position.py
├── roboclaw_read.py
├── roboclaw_readeeprom.py
├── roboclaw_readversion.py
├── roboclaw_simplepwm.py
├── roboclaw_speed.py
├── roboclaw_speedaccel.py
├── roboclaw_speedacceldistance.py
├── roboclaw_speeddistance.py
└── roboclaw_writeeeprom.py
10 directories, 31 files
</code></pre>
<p>To give a general description, this robot is supposed to be driven through a corn field and take pictures of the nodal roots just above the soil. Anyways
I took these steps:</p>
<ol>
<li>build a clean workspace</li>
</ol>
<pre><code>mkdir -p ros2_ws/src
cd ros2_ws && colcon build
</code></pre>
<ol start="2">
<li>copied in the brobot package</li>
</ol>
<p>Now the Workspace looks like this:</p>
<pre><code>.
├── build
│ └── COLCON_IGNORE
├── install
│ ├── COLCON_IGNORE
│ ├── _local_setup_util_ps1.py
│ ├── _local_setup_util_sh.py
│ ├── local_setup.bash
│ ├── local_setup.ps1
│ ├── local_setup.sh
│ ├── local_setup.zsh
│ ├── setup.bash
│ ├── setup.ps1
│ ├── setup.sh
│ └── setup.zsh
├── log
│ ├── COLCON_IGNORE
│ ├── build_2024-02-02_19-13-08
│ │ ├── events.log
│ │ └── logger_all.log
│ ├── latest -> latest_build
│ └── latest_build -> build_2024-02-02_19-13-08
└── src
└── brobot
├── CMakeLists.txt
├── LICENSE
├── launch
│ ├── __pycache__
│ │ └── brobot.launch.cpython-310.pyc
│ └── brobot.launch.py
├── package.xml
├── setup.cfg
├── setup.py
└── src
├── brobot_image_acquisition.py
├── config
│ └── camera_parameters.yaml
├── control_panel.py
├── joy_driver2.py
├── roboclaw_driver.py
├── spinPics
│ ├── leftCam
│ └── rightCam
└── utils
└── roboclaw_python
├── __pycache__
│ ├── roboclaw.cpython-310.pyc
│ └── roboclaw_3.cpython-310.pyc
├── read_motor_data.py
├── roboclaw.py
├── roboclaw.pyc
├── roboclaw_3.py
├── roboclaw_bareminimum.py
├── roboclaw_mixedpwm.py
├── roboclaw_mixedspeedaccel.py
├── roboclaw_position.py
├── roboclaw_read.py
├── roboclaw_readeeprom.py
├── roboclaw_readversion.py
├── roboclaw_simplepwm.py
├── roboclaw_speed.py
├── roboclaw_speedaccel.py
├── roboclaw_speedacceldistance.py
├── roboclaw_speeddistance.py
└── roboclaw_writeeeprom.py
18 directories, 46 files
</code></pre>
<ol start="3">
<li>now I build the workspace again</li>
</ol>
<pre><code>cd ros2_ws
source install/setup.sh
colcon build
source install/setup.sh
</code></pre>
<p>Package builds fine. but when I try to run <code>ros2 launch brobot brobot.launch.py</code> I get this error: <code>file 'brobot.launch.py' was not found in the share directory of package 'brobot' which is at '/source/ros2_ws/install/brobot/share/brobot'</code></p>
<p>I will include my full package.xml, setup.py, and setup.cfg at the bottom of this post so that you can view. I'm assuming I am making a mistake in my setup.py in the data_files entry:</p>
<pre class="lang-py prettyprint-override"><code>data_files=[
# Install marker file in the package index
('share/ament_index/resource_index/packages', ['resource/' + package_name]),
# Include our package.xml file
(os.path.join('share', package_name), ['package.xml']),
# Include all launch files.
('share/' + package_name, ['launch/brobot.launch.py']),
],
</code></pre>
<p>I have tried a number of ways to change it, including:</p>
<ol>
<li>writing out the absolute path of the launch files in my package and the destination ros seems to be looking in</li>
<li>the standard entry that is given in the tutorial <code>(os.path.join('share', package_name, 'launch'), glob(os.path.join('launch', '*.launch.py')))</code></li>
<li>This other entry that comes from the launch tutorials
<code>(os.path.join('share', package_name, 'launch'), glob(os.path.join('launch', '*launch.[pxy][yma]*')))</code></li>
</ol>
<p>Is there something I'm missing? How do I get the launch file from ros2_ws/src/brobot/ launch into the proper place?</p>
<p>Thanks in advance for any help! I'll be forced to use `ros2 launch until then.</p>
<h1>Code Files:</h1>
<p>setup.py</p>
<pre class="lang-py prettyprint-override"><code>import os
from glob import glob
from setuptools import setup
package_name = 'brobot'
setup(
name=package_name,
version='0.1.9',
# Packages to export
packages=[package_name],
# Files we want to install, specifically launch files
data_files=[
# Install marker file in the package index
('share/ament_index/resource_index/packages', ['resource/' + package_name]),
# Include our package.xml file
(os.path.join('share', package_name), ['package.xml']),
# Include all launch files.
('share/' + package_name, ['launch/brobot.launch.py']),
],
# This is important as well
install_requires=['setuptools'],
zip_safe=True,
author='kopiousKaro',
author_email='foobar@email.biz',
maintainer='KopiousKarp',
maintainer_email='foobar@email.biz',
keywords=['brace', 'root'],
classifiers=[
'Intended Audience :: Developers',
'License :: Apache 2.0',
'Programming Language :: Python',
'Topic :: Agricultural Robotics',
],
description='Brace root phenotyping robot',
license='Apache 2.0',
# Like the CMakeLists add_executable macro, you can add your python
# scripts here.
entry_points={
'console_scripts': [
'my_script = my_package.my_script:main'
],
},
)
</code></pre>
<p>setup.cfg</p>
<pre><code>[develop]
script_dir=$base/lib/brobot
[install]
install_scripts=$base/lib/brobot
</code></pre>
<p>package.xml</p>
<pre class="lang-xml prettyprint-override"><code><?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>brobot</name>
<version>0.1.9</version>
<description>Brace root phenotyping robot</description>
<maintainer email="foobar@email.biz">root</maintainer>
<license>Apache-2.0</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<depend>spinnaker_camera_driver</depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>
</code></pre>
<p>CMakeLists.txt</p>
<pre><code>cmake_minimum_required(VERSION 3.8)
project(brobot)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(spinnaker_camera_driver REQUIRED)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# comment the line when a copyright and license is added to all source files
set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# comment the line when this package is in a git repo and when
# a copyright and license is added to all source files
set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()
</code></pre>
|
ROS2 Launch file is not found
|
<p>The documentation examples are a very good starting point for beginners. Experimenting with the basics helps us understand the requirements to implement IK solving or other functionalities. We can build our own C++ ROS2/MoveIt2 classes to do such functionalities through inheritance or composition. The point you mentioned about having some of the objects requiring a shared pointer to a node passed at construction is the main challenge.</p>
<p><strong>I will share with you two working examples of solving Ik using a class as you want, which is a good practice when designing our code functionalities.</strong> The code examples below make a class <code>IKInterface</code> and implement a method <code>sampleSolveIK</code> for solving the IK problem. This method gets the arm's current pose and adds 5.0 cm to the <em>Z</em> coordinate to make a new pose. Then, it solves IK to check if this new pose is reachable.</p>
<p>(1) Using inheritance of <code>rclcpp::Node</code> class:</p>
<pre><code>#include <rclcpp/rclcpp.hpp>
#include <moveit/move_group_interface/move_group_interface.h>
#include <moveit/robot_model_loader/robot_model_loader.h>
#include <moveit/robot_state/robot_state.h>
#include <geometry_msgs/msg/pose.hpp>
class IKInterface : public rclcpp::Node
{
public:
IKInterface()
: Node("ik_interface_node"),
robot_model_loader_(std::make_shared<rclcpp::Node>(this->get_name()), "robot_description"),
robot_model_(robot_model_loader_.getModel()),
robot_state_(std::make_shared<moveit::core::RobotState>(robot_model_)),
planning_group_("panda_arm") // Change planning_group_ to match your robot
{
joint_model_group_ = robot_model_->getJointModelGroup(planning_group_);
}
void sampleSolveIK()
{
moveit::planning_interface::MoveGroupInterface move_group_interface(std::make_shared<rclcpp::Node>(this->get_name()), planning_group_);
// get current pose, increase its z coordinate by 5 cm and solve IK to see if the new pose is reachable
auto current_pose = move_group_interface.getCurrentPose();
geometry_msgs::msg::Pose target_pose;
target_pose.position.x = current_pose.pose.position.x;
target_pose.position.y = current_pose.pose.position.y;
target_pose.position.z = current_pose.pose.position.z + 0.05; // Fixed to directly modify the z coordinate
bool found_ik = robot_state_->setFromIK(joint_model_group_, target_pose);
if (found_ik)
{
RCLCPP_INFO(this->get_logger(), "IK solution found.");
}
else
{
RCLCPP_INFO(this->get_logger(), "IK solution not found.");
}
}
private:
robot_model_loader::RobotModelLoader robot_model_loader_;
moveit::core::RobotModelPtr robot_model_;
moveit::core::RobotStatePtr robot_state_;
std::string planning_group_;
const moveit::core::JointModelGroup* joint_model_group_;
};
int main(int argc, char** argv)
{
rclcpp::init(argc, argv);
auto ik_interface = std::make_shared<IKInterface>();
ik_interface->sampleSolveIK();
rclcpp::spin(ik_interface);
rclcpp::shutdown();
return 0;
}
</code></pre>
<p>(2) Using composition (our class has a shared ptr to <code>rclcpp::Node</code> as a member variable)</p>
<pre><code>#include <rclcpp/rclcpp.hpp>
#include <moveit/move_group_interface/move_group_interface.h>
#include <moveit/robot_model_loader/robot_model_loader.h>
#include <moveit/robot_state/robot_state.h>
#include <geometry_msgs/msg/pose.hpp>
class IKInterface
{
public:
explicit IKInterface(rclcpp::Node::SharedPtr node)
: node_(node),
robot_model_loader_(node, "robot_description"),
robot_model_(robot_model_loader_.getModel()),
robot_state_(std::make_shared<moveit::core::RobotState>(robot_model_)),
planning_group_("panda_arm") // Change planning_group_ to match your robot
{
joint_model_group_ = robot_model_->getJointModelGroup(planning_group_);
}
void sampleSolveIK()
{
moveit::planning_interface::MoveGroupInterface move_group_interface(node_, planning_group_);
// get current pose, increase its Z cordiate 5 cm and solve IK to see if the new pose is reachable
auto current_pose = move_group_interface.getCurrentPose();
geometry_msgs::msg::Pose target_pose;
target_pose.position.x = current_pose.pose.position.x;
target_pose.position.y = current_pose.pose.position.y;
target_pose.position.z += current_pose.pose.position.z + 0.05;
bool found_ik = robot_state_->setFromIK(joint_model_group_, target_pose);
if (found_ik)
{
RCLCPP_INFO(node_->get_logger(), "IK solution found.");
}
else
{
RCLCPP_INFO(node_->get_logger(), "IK solution not found.");
}
}
private:
rclcpp::Node::SharedPtr node_;
robot_model_loader::RobotModelLoader robot_model_loader_;
moveit::core::RobotModelPtr robot_model_;
moveit::core::RobotStatePtr robot_state_;
std::string planning_group_;
const moveit::core::JointModelGroup *joint_model_group_;
};
int main(int argc, char **argv)
{
rclcpp::init(argc, argv);
auto node = std::make_shared<rclcpp::Node>("ik_interface_node");
IKInterface ik_interface(node);
ik_interface.sampleSolveIK();
rclcpp::spin(node);
rclcpp::shutdown();
return 0;
}
</code></pre>
<p>I have tested both examples with the <code>panda_arm</code> used in MoveIt demos and they work well and give the same result. Please change the planning group name to your robot's planning group when using it. I hope this helps!</p>
|
108030
|
2024-02-03T08:13:08.850
|
|moveit|control|ros-humble|
|
<p>I am a ROS beginner trying to write an interface for a robot arm in c++ that uses moveit2 for inverse kinematics. What I want to do is have a node with a MoveGroupInterface handle that I can use to set pose goals for moveit whenever it receives a message from a subscribed topic. However, the moveit2 tutorials only explain how to use the MoveGroupInterface class within the main function of a program. A link to the tutorial I am referring to is below:
<a href="https://moveit.picknik.ai/humble/doc/examples/move_group_interface/move_group_interface_tutorial.html" rel="nofollow noreferrer">https://moveit.picknik.ai/humble/doc/examples/move_group_interface/move_group_interface_tutorial.html</a></p>
<p>The constructor for MoveGroupInterface requires a shared pointer to a node, and I don't know how I would create and spin a node within another node, or even that is good practice. The API for MoveGroupInterface is below: <a href="https://moveit.picknik.ai/humble/api/html/classmoveit_1_1planning__interface_1_1MoveGroupInterface.html#a1d1040090d7a0457384bacaef839237e" rel="nofollow noreferrer">https://moveit.picknik.ai/humble/api/html/classmoveit_1_1planning__interface_1_1MoveGroupInterface.html#a1d1040090d7a0457384bacaef839237e</a></p>
<p>I am just confused on the best way to send commands to moveit within an already created node. I have posted my current code, and would just like some help on how/where to implement MoveGroupInterface in it.</p>
<pre><code>class IKInterface : public rclcpp::Node{
public:
IKInterface() : Node("ik_interface"){
subscription_ = this->create_subscription<geometry_msgs::msg::Pose>(
"pose_goal", 10, std::bind(&IKInterface::topic_callback, this, _1));
}
private:
rclcpp::Subscription<geometry_msgs::msg::Pose>::SharedPtr subscription_;
void topic_callback(const geometry_msgs::msg::Pose &goal_pose) const{
RCLCPP_INFO(this->get_logger(), "x val: %.5f\ny val: %.5f\nz val: %.5f", goal_pose.position.x, goal_pose.position.y, goal_pose.position.z);
}
};
int main(int argc, char * argv[]){
rclcpp::init(argc, argv);
rclcpp::spin(std::make_shared<IKInterface>());
rclcpp::shutdown();
return 0;
}
</code></pre>
|
How to use MoveGroupInterface within a node?
|
<p>From a quick look, it seems that you missed the declaration of the variable <code>x</code> and <code>y</code> in your code. In C++ you need to declare every variable you want to use.</p>
<p>You may solve by adding the declaration right after <code>size_t count</code>:</p>
<pre><code>size_t count;
double x;
double y;
</code></pre>
|
108033
|
2024-02-03T14:45:11.613
|
|ros2|ubuntu|c++|publisher|subscribe|
|
<p>I try to use x and y in timer_callback function but I get ‘x’ was not declared in this scope I don't know how can I do this</p>
<pre><code>#include <chrono>
#include <functional>
#include <memory>
#include <string>
#include "rclcpp/rclcpp.hpp"
#include "geometry_msgs/msg/pose_stamped.hpp"
using std::placeholders::_1;
using namespace std::chrono_literals;
class MainA : public rclcpp::Node
{
public:
MainA(): Node("main"), count_(0)
{
gosub_ = this->create_subscription<geometry_msgs::msg::PoseStamped>(
"sol",10,std::bind(&MainA::sub_callback, this,_1));
publisher_ = this->create_publisher<geometry_msgs::msg::PoseStamped>(
"/checkpoint", 10);
timer_ = this->create_wall_timer(
500ms, std::bind(&MainA::timer_callback, this));
}
private:
void sub_callback(const geometry_msgs::msg::PoseStamped & msg) const
{
x = msg.pose.position.x;
y = msg.pose.position.y;
}
void timer_callback(){
auto message = geometry_msgs::msg::PoseStamped();
message.header.frame_id = "map";
message.header.stamp = this->now();
message.pose.position.x = x;
message.pose.position.y = y;
message.pose.position.z = 0.0;
publisher_->publish(message);
}
rclcpp::TimerBase::SharedPtr timer_;
rclcpp::Subscription<geometry_msgs::msg::PoseStamped>::SharedPtr gosub_;
rclcpp::Publisher<geometry_msgs::msg::PoseStamped>::SharedPtr publisher_;
size_t count_;
};
int main(int argc, char * argv[])
{
rclcpp::init(argc, argv);
rclcpp::spin(std::make_shared<MainA>());
rclcpp::shutdown();
return 0;
}
</code></pre>
|
Calling ROS2 subscriber callback function from another function
|
<p>Euler angles are easier and more intuitive as a human input and the singularity/gimbal lock issues aren't really a concern for static rigid transforms.</p>
<p>It would be an issue for a moving joint with a 3-degree-of-freedom rotation, like if you had a spherical ball joint or free-floating joint that was actuated. I don't think URDF supports spherical joints at all. It does support a floating 6DOF joint. If that were actuated and controlled then gimbal lock could be an issue, but resolution of that would be delegated to whatever library controls the joint and provides the interfaces to the user.</p>
<p>Libraries that do support actuated control of such joints do use quaternions or similar under the hood. See, for example:</p>
<p><a href="https://rbdl.github.io/df/dbe/joint_description.html#joint_singularities" rel="nofollow noreferrer">https://rbdl.github.io/df/dbe/joint_description.html#joint_singularities</a></p>
|
108048
|
2024-02-04T23:13:33.610
|
|ros|transform|urdf|
|
<p>To describe the rotation between tow links, why does URDF use Euler Angle instead of quaternion or axis-angle to describe the rotation? Since there might be singularity issue or gimbal lock in the Euler Angle rotation.</p>
|
Why does URDF use Euler angle to represent rotation?
|
<p>I still don't know the specifics of this problem, but after upgrading to Humble I seem to not have this issue anymore.
I'll mark this as answered.</p>
|
108064
|
2024-02-05T13:28:41.250
|
|ros2|ros2-launch|foxy|
|
<p>I'm launching multiple nodes of <em>unknown</em> count using a configuration file that I provide to the backend launcher. So far, I <em>appear</em> to have no issues accomplishing this.<br />
However, calling <code>ros2 node list</code> and <code>ros2 topic list</code> afterwards makes it seem one of my nodes to "vanish". The node still runs on my screen, and manages to publish its associated topics. Should I be worried?</p>
<hr />
<p>I'll post a screenshot, and the minimal working example constructed in Foxy using the <code>talker.py</code> example from the tutorials.<br />
Let's begin with the file tree, which is quite straightforward:</p>
<pre><code>└── dummy
├── config
│ └── talker.yml
├── dummy
│ ├── __init__.py
│ ├── __pycache__
│ └── talker.py
├── launch
│ ├── talker.launch.xml
│ ├── talker_mux.launch.py
│ └── talker_start.launch.xml
├── package.xml
├── resource
├── setup.cfg
├── setup.py
└── test
7 directories, 15 files
(I suppressed __pycache__, etc. folder contents)
</code></pre>
<p>Here, you can see 3 different launch files and a YAML file.<br />
One little modification I've made to <code>talker.py</code> is to print its namespace rather than "Hello World".<br />
<code>talker.yml</code>: just namespace and count</p>
<pre class="lang-yaml prettyprint-override"><code>ns: "dummy"
count: 6
</code></pre>
<p><code>talker.launch.xml</code>: simple xml launchfile for the node only</p>
<pre class="lang-xml prettyprint-override"><code><launch>
<node pkg="dummy" exec="talker" name="talker"/>
</launch>
</code></pre>
<p><code>talker_start.launch.xml</code>: calls the python backend launcher</p>
<pre class="lang-xml prettyprint-override"><code><launch>
<!-- Run the python launcher for multi-robot setups -->
<include file="$(find-pkg-share dummy)/launch/talker_mux.launch.py"/>
</launch>
</code></pre>
<p><code>talker_mux.launch.py</code>: Calls multiple <code>talker</code> nodes by assigning variable namespaces to launchfiles in a for-loop. Most involved part of this launch sequence.</p>
<pre class="lang-py prettyprint-override"><code>#!/usr/bin/env python3
import os
import yaml
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription, GroupAction
from launch_xml.launch_description_sources import XMLLaunchDescriptionSource
from launch_ros.actions import PushRosNamespace
def generate_launch_description():
launch_actions = []
pkg_name = 'dummy'
launch_file = 'talker.launch.xml'
# sniff parameters from YAML to get namespace and robot count (needs to be installed, modify setup.py or CMakeLists.txt accordingly)
# path: <workspace_path>/install/<pkg_name>/share/<pkg_name>/config/talker.yml
dir = get_package_share_directory(pkg_name) + '/config/talker.yml'
with open(dir, 'r') as file:
params = yaml.safe_load(file)
robot_ns = params['ns']
robot_count = params['count']
print(f"Initializing multi-robot launch...\nNamespace:{robot_ns}, #: {robot_count}")
# ref: <https://docs.ros.org/en/humble/How-To-Guides/Launch-file-different-formats.html>
for i in range(robot_count):
launch_actions.append(
GroupAction(
actions=[
PushRosNamespace(f'{robot_ns}{i}'),
IncludeLaunchDescription(
XMLLaunchDescriptionSource(
os.path.join(get_package_share_directory(pkg_name),f'launch/{launch_file}')
)
),
]
)
)
return LaunchDescription(launch_actions)
</code></pre>
<p>Here's what happens when you call <code>talker_start.launch.xml</code>. Somehow <code>/dummy2/talker</code> is missing, but it still publishes its own topic.
<a href="https://i.stack.imgur.com/A28UK.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A28UK.jpg" alt="Where did dummy2 go?" /></a></p>
|
Awkward shell outputs for launching many nodes using a configuration file
|
<p>I have found the solution. The problem was that I didn't installed ros2 properly. I figured out the solution by uninstall ros2 from the system when my launch file was working and reinstalling ros2 which started giving the same error.</p>
<p>After installing ros2 from the official site "https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html" a few additional modules need to be installed.</p>
<p>Steps to install ros2 properly:</p>
<ul>
<li>Step 1 --> Install ros2 using: <a href="https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html" rel="nofollow noreferrer">https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html</a></li>
<li>Step 2 --> sudo apt install ros-humble-xacro</li>
<li>Step 3 --> sudo apt install ros-humble-joint-state-publisher-gui</li>
<li>Step 4 --> sudo apt install ros-humble-gazebo-ros-pkgs</li>
<li>Step 5 --> sudo apt install ros-humble-ros2-control</li>
<li>Step 6 --> sudo apt install ros-humble-ros2-controllers</li>
<li>Step 7 --> sudo apt install ros-humble-gazebo-ros2-control</li>
<li>Step 8 --> sudo apt install ros-humble-controller-manager</li>
<li>Step 9 --> sudo apt install ros-humble-joint-trajectory-controller</li>
<li>Step 10 --> sudo apt install ros-humble-joint-state-broadcaster</li>
<li>Step 11 --> sudo apt install ros-humble-joint-state-publisher-gui</li>
</ul>
<p>Just replace "humble" with the distro of ros you have installed. For example for foxy, you could write "sudo apt install ros-foxy-xacro".</p>
<p>After installing ros2 from the official site, I ran my launch file and got error "No module named Xacro". To solve it I did "pip install xacro" which what I feel installed xacro for ros1. Due to this this, xacro which belong to ros1 was looking for roslaunch which wasn't present as I installed ros2. To correct it, I did "pip uninstall xacro", and installed xacro for my ros distro using "sudo apt install ros-humble-xacro".</p>
<p>I got this command from this youtube channel: "https://www.youtube.com/@ArticulatedRobotics". It didnt specifically mentions this issue but, tells which modules to install as it proceeds with the series of videos. It has great content anyone starting with robotics.</p>
<p>Hope it helps others.</p>
<p>Thanks.</p>
|
108074
|
2024-02-06T00:01:41.073
|
|ros2|roslaunch|ros-foxy|ros2-launch|launch|
|
<p>I am getting error <code>No module named roslaunch</code> when executing a ROS 2 launch file. I know this question is already asked <a href="https://answers.ros.org/question/210582/importerror-no-module-named-roslaunch/" rel="nofollow noreferrer">here</a> but it dose not seems to solve my problem as it is for ROS 1. I know that <code>roslaunch</code> is for ROS 1 so getting error "No module named roslaunch" for ROS 2 seems unnecessary.</p>
<p>I executed this same package on one PC and it is woking fine, but because my application requires GPU, I shifted to another PC and copy pasted the package rebuilding it with <code>colcon build --symlink-install</code> and now I am getting this error.</p>
<p>Another <a href="https://answers.ros.org/question/11780/roslaunch-traceback-most-recent-call-last/" rel="nofollow noreferrer">Post</a> mentions that the issue is related to environment variable being set to a wrong path but in my case <code>$ROS_PACKAGE_PATH</code> dose not prints out anything means its empty.</p>
<p>Also I did not understand to which path is is pointing to because ros 2 does not has any folder named "ros_stacks" as mentioned in <code>export ROS_PACKAGE_PATH=/home/maneesh/ros_stacks:$ROS_PACKAGE_PATH</code></p>
<p>Actually the error "no module name roslaunch" is arising at 29th line of the launch file "robot_description_config = xacro.process_file(xacro_file)" and when I replace the line with " robot_description_config = Command(['xacro ', xacro_file])" the error changes to "no module named rosgraph" . "rosgraph" is also a ros1 package.</p>
<p>Launch File:</p>
<pre><code>import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.substitutions import LaunchConfiguration
from launch.actions import DeclareLaunchArgument
from launch_ros.actions import Node
import launch_ros
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
import xacro
def generate_launch_description():
# Check if we're told to use sim time
use_sim_time = LaunchConfiguration('use_sim_time')
# Process the URDF file
pkg_path = os.path.join(get_package_share_directory('race_it'))
#xacro_file = os.path.join(pkg_path,'description','robot.urdf.xacro')
xacro_file = os.path.join(pkg_path,'description', 'race_car.xacro')
robot_description_config = xacro.process_file(xacro_file)
default_rviz_config_path = os.path.join(pkg_path, 'config/rviz/urdf_config.rviz')
# Create a robot_state_publisher node
params = {'robot_description': robot_description_config.toxml(), 'use_sim_time': use_sim_time}
node_robot_state_publisher = Node(
package='robot_state_publisher',
executable='robot_state_publisher',
output='screen',
parameters=[params]
)
joint_state_publisher_node = launch_ros.actions.Node(
package='joint_state_publisher',
executable='joint_state_publisher',
name='joint_state_publisher'
)
rviz_node = launch_ros.actions.Node(
package='rviz2',
executable='rviz2',
name='rviz2',
output='screen',
arguments=['-d', default_rviz_config_path],
)
gazebo = IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
get_package_share_directory('gazebo_ros'), 'launch', 'gazebo.launch.py')]),
launch_arguments={'world': "./src/race_it/worlds/track_4.world"}.items()
)
spawn_entity = launch_ros.actions.Node(
package='gazebo_ros',
executable='spawn_entity.py',
arguments=['-entity', '', '-topic', 'robot_description'],
output='screen'
)
ackermann_spawner = Node(
package="controller_manager",
executable="spawner",
arguments=["asc"],
)
# Launch!
return LaunchDescription([
DeclareLaunchArgument(
'use_sim_time',
default_value='true',
description='Use sim time if true'),
node_robot_state_publisher,
joint_state_publisher_node,
rviz_node,
gazebo,
spawn_entity,
ackermann_spawner
])
</code></pre>
|
"No module named roslaunch" for ROS 2
|
<p>It seems you are trying to install ros-noetic (ROS 1) to Ubuntu-22 (jammy) Which is not supported. Try installing ros-humble (ROS 2) instead.
<a href="https://docs.ros.org/en/humble/Installation.html" rel="nofollow noreferrer">https://docs.ros.org/en/humble/Installation.html</a></p>
|
108080
|
2024-02-06T09:07:00.433
|
|ros|ros-noetic|
|
<p>I get the same error every time I follow the steps to install Ros. Even though I tried different codes and gpt's solutions, none of them worked. I even deleted Ubuntu and reinstalled it. I would be happy if you help.
<code>~$ sudo apt update</code></p>
<pre><code>Same:
1 http://tr.archive.ubuntu.com/ubuntu jammy InRelease
Download:
2 http://tr.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB] Same:
3 http://tr.archive.ubuntu.com/ubuntu jammy-backports InRelease
Download:
4 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Ignore:
5 http://packages.ros.org/ros/ubuntu jammy InRelease
Download:
6 http://tr.archive.ubuntu.com/ubuntu jammy-updates/main i386 Packages [560 kB]
Error:
7 http://packages.ros.org/ros/ubuntu jammy Release 404 Not Found [IP:]
Download:
8 http://tr.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1.326 kB] Reading packing lists... Done
E: There is no Release file in the repository 'http://packages.ros.org/ros/ubuntu jammy Release'.
N: Updates cannot be made securely from such a repository, so the repository has been disabled.
N: Detailed information on repository creation and user configuration can be found in the apt-secure(8) man page.
</code></pre>
|
I'm getting an error when trying to install ROS
|
<p>Yes. The inscribed radius is used to create the <code>253</code> inscribed radius section which is known to be in collision if the center point is within it. When you change footprints, no matter how that footprint is shaped or defined, the <code>253</code> space will always auto-populate for the inscribed radius of the robot for collision checking.</p>
<p>The actual inflation after that point is unaffected. However, if your inflation radius / gain is set such that no inflation happens after the inscribed radius of the robot, then you won't see any potential field being formed.</p>
|
108086
|
2024-02-06T10:21:30.737
|
|nav2|collision|footprint|
|
<p>Does the inflation layer calculate Inflation cost in global costmap differently within the inflation radius when initialized with a polygonal footprint versus a circular footprint?</p>
<p>Exclude the local costmap and footprint size.</p>
<p><a href="https://i.stack.imgur.com/rFyJb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rFyJb.png" alt="enter image description here" /></a></p>
|
Inflation layer costs: Polygonal vs. Circular Footprints
|
<p>Any <a href="https://en.wikipedia.org/wiki/Euler_angles" rel="nofollow noreferrer">euler angles triplet</a> can be used to represent the orientation of a rigid body (and so of the link a robot). I cannot answer for the particular robots you mentioned, but usually one choose a representation for ease of visualization or to simplify some computation (e.g. if a link rotate around a revolute joint, it simplify the equation of motion to have one the rotation axis aligned with the joint axis).</p>
|
108093
|
2024-02-06T13:45:14.297
|
|kinematics|robot|rotation|abb|fanuc|
|
<p>I know Fanuc robots use the XYZ rotation order, ABB uses ZYX and some robots use the ZYZ rotation order. What actually determines this order? is it the way the frames are setup on the DH table? Or is it just the order they chose to solve the IK, and any order could be used? Can anyone help me understand this? TY.</p>
|
What determines a robots euler rotation order?
|
<p>Soooo, apparantly the reason for the errors was simply because I had an action in the folder <code>actions</code>, and it appears that ROS2 does not like that. They want actions to be in a folder specifically called <code>action</code>. Moving <code>Location.action</code> to the folder <code>action</code> and changing <code>CMakeLists.txt</code> as needed made building pass. I did not even need to add the dependencies <code>services_msgs</code>, <code>builtin_interfaces</code>, etc.</p>
|
108106
|
2024-02-06T22:59:22.647
|
|ros|message|action|
|
<p>I am pretty new to ROS, so please do not expect much from me.</p>
<p>I am building a robotic system for my project, and as of right now I am setting up interfaces to use in the project. I added a message file (.msg) and it worked fine, but when I go to add an action file (.action), it starts giving me a KeyError. After looking at the error message, I thought the package it referenced was not installed (it was showing up first with 'service_msgs'), so I went ahead and added the line <code><depend>service_msgs</depend></code> to my <code>packages.xml</code> file, and I also added <code>find_packages(service_msgs REQUIRED)</code> and added that package next to <code>DEPENDENCIES</code> in <code>CMakeLists.txt</code>. After that, I went to compile it and I got the same error message but with <code>unique_interfaces_msgs</code>. I do the same thing with that package, and after compiling I get the previous message: <code>KeyError: 'services_msgs'</code>. I try compiling again and I get <code>KeyError: 'unique_identifier_msgs'</code>. It seems to switch between both messages, but I cannot tell what the actual problem is. I got the same error message but instead saying <code>action_msgs</code> or <code>builtin_interfaces</code>. I am very confused now and I do not know what to do. My code right now is below:</p>
<p>CMakeLists.txt:</p>
<pre><code>cmake_minimum_required(VERSION 3.8)
project(interfaces)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
find_package(geometry_msgs REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(service_msgs REQUIRED)
find_package(builtin_interfaces REQUIRED)
find_package(unique_identifier_msgs REQUIRED)
rosidl_generate_interfaces(${PROJECT_NAME}
"msg/Location.msg"
"actions/SendBotToLoc.action"
DEPENDENCIES geometry_msgs
)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# comment the line when a copyright and license is added to all source files
set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# comment the line when this package is in a git repo and when
# a copyright and license is added to all source files
set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()
</code></pre>
<p>package.xml:</p>
<pre><code><?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>interfaces</name>
<version>0.0.1</version>
<description>This package stores all interfaces for use with actions, topics, and services</description>
<maintainer email="vxw397@student.bham.ac.uk">Vivan Waghela</maintainer>
<license>Apache-2.0</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<depend>geometry_msgs</depend>
<buildtool_depend>rosidl_default_generators</buildtool_depend>
<exec_depend>rosidl_default_runtime</exec_depend>
<member_of_group>rosidl_interface_packages</member_of_group>
<depend>service_msgs</depend>
<depend>unique_identifier_msgs</depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>
</code></pre>
<p>Location.msg (inside msg folder):</p>
<pre><code>geometry_msgs/Point location
</code></pre>
<p>SendBotToLoc.action (inside actions folder)</p>
<pre><code>uint8 MAIN_BOT=0
uint8 bot
geometry_msgs/Point final_point
---
uint8 exit_code
---
</code></pre>
<p>I have also tried adding the 'std_msgs' dependency by adding the line <code>find_package(std_msgs REQUIRED)</code>to CMakeLists.txt and <code><depend>std_msgs</depend></code> in packages.xml, but that did not change the error message at all.</p>
<p>All help will be greatly appreciated. Thanks.</p>
<p><strong>Edit:</strong> I realised that I forgot to show the full error, so I am adding that here:</p>
<pre><code>Starting >>> interfaces
--- stderr: interfaces
Traceback (most recent call last):
File "/opt/ros/iron/lib/rosidl_generator_type_description/rosidl_generator_type_description", line 50, in <module>
sys.exit(main())
File "/opt/ros/iron/lib/rosidl_generator_type_description/rosidl_generator_type_description", line 46, in main
generate_type_hash(args.generator_arguments_file)
File "/opt/ros/iron/lib/python3.10/site-packages/rosidl_generator_type_description/__init__.py", line 160, in generate_type_hash
pkg_dir = include_map[pkg]
KeyError: 'builtin_interfaces'
gmake[2]: *** [CMakeFiles/interfaces__rosidl_generator_type_description.dir/build.make:77: rosidl_generator_type_description/interfaces/msg/Location.json] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:215: CMakeFiles/interfaces__rosidl_generator_type_description.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake: *** [Makefile:146: all] Error 2
---
Failed <<< interfaces [0.34s, exited with code 2]
Summary: 0 packages finished [0.72s]
1 package failed: interfaces
1 package had stderr output: interfaces
</code></pre>
<p>The error message above shows up with other package names in place of 'builtin_interfaces'.</p>
|
KeyError:'unique_identifier_msgs' and KeyError:'service_msgs' when compiling interface package
|
<p>Thank you, Steve, for your guidance and the comprehensive documentation provided for the Navigation2 stack. I've thoroughly reviewed the materials, particularly the sections detailing the <a href="https://navigation.ros.org/configuration/packages/configuring-regulated-pp.html?highlight=pure%20pursuit" rel="nofollow noreferrer">Regulated Pure Pursuit</a> and <a href="https://navigation.ros.org/configuration/packages/configuring-mppic.html?highlight=mppi" rel="nofollow noreferrer">MPPI</a> controllers, which offer invaluable insights into configuring and understanding these components!</p>
<p>Despite the wealth of information available, I noticed an opportunity for enhancing the documentation, especially <strong>regarding the visual debugging of local planners</strong>. It appears that the documentation does not explicitly state that the planners' visual outputs are not published to the /local_plan topic. Instead, these are available through the <strong>/trajectories</strong> and <strong>/transformed_global_plan</strong> topics (figured out by reading the controller source code Steve provided above). Clarifying this in the documentation could greatly aid users in effectively debugging and visualizing planner behaviors.</p>
<p><a href="https://i.stack.imgur.com/Wb2XY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Wb2XY.png" alt="Controller (local Planner) In BLUE Lines" /></a></p>
<p>Additionally, while seeking further information on <strong>integrating external controllers like TEB, I encountered a broken link</strong>: <a href="https://navigation.ros.org/tutorials/docs/writing_new_nav2planner_plugin.html" rel="nofollow noreferrer">Writing a new Navigation2 Controller Plugin</a>.</p>
<p><a href="https://i.stack.imgur.com/qrEdR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qrEdR.png" alt="error 404" /></a></p>
<p>It is inaccessible, could the maintainers please take a look?</p>
<p>As I said in the comment above <strong>I was able to compile TEB + costmap_converter</strong> package dependency pkg into my workspace. However, some additional steps might be taken to integrate with na2_core::Controller, which I have still not figured out.</p>
|
108108
|
2024-02-07T02:25:48.313
|
|control|motion-planning|nav2|base-local-planner|teb-local-planner|
|
<p>I'm working on a project with ROS 2 Iron and the Navigation2 stack, focusing on an Ackermann-steered robot. I've encountered issues while trying to <strong>integrate alternative local planners, such as TEB, Regulated Pure Pursuit, and MPPI</strong>, instead of the default DWB controller.</p>
<p>With DWB, the system works as expected, and I can confirm its activation using:</p>
<pre><code>ros2 param get /controller_server FollowPath.trajectory_generator_name
</code></pre>
<p>This command returns String value is: <strong>dwb_plugins::StandardTrajectoryGenerator</strong>, indicating that DWB is active.</p>
<p>However, when I attempt to switch to other local planners, I face various issues:</p>
<ol>
<li><p>TEB Local Planner:</p>
<p>FollowPath:</p>
<p>plugin: "teb_local_planner::TebLocalPlannerROS"</p>
<p>min_turning_radius: 1.0</p>
<p>max_vel_x: 1.5</p>
<p>max_vel_theta: 0.7</p>
</li>
</ol>
<p>When trying to use TEB, it's clear that it's not supported in ROS 2 Iron as the system logs a fatal error stating <strong>TEB does not exist as a nav2_core::Controller type</strong>. This is confirmed by the error message:</p>
<pre><code>[controller_server-10] [FATAL] [timestamp] [controller_server]: Failed to create controller. Exception: According to the loaded plugin descriptions the class teb_local_planner::TebLocalPlannerROS with base class type nav2_core::Controller does not exist. Declared types are dwb_core::DWBLocalPlanner nav2_mppi_controller::MPPIController nav2_regulated_pure_pursuit_controller::RegulatedPurePursuitController nav2_rotation_shim_controller::RotationShimController
</code></pre>
<ol start="2">
<li><strong>Regulated Pure Pursuit and MPPI:</strong> While these controllers appear to
be loaded without fatal errors, and the terminal logs indicate their
creation, there's <strong>no visible local plan</strong> being generated or followed
(the <strong>/local_plan topic remains empty in RViz2</strong>), and the robot does
not act on any commands. For each alternative planner, I've adjusted
the controller_server configuration in my parameter file
accordingly, for example,</li>
</ol>
<p>A) For Regulated Pure Pursuit:</p>
<pre><code>FollowPath:
plugin: "nav2_regulated_pure_pursuit_controller::RegulatedPurePursuitController"
desired_linear_vel: 1.5 # Set to your robot's desired speed
look_ahead_distance: 2.0 # Set according to your robot size and speed
max_linear_accel: 1.0 # Set based on your robot's acceleration capabilities
max_linear_decel: 1.0 # Set based on your robot's deceleration capabilities
allow_reversing: false # Set to true if your robot can reverse, false otherwise
</code></pre>
<p>B) For MPPI:</p>
<pre><code>FollowPath:
plugin: "nav2_mppi_controller::MPPIController"
# MPPI specific parameters
sample_count: 250 # Number of control samples per iteration
look_ahead_time: 1.0 # Prediction horizon in seconds
control_duration: 0.1 # Duration each control input is held constant
acceleration_limits: [1.0, 0.0, 1.0] # Limits for linear x, linear y, and angular z acceleration
max_velocity: [0.5, 0.0, 0.5] # Maximum velocity limits for linear x, linear y, and angular z
</code></pre>
<p>The output of command:</p>
<pre><code>ros2 param get /controller_server FollowPath.trajectory_generator_name
</code></pre>
<p>The output of command in this case is:<br />
<strong>is Parameter not set</strong></p>
<p>Either for MPPI or Regulated Pure Pursuit controllers (However the output of the terminal launch file states that they were loaded!):</p>
<p>A) For MPPI</p>
<pre><code>[lifecycle_manager-17] [INFO] [1707272624.080108797] [lifecycle_manager_navigation]: Configuring controller_server
[controller_server-10] [INFO] [1707272624.080873689] [controller_server]: Configuring controller interface
[controller_server-10] [INFO] [1707272624.080913233] [controller_server]: getting progress checker plugins..
[controller_server-10] [INFO] [1707272624.081238921] [controller_server]: getting goal checker plugins..
[controller_server-10] [INFO] [1707272624.081332605] [controller_server]: Controller frequency set to 20.0000Hz
[controller_server-10] [INFO] [1707272624.081373358] [local_costmap.local_costmap]: Configuring
[controller_server-10] [INFO] [1707272624.099684622] [local_costmap.local_costmap]: Using plugin "voxel_layer"
[controller_server-10] [INFO] [1707272624.111637076] [local_costmap.local_costmap]: Subscribed to Topics: left_scan right_scan
[rviz2-3] [INFO] [1707272624.133096370] [rviz2]: Stereo is NOT SUPPORTED
[rviz2-3] [INFO] [1707272624.133202145] [rviz2]: OpenGl version: 4.6 (GLSL 4.6)
[controller_server-10] [INFO] [1707272624.144946643] [local_costmap.local_costmap]: Initialized plugin "voxel_layer"
[controller_server-10] [INFO] [1707272624.145000833] [local_costmap.local_costmap]: Using plugin "inflation_layer"
[controller_server-10] [INFO] [1707272624.151004580] [local_costmap.local_costmap]: Initialized plugin "inflation_layer"
[rviz2-3] [INFO] [1707272624.177433914] [rviz2]: Stereo is NOT SUPPORTED
[controller_server-10] [INFO] [1707272624.183176686] [controller_server]: Created progress_checker : progress_checker of type nav2_controller::SimpleProgressChecker
[controller_server-10] [INFO] [1707272624.183778839] [controller_server]: Controller Server has progress_checker progress checkers available.
[controller_server-10] [INFO] [1707272624.184718144] [controller_server]: Created goal checker : general_goal_checker of type nav2_controller::SimpleGoalChecker
[controller_server-10] [INFO] [1707272624.185272323] [controller_server]: Controller Server has general_goal_checker goal checkers available.
[controller_server-10] [INFO] [1707272624.187892942] [controller_server]: Created controller : FollowPath of type nav2_mppi_controller::MPPIController
[controller_server-10] [INFO] [1707272624.190109571] [controller_server]: Controller period is equal to model dt. Control sequence shifting is ON
[controller_server-10] [INFO] [1707272624.196427682] [controller_server]: Optimizer reset
[controller_server-10] [INFO] [1707272624.202554850] [MPPIController]: Configured MPPI Controller: FollowPath
[controller_server-10] [INFO] [1707272624.202599342] [controller_server]: Controller Server has FollowPath controllers available.
</code></pre>
<p>B) For RegulatedPurePursuit:</p>
<pre><code>controller_server-10] [INFO] [1707269428.308463049] [controller_server]: Created controller : FollowPath of type nav2_regulated_pure_pursuit_controller::RegulatedPurePursuitController
</code></pre>
<p>Despite these configurations, there seems to be no active local plan being generated or visualized in RViz2.</p>
<p><strong>My questions are:</strong></p>
<ol>
<li><p>Given TEB's apparent lack of support in ROS 2 Iron, are there any
known workarounds or alternatives for using TEB** with
Ackermann-steered robots in this ROS version? From this post <a href="https://robotics.stackexchange.com/questions/104822/why-teb-controller-is-not-available-in-ros2-humble">Answer TEB discontinuation for ROS2 </a> I am not very hopeful!</p>
</li>
<li><p><strong>For Regulated Pure Pursuit and MPPI</strong>, what could be <strong>the reason for
the absence of visible/local planning</strong> despite the controllers being
loaded? Are there <strong>specific steps or configurations</strong> I might be
<strong>missing</strong> to enable these planners effectively?</p>
</li>
</ol>
<p>Any insights or guidance on integrating these local planners with the Nav2 stack would be greatly appreciated.</p>
|
Integrating Alternative Local Planners (Controller) with ROS 2 Navigation2 Stack for an Ackermann Robot
|
<p>So I came up with a solution:</p>
<p>Firtsly I connected to the robot filesystem using FTP</p>
<p>Secondly I uploaded the arm.cfx from CD to the usr/configuration folder</p>
<p>In the arm.cfx there were no information about the order number and arm type</p>
<p>Finally after a restart of the CS8 controller the Drive errors dissapeared and the hand symbol lighted up on the teach pendant accordingly to the WMS box selected mode.</p>
<p>I'll test if it is possible to move the arm and after that I'll close the thread.
Thanks for help.</p>
<p>The old arm.cfx file header:</p>
<pre><code><?xml version="1.0" encoding="utf-8" ?>
<arm>
<String name="date" value="20 AUG 2006 20:21" />
<String name="orderNumber" value="" />
<String name="arm" value="" />
<String name="tuning" value="" />|
<String name="mount" value="floor" />
</code></pre>
|
108113
|
2024-02-07T07:59:51.757
|
|robotic-arm|industrial-robot|
|
<p>we are having a problem with setting up Stäubli CS8 controller with RX60B-L arm,</p>
<p>our company bought the arm and controller several years ago, and only now we have an actual use for it and we are trying to set it up.</p>
<p>There was a few problems that I had dealt with,</p>
<p>firstly a discharged battery, which was no problem to replace, secondly the connector at the working mode selector was damaged also an easy fix.</p>
<p>But I am not able to power-up the arm. When I try to power up the arm, the controller refuses: Arm power enable request refused: cabinet working mode is remote or invalid. Also the working mode status LEDs on the teach pendant do not light up at all, according to manual and online videos the working mode status LEDs are supposed to light up accroding to the mode selected on the working mode selector box.</p>
<p>Also after a start up there's an error message: Internal error on fieldbus Board=1 Equipment=0 Channel=0 Status=33</p>
<p>Another errors:
Internal error DRIVE NoDriveConfiguration 1
Internal error DRIVE NoDriveConfiguration 2
Internal error DRIVE NoDriveConfiguration 3
Internal error DRIVE NoDriveConfiguration 4
Internal error DRIVE NoDriveConfiguration 5
Internal error DRIVE NoDriveConfiguration 6</p>
<p>Which i guess collerate to the axis drivers, Is it possible to restore the configurations or something?</p>
<p>I already restored the positions in the callibration menu, but that didn't fix the problem.</p>
<p>How do I fix this problem ? Can there still be problem in the wms box ?</p>
<p>Best regards
<a href="https://i.stack.imgur.com/GpX0U.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GpX0U.jpg" alt="Error log after startup" /></a></p>
<p><a href="https://i.stack.imgur.com/s6T7y.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s6T7y.jpg" alt="Error log" /></a></p>
<p><a href="https://i.stack.imgur.com/mXYYB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mXYYB.jpg" alt="Pendant and WMS control box" /></a></p>
|
Problem with arming power - Stäubli CS8 with RX60B - L
|
<p>No, the hidden topic is the only way to see the action goal as a topic. But also, you shouldn't be looking at that. Its hidden for a reason so that you use the action client / server interfaces.</p>
<p>If you're just introspecting for debugging, then that's no problem to look at that topic once and again, but I just wouldn't rely on it as part of your application.</p>
|
108120
|
2024-02-07T13:12:28.247
|
|ros2|rviz|moveit|microcontroller|
|
<p>I learned to generate trajectories while working with ros2_controller.</p>
<p>I want to take a closer look, find the goal in <code>/execute_trajectory/_action/</code></p>
<p>I can only check the message type below.</p>
<p><code>ros2 interface show moveit_msgs/action/ExecuteTrajectory </code></p>
<p>I was able to understand the structure, but I don't know how it is used as an example.</p>
<p>I don't want anything custom. However, i want to use the existing message.</p>
<p>Because I need to know other messages, I wonder if the following is possible.</p>
<p>Is there a way to output /_action/goal as a topic?</p>
<p>Thank</p>
|
how to get information about goal of action
|
<p>File <code>analyzer_gui.cpp</code> is not compiled. Try adding it into <code>add_executable(...)</code></p>
<p>catkin libraries are missing from link stage, also try:</p>
<pre><code>target_link_libraries(<span class="math-container">${PROJECT_NAME}_node
PRIVATE
Qt6::Widgets
$</span>{catkin_LIBRARIES}
)
</code></pre>
|
108125
|
2024-02-07T17:14:34.053
|
|ros|qt|gui|
|
<p>I'm trying to make a ROS GUI with QTCreator 6. For some reason I'm always getting some include problems either with QT-Libraries, own header files or ROS. I'm using the ros_qtc_plugin.</p>
<p>Project architecture:</p>
<pre><code>catkin_ws
-anayzer_gui
--include
---analyzer_gui
----analyzer_gui.h
----analyzergui.ui
--nodes
---analyzer_gui_node.cpp
--src
---analyzer_gui.cpp
-CMakeLists.txt
-package.xml
</code></pre>
<pre><code>CMakeLists.txt:
cmake_minimum_required(VERSION 3.0.2)
project(analyzer_gui)
## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++11)
find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
)
find_package(pluginlib REQUIRED)
find_package(Qt6 REQUIRED COMPONENTS Widgets)
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS roscpp std_msgs
)
include_directories(
<span class="math-container">${CMAKE_CURRENT_SOURCE_DIR}/include/analyzer_gui
$</span>{CMAKE_CURRENT_SOURCE_DIR}/nodes
${catkin_INCLUDE_DIRS}
)
add_executable(<span class="math-container">${PROJECT_NAME}_node nodes/analyzer_gui_node.cpp)
target_link_libraries($</span>{PROJECT_NAME}_node PRIVATE Qt6::Widgets)
add_dependencies(<span class="math-container">${PROJECT_NAME}_node $</span>{<span class="math-container">${PROJECT_NAME}_EXPORTED_TARGETS} $</span>{catkin_EXPORTED_TARGETS})`
</code></pre>
<pre><code>package.xml:
<?xml version="1.0"?>
<package format="2">
<name>analyzer_gui</name>
<version>0.0.0</version>
<description>The analyzer_gui package</description
<buildtool_depend>catkin</buildtool_depend>
<build_depend>pkg-config</build_depend>
<build_depend>qt6-qmake</build_depend>
<build_depend>qtbase6-dev</build_depend>
<build_depend>roscpp</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>qt_build</build_depend>
<build_depend>libqt6</build_depend>
<build_export_depend>roscpp</build_export_depend>
<build_export_depend>std_msgs</build_export_depend>
<exec_depend>roscpp</exec_depend>
<exec_depend>std_msgs</exec_depend>
<exec_depend>qt_build</exec_depend>
<exec_depend>libqt6</exec_depend>
<exec_depend>roscpp</exec_depend>
<!-- The export tag contains other, unspecified, tags -->
<export>
<!-- Other tools can request additional information be placed here -->
</export>
</package>
</code></pre>
<pre><code>analyzer_gui.h:
#ifndef ANALYZER_GUI_H
#define ANALYZER_GUI_H
#include <QWidget>
#include <ros/ros.h>
namespace Ui {
class AnalyzerGui;
}
class AnalyzerGui : public QWidget
{
Q_OBJECT
public:
explicit AnalyzerGui(QWidget *parent = nullptr);
~AnalyzerGui();
private:
Ui::AnalyzerGui *ui;
};
#endif // ANALYZER_GUI_H
</code></pre>
<pre><code>analyzer_gui_node.cpp:
#include <QApplication>
#include "analyzer_gui/analyzer_gui.h"
int main(int argc, char *argv[]){
ros::init(argc, argv, "analyzer_gui_node");
QApplication a(argc, argv);
AnalyzerGui w;
w.setWindowTitle(QString::fromStdString(ros::this_node::getName()));
w.show();
return a.exec();
}
</code></pre>
<pre><code>analyzer_gui.cpp:
#include "analyzer_gui.h"
#include "ui_analyzergui.h"
AnalyzerGui::AnalyzerGui(QWidget *parent)
: QWidget(parent)
, ui(new Ui::AnalyzerGui)
{
ui->setupUi(this);
}
AnalyzerGui::~AnalyzerGui()
{
delete ui;
}`
</code></pre>
<p>Error messages:</p>
<pre><code>:-1: error: CMakeFiles/analyzer_gui_node.dir/nodes/analyzer_gui_node.cpp.o: in function `main':
/home/bryan/catkin_ws/src/analyzer_gui/nodes/analyzer_gui_node.cpp:5: error: undefined reference to `ros::init(int&, char**, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)'
:-1: error: /home/bryan/catkin_ws/src/analyzer_gui/nodes/analyzer_gui_node.cpp:8: undefined reference to `AnalyzerGui::AnalyzerGui(QWidget*)'
:-1: error: /home/bryan/catkin_ws/src/analyzer_gui/nodes/analyzer_gui_node.cpp:9: undefined reference to `ros::this_node::getName[abi:cxx11]()'
:-1: error: /home/bryan/catkin_ws/src/analyzer_gui/nodes/can_analyzer_gui_node.cpp:8: undefined reference to `AnalyzerGui::~AnalyzerGui()'
:-1: error: /home/bryan/catkin_ws/src/analyzer_gui/nodes/analyzer_gui_node.cpp:8: undefined reference to `AnalyzerGui::~AnalyzerGui()'
:-1: error: collect2: error: ld returned 1 exit status
:-1: error: [analyzer_gui/CMakeFiles/analyzer_gui_node.dir/build.make:89: /home/bryan/catkin_ws/devel/lib/analyzer_gui/analyzer_gui_node] Error 1
</code></pre>
<p>Thank you!</p>
<p>The CMakeLists and package look pretty messy since I'm a beginner and tried a lot of stuff that didn't work.
In Qt the content of the header files is recognized (class names are highlighted) but while building they are not found.</p>
|
Making a ROS GUI QT6 and C++ in Ubuntu 20.04
|
<p>The cancel message basically has two fields. You can cancel based on time or you can cancel based on ID. If either field is set to non zero that policy will be triggered.</p>
<p>The documentation calls out the 4 different permutations. It is less likely to want to use that fourth permutation. But it's simpler to not remove that case in the implementation. And in the case it may be useful to someone, it's available.</p>
<p>I'll note that the id and timestamp are independent so there is a little bit more flexibility than you could take advantage of simultaneously cancelling a request as well as removing the backlog from further in the past potentially leaving some intermediate ones.</p>
<p>In the case you call out only effecting the specific ID, you just set the id and not the timestamp.</p>
|
108130
|
2024-02-07T20:45:09.787
|
|ros2|action-server|
|
<p>From the Action design doc:
<a href="https://github.com/ros2/design/blob/gh-pages/articles/actions.md" rel="nofollow noreferrer">https://github.com/ros2/design/blob/gh-pages/articles/actions.md</a></p>
<pre><code>Cancel Goal Service
Direction: client calls server
Request: goal ID and timestamp
Response: response code and a list of goals that have transitioned to the CANCELING state
The purpose of this service is to request the cancellation of one or more goals on the action server. The response code indicates any failures in processing the request (e.g. OK, REJECTED or INVALID_GOAL_ID). The list of goals in the response indicates which goals will be attempted to be canceled. Whether or not a goal transitions to the CANCELED state is indicated by the status topic and the result service.
The cancel request policy is the same as in ROS 1.
- If the goal ID is empty and timestamp is zero, cancel all goals
- If the goal ID is empty and timestamp is not zero, cancel all goals accepted at or before the timestamp
- If the goal ID is not empty and timestamp is zero, cancel the goal with the given ID regardless of the time it was accepted
- If the goal ID is not empty and timestamp is not zero, cancel the goal with the given ID and all goals accepted at or before the timestamp
</code></pre>
<p>On the last line ("goal ID is not empty and timestamp is not zero"), why "cancel the goal with the given ID and all goals accepted at or before the timestamp"? I would imagine it would make more sense to "cancel the <em>all goals with the given ID</em> accepted at or before the timestamp" (instead of all goals across the board). But I also am very new to ROS and have no idea what I am talking about, so take my question with a grain of salt.</p>
<p>I find it odd because I would assume that if the goal ID was specified, then the process requesting the cancellation doesn't want to affect goals with different IDs. Basically it seems that the second ("goal ID is empty and timestamp is not zero)" and forth ("goal ID is not empty and timestamp is not zero") have the same result: cancel all goals accepted at or before the timestamp.</p>
<p>Here is the source code:
<a href="https://github.com/ros2/rcl/blob/rolling/rcl_action/src/rcl_action/action_server.c" rel="nofollow noreferrer">https://github.com/ros2/rcl/blob/rolling/rcl_action/src/rcl_action/action_server.c</a>
I believe the code in question is the definition of rcl_action_process_cancel_request() which start around line 723 of action_server.c of the rcl library.</p>
<p>A few related questions that might help me understand Tully's response:</p>
<ul>
<li>Is it possible to have two action requests with the same goal ID? For example, can you tell a robot to move forward 2 meters and then queue up a second action to go an additional 2 meters before the first action has finished?</li>
<li>If it is possible to have two action requests with the same goal ID, how would I cancel the older request without canceling the newest request (without cancelling other actions with different IDs)? Alternatively, how would I cancel the newest request without canceling the older request (without cancelling other actions with different IDs)?</li>
</ul>
|
Cancel request policy in ROS2 for specified goal id and timestamp seems odd
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.