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

Get a navigation goal from laserscan

asked 2016-11-01 03:21:33 -0500

chengwei gravatar image

updated 2016-11-03 02:58:17 -0500

Hi everyone,

For some purpose, I want to publish a navigation goal(type geometry_msgs::PoseStamped ). Now I want to get the position and orientation from the laserscan data as fellows, how can i make it?

float ra = scan_msg->ranges[t];
float angle = scan_msg->angle_min + i * scan_msg->angle_increment;

the laserscan frame_id = "laser", the map frame_id = "map", and I have the tf tree laser->base_link->odom->map.

Any suggestions. Thank You In Advance!!!


I have solve the problem at this link

edit retag flag offensive close merge delete


Could you please post your last edit as an answer, and then accept your own answer? That shows much more clearly that your question was answered than if you close it.


gvdhoorn gravatar image gvdhoorn  ( 2016-11-03 18:14:04 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-11-02 15:39:53 -0500

I'm a little unclear on what you actual question is but I'll offer some advice.

Obtaining your current location based on laser scan data can be done with something like the amcl package that compares the laser scans to a known map.

You can create a map from laser scan data using gmapping or manually using GIMP (just export as .gmp).

An easy way to publish a Navigation Goal is to use RVIZ. You can select the 2D Nav goal button at the top which allows you to place an arrow on the screen of where you want the nav goal to be.

edit flag offensive delete link more



I'm sorry for my poor English.

I want to publish a Navigation Goal, and the Goal's position is obtaining from a laserscan range float ra = scan_msg->ranges[t] ,and the Goal's orientation is get from a angle float angle = scan_msg->angle_min + i * scan_msg->angle_increment;

chengwei gravatar image chengwei  ( 2016-11-02 20:19:57 -0500 )edit

No problem. I'm still a bit confused about your application. Is your laser scan being taken from your robots position? Are you then trying to obtain a navigation goal? If so which range do you want to use? It looks like you have an array. Also can you explain your angle calculation?

shoemakerlevy9 gravatar image shoemakerlevy9  ( 2016-11-02 21:17:39 -0500 )edit


The laserscan is taken from my robots, the frame is laser, I want to obtain a navigation goal from the laserscan, float ra = scan_msg->ranges[t];float angle = scan_msg->angle_min + t * scan_msg->angle_increment, here the t is constant, obtained by calculation. Not an array, just one data

chengwei gravatar image chengwei  ( 2016-11-02 21:40:39 -0500 )edit

Just as obtain the navigation goal from a range,and a angle in a laserscan. The range is the specified orientation(angle) in the laserscan.

I want to publish the Goal about something interesting, and detect object from the laserscan.

chengwei gravatar image chengwei  ( 2016-11-02 21:44:44 -0500 )edit

Question Tools

1 follower


Asked: 2016-11-01 03:21:33 -0500

Seen: 765 times

Last updated: Nov 03 '16