How to label 2D laser based map with some objects (door, bed, .... etc)
Hello
Im trying to put some labels of object like doors or beds in my yaml map. I have the map,its already created. Just want to define a object like for example door or bed in the map. The door should be label with some frame and coordinate, that later my laser scan can find them and give me some parameters like distance to this door or bed.
The “GMapping” package, which implements a simultaneous localization and mapping algorithm, has been employed to effectively learn occupancy grid maps from the 2D laser range data. The generated map can then be re-used to localize the platform in the learned environment producing the trajectories followed by the user.
Two dimensional map of the environment is already built from the laser range finder and IMU data. So I have that map.
This is my object node. So I put the object labels , coordinates here yes?
include "ros/ros.h"
include "std_msgs/String.h"
include "sensor_msgs/LaserScan.h"
include <vector>
sensor_msgs::LaserScan laser_scan; float min_range;
void scanCallback(const sensor_msgs::LaserScan::ConstPtr& msg) {
std::vector<float> laser;
laser = msg->ranges;
int size_laser = laser.size();
for (int i=0;i<size_laser;i++){
if (laser[i] < 0.01){
laser[i] = 99999;
}
if (laser[i] > 45){
laser[i] = 99999;
}
}
min_range = 2;
int index_min;
for (int i=0;i<size_laser;i++){
if (laser[i] < min_range){
min_range = laser[i];
index_min = i;
ROS_INFO("Minimum Range = %f", min_range);
}
}
for (int j=0;j<size_laser;j++){
if (laser[j] > min_range + 0.5){
laser[j] = 0;
}
}
laser_scan = *msg;
laser_scan.ranges.clear();
laser_scan.ranges = laser;
}
int main(int argc, char **argv) {
ros::init(argc, argv, "object_node");
ros::NodeHandle n;
ROS_INFO("Minimum Range = %f", min_range);
ros::Subscriber sub = n.subscribe("scan", 1000, scanCallback);
ros::Publisher laser_pub = n.advertise<sensor_msgs::LaserScan>("closest_points", 100);
ros::Rate loop_rate(10);
while (ros::ok())
{
laser_pub.publish(laser_scan);
ros::spinOnce();
loop_rate.sleep();
}
return 0;
}
And this is the yaml map file
image: pow_real_time.pgm resolution: 0.050000 origin: [-100.000000, -100.000000, 0.000000] negate: 0 occupied_thresh: 0.65 free_thresh: 0.196
and this is my launch file
Perform AMCL localisation: runs several nodes to generate odometry from laser scans (ICP) & IMU, loads a map of the POW assessment area, runs AMCL, plays back a dataset for localisation, and runs the visualiser with the correct visualisation parameters configured. -->
<launch>
<node name="rosplay" pkg="rosbag" type="play" args="/home/Data/13-48-20.bag --clock"/>
<node pkg="tf" type="static_transform_publisher" name="baselink_laser" args="0 0 0 0 0 0 /base_link /laser 10"/>
<node pkg="tf" type="static_transform_publisher" name="laser_imu" args="0 0 0 0 0 0 /laser /base_imu 10"/>
<node pkg="tf" type="static_transform_publisher" name="baselink_camera" args="0 0 0 0 0 0 /base_link /camera 10"/>
<!-- Start the map server node and specify the map file (*.pgm) and the map resolution in metres/pixel -->
<node name="map_server" pkg="map_server" type="map_server" args="$(find amcl_listener)/maps/pow_real_time.yaml" output="screen"/>
<!--Start the Laser_scan_matcher package, to provide odometry from laser data (ICP)-->
<node pkg="laser_scan_matcher" type ...
@Astronaut Hi my name is Cris and im working on labeling obstacles and add semantic value to the map, could you finally manage to ad the labels to the map? And if you did how did you do it?? any help would be really helpful and appreciated