0
$\begingroup$

Rosanswers logo

Greetings,

I'm trying to configure move_base on a Jetson Nano board (Ubuntu 18.04, ROS Melodic) equipped with an RpLidar and ZED2 camera. The RpLidar provides the "/scan" topic which updates the local_costmap. Unfortunately, I can't get the "/scan" topic to get linked to move_base and I can't figure out how to link them both together.

I am following the tutorial on this page: move_base - ROS Wiki

Here are the config files for move_base on the jetbot:

Launch File:

<launch>
<!-- NODE1: ZED2 NODE CREATION -->
<arg name="svo_file"             default="" /> <!-- <arg name="svo_file" default="path/to/svo/file.svo"> -->
<arg name="stream"               default="" /> <!-- <arg name="stream" default="<ip_address>:<port>"> -->

<arg name="node_name"            default="zed_node" />
<arg name="camera_model"         default="zed2" />
<arg name="publish_urdf"         default="true" />

<arg name="camera_name"          default="zed2" />

<arg name="base_frame"           default="base_link" />

<arg name="cam_pos_x"             default="0.0" /> <!-- Position respect to base frame (i.e. "base_link) -->
<arg name="cam_pos_y"             default="0.0" /> <!-- Position respect to base frame (i.e. "base_link) -->
<arg name="cam_pos_z"             default="0.0" /> <!-- Position respect to base frame (i.e. "base_link) -->
<arg name="cam_roll"              default="0.0" /> <!-- Orientation respect to base frame (i.e. "base_link) -->
<arg name="cam_pitch"             default="0.0" /> <!-- Orientation respect to base frame (i.e. "base_link) -->
<arg name="cam_yaw"               default="0.0" /> <!-- Orientation respect to base frame (i.e. "base_link) -->

<group ns="$(arg camera_name)">
    <include file="$(find zed_wrapper)/launch/include/zed_camera.launch.xml">
        <arg name="camera_name"         value="$(arg camera_name)" />
        <arg name="svo_file"            value="$(arg svo_file)" />
        <arg name="stream"              value="$(arg stream)" />
        <arg name="node_name"           value="$(arg node_name)" />
        <arg name="camera_model"        value="$(arg camera_model)" />
        <arg name="base_frame"          value="$(arg base_frame)" />
        <arg name="publish_urdf"        value="$(arg publish_urdf)" />
        <arg name="cam_pos_x"           value="$(arg cam_pos_x)" />
        <arg name="cam_pos_y"           value="$(arg cam_pos_y)" />
        <arg name="cam_pos_z"           value="$(arg cam_pos_z)" />
        <arg name="cam_roll"            value="$(arg cam_roll)" />
        <arg name="cam_pitch"           value="$(arg cam_pitch)" />
        <arg name="cam_yaw"             value="$(arg cam_yaw)" />
    </include>
</group>

<remap from="/odom" to="/zed2/zed_node/odom"/>

<!-- NODE 2: RP_Lidar -->
<node name="rplidarNode"          pkg="rplidar_ros"  type="rplidarNode" output="screen">
<param name="serial_port"         type="string" value="/dev/ttyUSB0"/>
<param name="serial_baudrate"     type="int"    value="115200"/><!--A1/A2 -->
<param name="frame_id"            type="string" value="laser_frame"/>
<param name="inverted"            type="bool"   value="false"/>
<param name="angle_compensate"    type="bool"   value="true"/>
</node>

<!-- NODE 3: ROS Jetbot -->
<node name="jetbot_control_node" pkg="ros_jetbot" type="controll.py"/>

<!-- NODE 4: Move Base Wrapper (Configuration) -->
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
    <rosparam file="$(find zed_move_base)/config/costmap_common_params.yaml" command="load" ns="global_costmap" />
    <rosparam file="$(find zed_move_base)/config/costmap_common_params.yaml" command="load" ns="local_costmap" />
    <rosparam file="$(find zed_move_base)/config/local_costmap_params.yaml" command="load" ns="local_costmap" />
    <rosparam file="$(find zed_move_base)/config/global_costmap_params.yaml" command="load" ns="global_costmap" />
    <rosparam file="$(find zed_move_base)/config/base_local_planner_params.yaml" command="load" />
</node>

</launch>

Costmap_common_params.yaml:

obstacle_range: 2.5
raytrace_range: 3.0 
footprint: [[0.05, 0.05], [0.05, -0.05], [-0.05, -0.05], [-0.05, 0.05]]
inflation_radius: 0.3
footprint_padding: 0.05

observation_sources: laser_scan_sensor
laser_scan_sensor: {sensor_frame: laser_frame, data_type: LaserScan, topic: scan, marking: true, clearing: true}

Local_costmap_params.yaml:

global_frame: odom
robot_base_frame: base_link 
update_frequency: 6.0
publish_frequency: 5.0 
static_map: false
rolling_window: true 
width: 10.0
height: 10.0
resolution: 0.05

plugins:
 - {name: obstacles_laser,           type: "costmap_2d::ObstacleLayer"}
 - {name: inflation,                 type: "costmap_2d::InflationLayer"}

Global_costmap_params.yaml:

global_frame: map 
robot_base_frame: base_link
update_frequency: 6.0 
static_map: false
rolling_window: true
track_unknown_space: true
width: 20.0
height: 20.0
resolution: 0.05

plugins:
 - {name: obstacles_laser,           type: "costmap_2d::ObstacleLayer"}
 - {name: inflation,                 type: "costmap_2d::InflationLayer"}

Base_local_planner_params.yaml:

controller_frequency: 5.0
recovery_behaviour_enabled: true
clearing_rotation_allowed: false

TrajectoryPlannerROS:
max_vel_x: 0.5
min_vel_x: 0.3
max_vel_theta: 1.0
min_in_place_vel_theta: 0.5

acc_lim_theta: 3.2
acc_lim_x: 2.5
acc_lim_y: 2.5

holonomic_robot: false
meter_scoring: true

How can I get move_base to publish to the "/scan" topic? Is there anything missing/wrong in the config files?


Originally posted by Hlezzaik on ROS Answers with karma: 3 on 2021-12-14

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

It may be that observation_sources and plugins are not connected. You can probably subscribe with the following

Local_costmap_params.yaml:

global_frame: odom
robot_base_frame: base_link 
update_frequency: 6.0
publish_frequency: 5.0 
static_map: false
rolling_window: true 
width: 10.0
height: 10.0
resolution: 0.05

plugins:
 - {name: obstacles_laser,           type: "costmap_2d::ObstacleLayer"}
 - {name: inflation,                 type: "costmap_2d::InflationLayer"}

# add
obstacles_laser:
  observation_sources: laser_scan_sensor
  laser_scan_sensor: {sensor_frame: laser_frame, data_type: LaserScan, topic: scan, marking: true, clearing: true}

Originally posted by miura with karma: 1908 on 2021-12-14

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Hlezzaik on 2021-12-15:
Thanks, I just tried that and it actually worked!!

Comment by miura on 2021-12-15:
@Hlezzaik I'm glad it worked out. Could you please click on the collect symbol to indicate that it is the correct answer?

Comment by Hlezzaik on 2021-12-16:
Thank you, just did that.

I'm having a new problem now though, with the config files as above and adding the obstacles laser to the local costmap, I sense there's something missing for the global costmap.

I'm getting the following bugs whenever I tell the robot to go to a specific point:

Could not transform the global plan to the frame of the controller
The origin of the sensor at (1.68, 0.10) is out of map bounds. So, the costmap cannot raytrace for it. 
The goal sent to the navfn planner is off the global costmap. Planning will always fail to this goal.

Any suggestions?

Comment by miura on 2021-12-16:
Thank you for clicking.

I think that creating map information with gmapping or map_server and reflecting it to the global cost map may solve the problem. If you have additional questions, could you please create a new question page?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.