ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

how to start a map

asked 2021-03-31 12:28:18 -0600

harish556 gravatar image

updated 2021-03-31 12:32:11 -0600

i want to add a map node to my robot but I don't where to put it, this is my launch file

<?xml version="1.0"?>
<launch>
<include file="$(find gazebo_ros)/launch/willowgarage_world.launch">
  </include>
  <param name="robot_description" command="cat '$(find robot)/urdf/robot.xacro'"/>

  <arg name="x" default="0"/>
  <arg name="y" default="0"/>
  <arg name="z" default="0.5"/>

  <node name="robot_spawn" pkg="gazebo_ros" type="spawn_model" output="screen"
      args="-urdf -param robot_description -model robot -x $(arg x) -y $(arg y) -z $(arg z)" />

<!-- send fake joint values -->
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
  <param name="use_gui" value="False"/>
</node>

<!-- Combine joint values -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>
<!-- Show in Rviz   -->
<node name="rviz" pkg="rviz" type="rviz" />

</launch>

when I start a rviz and add map I get the message "No map received" what should I do now?

and when use

rostopic list

I am getting these topics

/clicked_point
/clock
/cmd_vel
/gazebo/link_states
/gazebo/model_states
/gazebo/parameter_descriptions
/gazebo/parameter_updates
/gazebo/set_link_state
/gazebo/set_model_state
/initialpose
/joint_states
/move_base_simple/goal
/odom
/robot/laser/scan
/rosout
/rosout_agg
/tf
/tf_static
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2021-04-02 04:40:09 -0600

Roberto Z. gravatar image

If you already have a map in YAML format and as an PGM file (or other compatible format) you need to run map_server to publish the map on a ros topic.

To add it to your launch file include this:

<node name="map_server" pkg="map_server" type="map_server" args="$(find your_package_name)/map/your_map_name.yaml"/>
edit flag offensive delete link more

Comments

I don't have a YAML file. how should I create one?

harish556 gravatar image harish556  ( 2021-04-02 09:18:42 -0600 )edit

See @tryan 's answer on how to create a map.

Roberto Z. gravatar image Roberto Z.  ( 2021-04-03 03:49:15 -0600 )edit
1

answered 2021-04-02 10:00:18 -0600

tryan gravatar image

updated 2021-04-02 10:12:49 -0600

There are many SLAM packages and tutorials for how to use them. I suggest following one of those to start. Here are a couple examples to get you going, but some quick searching will turn up others:

  1. gmapping
  2. hector_slam

Here's a good resource for simulation and SLAM with a turtlebot. If you successfully complete the tutorial(s) and inspect the files, you should be able to transfer that knowledge to your own robot, but if you run into issues, feel free to post a new question.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-03-31 12:28:18 -0600

Seen: 328 times

Last updated: Apr 02 '21