Ask Your Question
0

What frame to use when adding range_sensor_layer (sonar) to costmap

asked 2016-01-13 05:16:38 -0600

b2meer gravatar image

I am trying to add a sonar layer into my costmap to detect obstacles. I have used the range_sensor_layer (which is a costmap plugin) for this purpose. I have added the sonar layer parameters properly in global_costmap_params, local_costmap_params and costmap_common_params. Now, when I run Rviz, the sonar layer is not showing up. When I try to add it manually by selecting the relevant topic (/sonar), it shows an error about Frame. It says that the frame does not exist. I have seen the message from laser scan which is using frame_id : camer_depth_image. I want to know what frame_id should I use in the sonar's message which should already exist and upon which the sonar message will be broadcast. (I am new to frames in ros). Thanks

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2016-01-14 06:26:31 -0600

Humpelstilzchen gravatar image

The frame_id of your sonar message should match the name of the link you have given the sensor in the urdf, e.g.

if your robot.urdf has this link for your sensor:

        <link name="sonar_backward">
            <visual>
                    <geometry>
                            <box size="0.016 0.044 0.02"/>
                    </geometry>
                    <origin xyz="${0.016/2} 0 0" rpy="0 0 0"/>
                    <material name="green">
                            <color rgba="0 1 0 0.8"/>
                    </material>
            </visual>
    </link>

then your message should have set msg.header.frame_id="sonar_backward". Of course this also requires a running joint_state_publisher that publishes the corresponding joints.

Next you need to check your tf tree contains a valid path from your Fixed Frame in rviz (usually odom or map) to your sensor (sonar_backward).

edit flag offensive delete link more

Comments

Thanks for the solution. I am a little bit confused here as I am new to ros especially with urdf and tf. I am trying to use this sonar on turtlebot. Now, I am not sure how and where to add the link for sonar in the urdf file. It already has a seperate urdf file for its 3D Kinect Sensor.

b2meer gravatar imageb2meer ( 2016-01-15 04:19:48 -0600 )edit

Usually you have an urdf that represents your complete robot. The Kinect and Sonar sensors are part of your robot, so they are part of the urdf, see the Tutorial

Humpelstilzchen gravatar imageHumpelstilzchen ( 2016-01-15 06:00:28 -0600 )edit

Alright. Thankyou very much. I am looking into it now. I am assuming that this is the last step to make it work. Could you please look into my next answer and check if I am also missing any thing else also in addition to the urdf step.

b2meer gravatar imageb2meer ( 2016-01-15 07:46:15 -0600 )edit
0

answered 2016-01-15 07:46:33 -0600

b2meer gravatar image

updated 2016-01-15 07:48:45 -0600

I have already done the following steps in order to make sonar layer working in costmap.

  1. Having arduino publishing data on topic '/sonar'

  2. Downloaded range sensor plugin from https://github.com/DLu/navigation_lay... , catkin make and copied the librange_sensor_layer.so and /include/range_sensor_layer (folder) to /ros/indigo/lib and /ros/indigo/include/ respectively

  3. Added the range sensor plugin in local_costmap_params.yaml and global_costmap_params.yaml as : {name: sonar_layer, type: "range_sensor_layer::RangeSensorLayer"} and in common_costmap_params.yaml defined it as: sonar_layer: topics: ["/sonar"] no_readings_timeout: 1.0

Question.1: As you have seen that I have already added the plugin for range sensor layer, but when I run amcl, it lists one by one each layer like 'Using obstacle_layer, Using static_layer' etc, but does not show the message for Using sonar_layer. Will it be corrected after I update the urdf file with an entry for sonar layer or is it related to something else.

Question.2: To make the sonar layer update the costmap, is there any other step in addition to above 3 which I maybe missing (assuming the urdf step is also done since I am working on it now)

edit flag offensive delete link more

Comments

I think you should open a new question for that, because its getting confusing.

  • amcl can not use the range sensor as it requires accurate obstacle information.
  • Why did you copy the files manually?
  • With these changes the values from your range sensor should be in your obstacle layer
Humpelstilzchen gravatar imageHumpelstilzchen ( 2016-01-15 10:26:04 -0600 )edit
  • I want that when my robot moves, it should also avoid obstacles detected by sonar
  • I copied files manually since they are not present by default in ros folder
  • The values from sonar layer are not showing Rviz, it only shows a dummy cone for sonar and no obstacles are detected by it.
b2meer gravatar imageb2meer ( 2016-01-16 12:14:06 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-01-13 05:16:38 -0600

Seen: 1,058 times

Last updated: Jan 15 '16