Problem using nav2d package with Turtlebot3: Remote does not publish over /cmd to Operator

asked 2023-02-28 08:40:20 -0500

Nebula1253 gravatar image

updated 2023-03-01 14:03:43 -0500

Hello! I'm working on a robotics project for university coursework with a Turtlebot3 (waffle pi model) using the nav2d package. I'm currently working through the RobotOperator tutorial on http://wiki.ros.org/nav2d/Tutorials/R...; it works fine with the Stage simulation, but when I try to modify the tutorial1.launch file and rosparams to work with the turtlebot, I get this error in rviz:

image description

RQT graph when run with stage: RQT graph for stage

RQT graph when run with the actual turtlebot: image description

Looking at the rqt_graph and comparing it to the original tutorial file with Stage, the Remote node is not sending a message over the /cmd topic to the Operator node, which I assume is also causing the rest to fail. In particular, the Operator is not publishing anything. Is there any way to fix this???

Here is my modified tutorial1 launch file:

<launch>

<!-- Some general parameters -->
<param name="use_sim_time" value="true" />
<rosparam file="$(find nav2d_tutorials)/param/ros_turtlebot.yaml"/>

<!-- Start the Operator to control the simulated robot -->
<node name="Operator" pkg="nav2d_operator" type="operator" >
    <remap from="scan" to="base_scan"/>
    <rosparam file="$(find nav2d_tutorials)/param/operator.yaml"/>
    <rosparam file="$(find nav2d_tutorials)/param/costmap.yaml" ns="local_map" />
</node>

<!-- Start the joystick-driver and remote-controller for operation-->
<node name="Joystick" pkg="joy" type="joy_node" />
<node name="Remote" pkg="nav2d_remote" type="remote_joy" />

<!-- RVIZ to view the visualization -->
<node name="RVIZ" pkg="rviz" type="rviz" args=" -d $(find nav2d_tutorials)/param/tutorial1.rviz" />
</launch>

Here is the modified ros.yaml file (I tried implementing the solutions to similar problems on here already, but it didn't work):

###########################################################
# Defines topics services and frames for all modules

### TF frames #############################################
laser_frame: base_laser_link
robot_frame: base_link
odometry_frame: odom
offset_frame: offset
map_frame: map

### ROS topics ############################################
map_topic: map
laser_topic: scan ## ORIG = base_scan

### ROS services ##########################################
map_service: dynamic_map ## ORIG = static_map
edit retag flag offensive close merge delete

Comments

1

This is probably because you do not have the map_server node running. see http://wiki.ros.org/map_server. It publishes on the /map topic the map that is described in the map.yaml. Are you using a simulated or real robot, either way would recommend looking at https://robots.ros.org/turtlebot3/

bribri123 gravatar image bribri123  ( 2023-02-28 19:59:47 -0500 )edit

I'm using an actual Turtlebot atm. The suggestion about the map server didn't work.; the same error persists, even after adding this line to the launch file:<node name="map_server" pkg="map_server" type="map_server" args="$HOME/Documents/stagehands/basebot/map/map.yaml" />

I edited the original post to include a better description of what the error was, as well as the RQT graphs.

Nebula1253 gravatar image Nebula1253  ( 2023-03-01 12:56:22 -0500 )edit

Can i see your tf tree while all these nodes are up.

  • rosrun rqt_tf_tree rqt_tf_tree

First change the sim_time parameter in the lauch file to false since you are dealing with a real robot and also. make sure the map server node is installed. You can check with the command below rospack list | grep nmap_server . If it isn't installed try and install it. Make sure the map topic is right. The problem you are having is either a frame name or topic name isn't correct.

create a map folder/directory ..Save the map into the folder .

  • rosrun map_server map_saver -f <name>

Add the map server xml node to your launch file :

  • < arg name="map_file" default="$(find your_package_name)/map/name.yaml/ >

    < node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)"> < param name="frame_id" value="map" /> </node>

Davies Ogunsina gravatar image Davies Ogunsina  ( 2023-03-01 13:50:50 -0500 )edit

Hello! I changed the sim_time parameter but that didn't fix the error. I don't think it has anything to do with the map server at all: the tutorial I'm working on is the robot operator one, which only takes into consideration local LIDAR readings.

However, I looked at the tf_tree, and found that for some reason only odom and base_link were there?

Nebula1253 gravatar image Nebula1253  ( 2023-03-02 07:27:28 -0500 )edit