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

/scan topic subscribed to costmap_2d [new user]

asked 2014-08-27 11:08:05 -0500

AliAs gravatar image

updated 2014-08-27 18:57:36 -0500

Hi all,

I have (sensor_msgs/LaserScan) and I want it subscribed to costmap_2d. Apparantly costmap_2d doesnot explicitly subscribe to sensors Reference. By checking API it seems Costmap2DROS is a ROS wrapper for a 2D Costmap. Handles subscribing to topics that provide observations about obstacles in either the form of PointCloud or LaserScan messages.

I am new in ROS. I think I have to give /scan topic as an input to Costmap2DROS. I think I should write a Publisher - Subscriber through this Tutorial: ( http://wiki.ros.org/ROS/Tutorials/Wri... ) to be able to give a laser scan to Costmap2DROS. Am I right?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2014-08-27 11:16:16 -0500

paulbovbel gravatar image

If you are new to ROS, I would suggest working through all the beginner/intermediate tutorials to get a better idea about how ROS works. You do not need an intermediary publisher-subscriber, as your laserscan driver already publishes /scan, and costmap_2d will subscribe to /scan. The only reason to have a node in the middle would be to process the data in some way.

To get costmap_2d to subscribe to scan, you should read this tutorial.

edit flag offensive delete link more

Comments

Thanks Paul for being patient with me. I will study the package and share the result ...

AliAs gravatar image AliAs  ( 2014-08-27 17:31:20 -0500 )edit
1

ROS parameters are in yaml format - they can either be loaded in individually with tags in roslaunch, or in a batch using rosparam and a .yaml file.

paulbovbel gravatar image paulbovbel  ( 2014-08-27 19:28:53 -0500 )edit
1

This is described here. A minimal .yaml file for the costmap setup is shown in the tutorial (minimal.yaml). The 'dictionary' is the plugin array: plugin [] in yaml syntax.

paulbovbel gravatar image paulbovbel  ( 2014-08-27 19:33:31 -0500 )edit
1

To have the costmap subscribe to the laserscan, you need to add an obstacle layer to the plugins, instead of a static layer (for a static map), or a voxel layer (for 3d maps).

paulbovbel gravatar image paulbovbel  ( 2014-08-27 19:40:26 -0500 )edit
1

Not a yaml file, but same idea embedded directly in a launch file. https://github.com/paulbovbel/frontie...

paulbovbel gravatar image paulbovbel  ( 2014-08-27 19:55:20 -0500 )edit
0

answered 2014-08-27 18:16:25 -0500

AliAs gravatar image

updated 2014-08-27 18:17:45 -0500

Configuring layered costmaps have three steps:

  • Step 1: Transforms
  • Step 2: Basic Parameters
  • Step 3: Plugins Specification

The first step is for a transformation from the frame of the costmap to the frame of the robot. OK!

In the second step I must create a yaml file (which I don't know what it is, any way...) and set some parameters which I don't know what are they. How can I find out about those parameters?

In the third step it says "To actually specify the layers, we store dictionaries in the array of plugins". What is dictionary? what is plugins? where should I set those plugins? and it says: "This of course assumes you have a static map being published". Which static map? where can I subscribe /scan?

Too much information. I feel lost ... . I studied ROS Tutorials step 1-8, but I didn't find any relevant information ... (more)

edit flag offensive delete link more
0

answered 2016-12-20 04:51:32 -0500

Jaryblueky gravatar image

updated 2016-12-21 02:14:09 -0500

I have solved this problem. The reason is that there was neither a /odom nor a /map before. I just use a Camera to send message to costmap_2d. I have used husky-garebo to provide the /odom and /map, and input the code"rosrun tf static_transfor_publisher 0 0 0 0 0 0 /map /odom 100" to transfer frame. Then it works well. I hope this would give you some ideas.

Same to me, I can't subscribe my /scan_Image topic. The .yaml file: "global_frame: /map width: 10 height: 10 plugins: - {name: obstacles, type: "costmap_2d::ObstacleLayer"} update_frequency: 1.0 publish_frequency: 1.0 always_send_full_costmap: true obstacles: observation_sources: base_scan z_resolution: 0.6 z_voxels: 2 publish_voxel_map: true base_scan: data_type: LaserScan topic: /scan_Image clearing: true marking: true max_obstacle_height: 2.0 obstacle_range: 6.0 raytrace_range: 8.0"

it doesn't work. The subscriptions of the node /costmap_node are listed below. Subscriptions: * /tf_static [tf2_msgs/TFMessage] * /clock [unknown type] * /tf [unknown type] I don't know how can I get it to work well.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-08-27 11:08:05 -0500

Seen: 1,627 times

Last updated: Dec 21 '16