Ask Your Question
0

Costmap_2D issue if transformListener

asked 2019-02-08 08:11:09 -0600

fabriceN gravatar image

Dear All

I have a program using a costmap_2d::costmap2DROS which is working well on my laptop but which is creating a segmentation fault on an Intel NUC and after days of debug I have noticed that it is a problem of tf::transform but I still do not understand - so here is the setup

system setup (both laptop and Intel NUC): UBUNTU 16.04 ROS Kinetic navigation stack 1.14.4 (intel NUC) navigation stack: 1.14.3 (laptop)

I wrote a simple program (which is generation a seg fault):

#include <ros/ros.h>
#include <tf/transform_listener.h>
#include <costmap_2d/costmap_2d_ros.h>

int main(int argc, char **argv) {

    ros::init(argc, argv, "hector_exploration_node");
    ros::NodeHandle nh;
    tf::TransformListener tf;
    tf::StampedTransform transform;
    try{
            tf.lookupTransform("map", "base_link", ros::Time(0), transform);
    }
    catch (tf::TransformException ex){
            ROS_ERROR("%s",ex.what());
            ros::Duration(1.0).sleep();
     }
    std::cout << "transform exist\n";
    costmap_2d::Costmap2DROS costmap("global_costmap", tf);
    costmap.start();        
    ros::Rate rate(10);

    while (ros::ok()) 
            ros::spin();

    return 0;
}

the yaml file for the costmap is :

  global_costmap:

  footprint: [[0.32, 0.32],
                  [-0.32, 0.32],
                  [-0.32, -0.32],
                  [0.32, -0.32]]

   transform_tolerance: 0.7
   inscribed_radius: 0.33
   circumscribed_radius: 0.35

   global_frame: /map
   robot_base_frame: /base_link
   update_frequency: 0.5
   publish_frequency: 0.5
  static_map: true
  rolling_window: false
  plugins:
  -  {name: static_map,       type: "costmap_2d::StaticLayer"}
   - {name: inflated_map,       type: "costmap_2d::InflationLayer"}
 static_map:
     map_topic: /map
     unknown_cost_value: 255
     subscribe_to_updates: true
     track_unknown_space: true

  inflated_map:
     inflation_radius: 0.4

When I run the package, I got the following error:

ROS_MASTER_URI=http://10.1.13.66:11311
process[hector_exploration_node-1]: started with pid [14639]
[ERROR] [1549633105.313051793]: "map" passed to lookupTransform argument target_frame does not exist.  
[ INFO] [1549633106.353766302]: Using plugin "static_map"
[ INFO] [1549633106.361257664]: Requesting the map...
[ INFO] [1549633106.570333770]: Resizing costmap to 2048 X 2048 at 0.050000 m/pix
[ INFO] [1549633106.664668383]: Received a 2048 X 2048 map at 0.050000 m/pix
[ INFO] [1549633106.664739457]: Subscribing to updates  
[ INFO] [1549633106.677235728]: Using plugin "inflated_map" 
[ERROR] [1549633106.710596582]: No Transform available Error looking up robot pose: "R?]\{?Y*k" passed to 
lookupTransform argument source_frame does not exist. 

[hector_exploration_node-1] process has died [pid 14639, exit code -11, cmd 
/home/emeric/catkin_plan_ws/devel/lib/hector_exploration_node/hector_exploration_node __name:=hector_exploration_node __log:=/home/emeric/.ros/log/4c92e5f8-2ba4-11e9-aaef-88b1116f3669/hector_exploration_node-1.log].
log file: /home/emeric/.ros/log/4c92e5f8-2ba4-11e9-aaef-88b1116f3669/hector_exploration_node-1*.log
all processes on machine have died, roslaunch will exit 
shutting down processing monitor...

It looks like that the tf.lookupTransform is not able to find the transformation between map and base_link but if i enter (in the same xterm):

  rosrun tf tf_echo base_link map
  At time 1549633095.937
  - Translation: [-0.005, 0.020, -0.129]
  - Rotation: in Quaternion [0.033, 0.063, 0.002, 0.997]
        in RPY (radian) [0.066, 0.127, 0.009]
        in RPY (degree) [3.785, 7.251, 0.490]
  At time 1549633096.637
 - Translation: [-0.004, 0.014, -0.110]
 - Rotation: in Quaternion [0.033, 0.063, 0.003, 0.997]
        in RPY (radian) [0.066, 0.126, 0.010 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-04-09 09:33:24 -0600

Orlek gravatar image

I had similar problem, the issue was that my embedded system was running an older version of ROS with a newer version of costmap_2d on it. I updated every package on my system and recompiled every workspace. It solved my problem.

You can follow what happened to me here: https://github.com/ros-planning/navig...

edit flag offensive delete link more

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: 2019-02-08 08:11:09 -0600

Seen: 54 times

Last updated: Feb 08