Navigation stack launch file problems

Hi
I implemented a new global planner. It works perfectly as a C++ program.

I am using Ubuntu 18.04 and ROS melodic installed in a partition of macBookPro

Now, I want to integrate the planner in ROS Navigation Stack and use pre-build maps. I want to use simulated ROSbot2 from Husarion. I followed and tried to integrate the following tutorials:

http://wiki.ros.org/navigation/Tutorials/Writing%20A%20Global%20Path%20Planner%20As%20Plugin%20in%20ROS

and
http://wiki.ros.org/navigation/Tutorials/RobotSetup

and

My workspace is: ~/ros_workspace

It contains the following packages:

1- myNewGlobalPlanner
2- rosbot_description
3- rosbot_ekf
4- rplidar_ros

My map and the yaml file are stored in:
ros_workspace/src/rosbot_description/src/rosbot_navigation/maps/gridMap8by8.yaml
ros_workspace/src/rosbot_description/src/rosbot_navigation/maps/gridMap8by8.pgm

The content of yaml file:

image: gridMap8by8.pgm
resolution: 0.1
origin: [0.0, 0.0, 0.0]
occupied_thresh: 0.65
free_thresh: 0.196
negate: 0

This is my .pgm map
http://www.mediafire.com/file/slfs90pewymxxbl/gridMap8by8.pgm/file

The launch file for the Navigation Stack is stored in:
ros_workspace/src/rosbot_description/src/rosbot_navigation/move_rosbot_newPlannerAlgorithm.launch

<launch>
<arg name="use_rosbot" default="true"/>
<arg name="use_gazebo" default="false"/>

<include if="$(arg use_gazebo)" file="$(find rosbot_gazebo)/launch/maze_world.launch"/>

<include if="$(arg use_gazebo)" file="$(find rosbot_gazebo)/launch/rosbot.launch"/>

<param if="$(arg use_gazebo)" name="use_sim_time" value="true"/>

<!-- <node if="$(arg use_rosbot)" pkg="rplidar_ros" type="rplidarNode" name="rplidar"> -->
    <!-- <param name="angle_compensate" type="bool" value="true"/> -->
    <!-- <param name="serial_baudrate" type="int" value="115200"/> -->  <!-- model A2 (ROSbot 2.0) -->
    <!-- <param name="serial_baudrate" type="int" value="256000"/> --> <!-- model A3 (ROSbot 2.0 PRO) -->
<!-- </node> -->

 <!--- rviz -->
<node pkg="rviz" type="rviz" name="rviz"/>

<!-- Bring the ROSbot model to rviz -->
<include file="$(find rosbot_description)/launch/rosbot.launch"/>

<!-- ROSbot 2.0 ekf -->
<include if="$(arg use_rosbot)" file="$(find rosbot_ekf)/launch/all.launch"/>

<!--- tf -->
<node if="$(arg use_rosbot)" pkg="tf" type="static_transform_publisher" name="laser_broadcaster" args="0 0 0 3.14 0 0 base_link laser 100" />

 <!--- Run AMCL --> 
<include file="$(find amcl)/examples/amcl_diff.launch" />

<!-- Map server -->
<arg name="map_file" default="$(find rosbot_navigation)/maps/gridMap8by8.yaml"/>
<node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)" />

<!-- Move base -->
<node pkg="move_base" type="move_base" name="move_base" output="screen">
    <param name="controller_frequency" value="10.0"/>
    <param name="base_global_planner" value="my_new_global_planner/MyNewGlobalPlannerROS"/>
</node>

The commands:

$ catkin_make

$ source devel/setup.bash

are ok and do not give errors

However,

$ roslaunch rosbot_navigation move_rosbot_newPlannerAlgorithm.launch

At start, it works normally http://www.mediafire.com/view/p8nzxz7uwk24sly/output1.png/file
But then, it gives errors http://www.mediafire.com/view/riv6n1sd8cxb22u/output1Continued.png/file

My Questions are:

*Why this error " Error opening serial: Could not configure port: (5, ‘Input/output error’) " occurs?

*Can I display or bring ROSbot model to rviz?

*Why Gazebo started while it is set false in the launch file?

*Are the launch file correct? Do I missed packages?

Regarding the map, could you please check it? My maps is built from a 88 2d array of 0s (free) and 100s(obstacle). I converted it using matlab to .pgm image, but it is very small. Is it ok to use it as a map, the maximum dimension that I want to handle is 256*256.

*Do I need rplidar package? I will not build a map at all. Or it is necessary for the local planner?
Using this package caused error “cannot bind to the specified serial port ttyUSB0” which is not found under /dev directory, and I spend days trying to solve this issue with no hope.

Finally, sorry for this long post. After finishing this, I am thinking about writing a tutorial for writing planner using ROSbot.

Appreciate your help.

Hi Eman,

Why you are using:

<include if="$(arg use_rosbot)" file="$(find rosbot_ekf)/launch/all.launch"/>

It’s a node for communication in real ROSbot 2.0 so you don’t need to run it. Removing it from launch file will fix most of the errors. Please check it and let me know the results.

Best regards,
Hubert

Many Thanks Hubert.
I edited the lanuch file:

