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

Why cannot launch node of type [laser_geometry/laser_geometry]

asked 2018-08-09 00:06:23 -0500

Pujie gravatar image

I need to transfer from sensor_msgs::LaserScan to sensor_msgs::PointCloud2 . I found laser_geometry package, ( http://wiki.ros.org/laser_geometry ). Because there is no ROS API, I found a link which helps. The link is ( https://answers.ros.org/question/1123... ). I compiled the .cpp file same to the link:

#include "laser_geometry/laser_geometry.h"
#include <algorithm>
#include <ros/assert.h>
#include <tf2/LinearMath/Transform.h>
#include <tf/transform_listener.h>
#include "ros/ros.h"
class My_Filter{
    public:
        My_Filter();
        void scanCallback(const sensor_msgs::LaserScan::ConstPtr& scan);
    private:
        ros::NodeHandle node_;
        laser_geometry::LaserProjection projector_;
        tf::TransformListener tfListener_;
        ros::Publisher point_cloud_publisher_;
        ros::Subscriber scan_sub_;
};
My_Filter::My_Filter(){
    scan_sub_ = node_.subscribe<sensor_msgs::LaserScan> ("/scan", 100, &My_Filter::scanCallback, this);

    point_cloud_publisher_ = node_.advertise<sensor_msgs::PointCloud2> ("filtered_cloud", 100, false);

    tfListener_.setExtrapolationLimit(ros::Duration(0.1));
}
void My_Filter::scanCallback(const sensor_msgs::LaserScan::ConstPtr& scan){
    sensor_msgs::PointCloud2 cloud;
    projector_.transformLaserScanToPointCloud("base_link", *scan, cloud, tfListener_);
    point_cloud_publisher_.publish(cloud);
}
int main(int argc, char** argv)
{
    ros::init(argc, argv, "my_filter");
    My_Filter filter;
    ros::spin();
    return 0;
}

from my cmakelist.txt and package.xml, I wrote a launch file

`target_link_libraries(laser_geometry ${Boost_LIBRARIES} ${tf_LIBRARIES})`, `<name>laser_geometry</name>` 

<launch><node pkg="laser_geometry" type="laser_geometry" name="my_filter"/></launch>

But I can't launch this node.

ERROR: cannot launch node of type [laser_geometry/laser_geometry]: can't locate node [laser_geometry] in package [laser_geometry]

Could you please give me some hints? How to use the laser_geometry package and launch the node? Thank you!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2018-08-09 12:54:22 -0500

Have you tried roscd laser_geometry and ensure you have it installed? If not grab from apt-get.

It doesn't appear that laser_geometry is a node, its just a library. https://github.com/ros-perception/las...

You cann't lauch node of type laser_geometry because that node does not exist, its a package / library.

edit flag offensive delete link more
1

answered 2018-08-09 01:37:56 -0500

gvdhoorn gravatar image

This is not really an answer, but if all you want is to aggregate a number of laserscans into a pointcloud I would not bother with writing my own node, but just use the laser_scan_assembler node.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-08-09 00:06:23 -0500

Seen: 518 times

Last updated: Aug 09 '18