0
$\begingroup$

Rosanswers logo

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

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.

<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="laser_scan_matcher_node" 
    name="laser_scan_matcher_node" output="screen">
    <param name="use_alpha_beta" value="true"/>
    <param name="max_iterations" value="10"/>
</node>

<!-- Start the gmapping node -->
<!--node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen"/-->

<node pkg="amcl" type="amcl" name="amcl" respawn="true" output="screen">
    <param name="base_frame_id" value="base_link"/>
    <param name="odom_frame_id" value="world"/>
    <param name="global_frame_id" value="map"/>
    <param name="update_min_d" value="0.09"/>   
    <param name="update_min_a" value="0.09"/> 
    <param name="initial_pose_x" value="-1"/>
    <param name="initial_pose_y" value="0"/>
    <param name="initial_pose_a" value="-0.1"/>
    <param name="min_particles" value="6000"/> 
    <param name="max_particles" value="8000"/>
    <param name="odom_model_type" value="diff"/>
    <param name="kld_err" value="0.1"/> 
    <param name="resample_interval" value="1"/>
    <param name="odom_alpha1" value="0.2"/>   
    <param name="odom_alpha2" value="0.2"/>
    <param name="odom_alpha3" value="0.5"/>
    <param name="odom_alpha4" value="0.5"/>
    <param name="laser_max_beams" value="30"/>
</node>

<!--Start the "analyzer_packages"-->
<!-- acml_listener broadcasts markers for the position of the wheelchair, to visualize in Rviz-->
<node pkg="amcl_listener" type="amcl_pose_listener" name="amcl_listener" output="screen"/>
<!-- Object node records minimal ranges from laser, speed_node will record travel speed of wheelchair -->
<!--node pkg="pow_analyzer" type="object_node" name="object_node" output="screen"/> -->
<node pkg="pow_analyzer" type="max_range_node" name="max_range_node" output="screen"/>
<!--node pkg="pow_analyzer" type="speed_node" name="speed_node" output="screen"/> -->

<!-- Start an rviz node with a custom configuration for the viewpoint, map_server, trajectory, laser scans, etc -->
<node pkg="rviz" type="rviz" output="screen" name="rviz" args="-d $(find pow_analyzer)/launch/pow_rviz.vcg"/> 

Originally posted by Astronaut on ROS Answers with karma: 330 on 2012-08-08

Post score: 0


Original comments

Comment by ctguell on 2013-08-22:
@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

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I think this strongly depends on what you are going to do. If you plan to use more knowledge about you environment and you also want to to reasoning about it, you could think of using a knowledge base like KnowRob ( http://www.ros.org/wiki/knowrob ) to store e.g. semantic environment information (in a so called semantic map) and also any other kind of information you want to use. A big advantage of this approach is that you can do reasoning about objects and the environment with ot like e.g. finding the most likely storage location of an object or similar (check the Knowrob Wiki: http://ias.cs.tum.edu/kb/wiki/index.php/Main_Page )

But if you just want to have some locations of objects in your environment, this might be a bit of an overkill, so in this case you might just stick with a list of objects and coordinates...


Originally posted by michikarg with karma: 2108 on 2012-08-08

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Astronaut on 2012-08-08:
At the beginning I just want to have some locations of objects in my environment. So very very basic stuff. So how to put one object for beginning and label it with coordinate? Any tutorials about that? So just label an object with coordinates and frame in my environment.

Comment by michikarg on 2012-08-09:
I guess in this case guess I would just write a ROS node that takes a list ob objects with coordinates and posts a TF transform for every object... You can check the TF tutorials about how to add transforms: http://www.ros.org/wiki/tf/Tutorials

Comment by Astronaut on 2012-08-09:
ok. So in that case i will have this object on the laser scan map and than can calculate some parameters like minimal distance to these objects. Wright?

Comment by michikarg on 2012-08-09:
You will have tf transforms which can be in relation to every coordinate system known to tf (like e.g. the /map-frame). Thus you can easily calculate distances from the object poses to other coordinate systems (like e.g. that of the current robot pose) by just using the functions offered by TF

Comment by michikarg on 2012-08-09:
Plus you can visualize your map and object positions using RVIZ

Comment by Astronaut on 2012-08-09:
ok. also can visualize single beams, like minimal distance to that object?

Comment by Astronaut on 2012-08-09:
So I can visualize the objects of my yaml map , right?

Comment by Astronaut on 2012-08-09:
And these object have to be put in the map. So have to fill my yaml map file with the object parameters?Or how it is?

Comment by michikarg on 2012-08-09:
What do you mean by "put in the map" your map is a seperate gridmap and will (and should) not contain any information. Your locations of your objects can be stored in any file that a node takes as input. Your node can then read the files and create tf transforms accordingly...

Comment by michikarg on 2012-08-09:
Did you read through the concepts and tutorials of TF? ( http://www.ros.org/wiki/tf )

Comment by Astronaut on 2012-08-09:
Ahh ok. So what kind of file need to store the object? Any example of that? But later on I can visualize and see those object in the map???

Comment by michikarg on 2012-08-09:
You can visualize the map and TF transforms with RVIZ. TO store the objects, you can use whatever file you want since it depends on how you read the date in the rosnode that will create the TF transforms... Should basically work the same way as in the TF tutorial

Comment by Astronaut on 2012-08-09:
So to store the object I can use the object node that I just edit in the question. Yes?

Comment by Astronaut on 2012-08-10:
I can store the object in that object file I just post it?

Comment by Astronaut on 2012-08-12:
So please any help how to set the location, frame and frame relation of the object? I can not find that in the TF tutorial.

Comment by michikarg on 2012-08-13:
Actually this is exactly what the tutorial is about. Maybe you should read through it again carefully... If you don't understand it, you should probably read carefully through the beginners ROS tutorials and the overview first (see http://www.ros.org/wiki/ROS/StartGuide )

Comment by Astronaut on 2012-08-13:
Ok. Got it. But now I got some problems with knowrob. First I tried to set up KnowRob with the insruction of the wiki. So rosdep satisfy knowrob is not working. Than sudo apt-get install [...] # only if something is missing was working, But rosmake knowrob was not working again. . Any help?

Comment by Astronaut on 2012-08-13:
Or any examples of knowRob and semantic map ?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.