<launch>
    <arg name="use_rosbot" default="true"/>
    <arg name="use_gazebo" default="false"/>

    <include if="$(arg use_gazebo)" file="$(find rosbot_gazebo)/launch/maze_world.launch"/>
   
    <include if="$(arg use_gazebo)" file="$(find rosbot_gazebo)/launch/rosbot.launch"/>

    <param if="$(arg use_gazebo)" name="use_sim_time" value="true"/>


     <!-- Bring the ROSbot model and show it in rviz -->
     <include file="$(find rosbot_description)/launch/rosbot_rviz.launch"/>
     <!--- no need for below line,rviz already called in above launch file -->
     <!-- <node pkg="rviz" type="rviz" name="rviz"/> --> 

    <!--- tf -->
    <node if="$(arg use_rosbot)" pkg="tf" type="static_transform_publisher" name="laser_broadcaster" args="0 0 0 3.14 0 0 base_link laser 100" />

     <!--- Run AMCL --> 
    <include file="$(find amcl)/examples/amcl_diff.launch" />

    <!-- Map server -->
    <arg name="map_file" default="$(find rosbot_navigation)/maps/gridMap8by8.yaml"/>
    <node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)" />
    
    <!-- Move base -->
    <node pkg="move_base" type="move_base" name="move_base" output="screen">
        <param name="controller_frequency" value="10.0"/>
        <param name="base_global_planner" value="metabolic_pathway_global_planner/MetabolicPathwayGlobalPlannerROS"/>
    </node>

</launch>

After running command:
$ roslaunch rosbot_navigation move_rosbot_newPlannerAlgorithm.launch

**I got:
xacro.py is deprecated; please use xacro instead
xacro.py is deprecated; please use xacro instead

Then displaying nodes and processes etc…

[ WARN] [1606414553.453447860]: The ‘state_publisher’ executable is deprecated. Please use ‘robot_state_publisher’ instead
[ WARN] [1606414553.463835420]: 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] [1606414553.500481365]: Requesting the map…
[ WARN] [1606414553.502849696]: Request for map failed; trying again…
[ INFO] [1606414568.666766577]: rviz version 1.13.14
[ INFO] [1606414568.666918803]: compiled against Qt version 5.9.5
[ INFO] [1606414568.666998825]: compiled against OGRE version 1.9.0 (Ghadamon)
[ INFO] [1606414568.686090253]: Forcing OpenGl version 0.
[ INFO] [1606414576.334348014]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1606414576.337777602]: waitForService: Service [/gazebo_gui/set_physics_properties] has not been advertised, waiting…
[INFO] [1606414577.857039, 0.000000]: Loading model XML from ros parameter robot_description
[INFO] [1606414577.893869, 0.000000]: Waiting for service /gazebo/spawn_urdf_model

[gazebo-5] process has died [pid 23789, exit code 255, cmd /opt/ros/melodic/lib/gazebo_ros/gzserver -e ode /home/eman/ros_workspace/src/rosbot_description/src/rosbot_gazebo/worlds/turtlebot_playground.world __name:=gazebo __log:=/home/eman/.ros/log/663c8426-3013-11eb-9471-e0f84736498c/gazebo-5.log].
log file: /home/eman/.ros/log/663c8426-3013-11eb-9471-e0f84736498c/gazebo-5.log*
[ INFO] [1606414579.056977067]: Stereo is NOT SUPPORTED
[ INFO] [1606414579.057104802]: OpenGl version: 3 (GLSL 1.3).
[WARN] [1606414579.978444, 0.000000]: Controller Spawner couldn’t find the expected controller_manager ROS interface.
[joint_state_controller_spawner-2] process has finished cleanly
log file: /home/eman/.ros/log/663c8426-3013-11eb-9471-e0f84736498c/joint_state_controller_spawner-2*.log
gzclient: /usr/include/boost/thread/pthread/pthread_mutex_scoped_lock.hpp:26: boost::pthread::pthread_mutex_scoped_lock::pthread_mutex_scoped_lock(pthread_mutex_t*): Assertion !pthread_mutex_lock(m)' failed. gzclient: /usr/include/boost/thread/pthread/mutex.hpp:111: boost::mutex::~mutex(): Assertion !res’ failed.
Aborted (core dumped)
[gazebo_gui-6] process has died [pid 23791, exit code 134, cmd /opt/ros/melodic/lib/gazebo_ros/gzclient __name:=gazebo_gui __log:=/home/eman/.ros/log/663c8426-3013-11eb-9471-e0f84736498c/gazebo_gui-6.log].
log file: /home/eman/.ros/log/663c8426-3013-11eb-9471-e0f84736498c/gazebo_gui-6.log*

Then both Rviz and Gazebo loaded
Rviz is opened with white ROSbot 2.0
Gazebo is loading, then close unexpectedly(as ubuntu indicated) , however, it is set to false in the launch file.

Hi Eman,

I’m sorry for misunderstanding in my previous message. Please look at these two lines of .launch file:

<arg name="use_rosbot" default="true"/>
<arg name="use_gazebo" default="false"/>

As you can see we define two parameters and depends on which one is set to true value .launch file runs different set of packages. In your case changing values of this parameter to opposed should solve all issue.

Best regards,
Hubert