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

launching laser_scan_assembler with periodic snapshotter

asked 2013-11-20 18:02:33 -0500

sivan gravatar image

updated 2013-11-20 20:02:19 -0500

tfoote gravatar image

i need to make a composite point cloud. For that in tutorial and in help i have seen ,i need to create laser_assembler package . i need to launch laser_scan_assembler launch file along with periodic_snapshotter file. but im new to ros and i don know how to create a laser_assembler package ,and to launch laser_scan_assembler file with periodic_snaphotter,

please help me in these two issues .

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-02-14 05:59:51 -0500

redarean gravatar image

Start roscore and rosbag (I'm assuming that you are playing a pre-recorded bagfile)

Then use the laser_scan_assembler.launch file below. Of course, you can change the time buffer and maximum number of scans. I use the odom frame, but you can use map, if you prefer that!

<launch>
    <node pkg="laser_assembler" type="laser_scan_assembler" output="screen"  name="laser_scan_assembler">
    <param name="tf_cache_time_secs" type="double" value="475.0" />
    <param name="max_scans" type="int" value="4000000" />
    <param name="ignore_laser_skew" type="bool" value="true" />
    <param name="fixed_frame" type="string" value="/odom" />
  </node>
</launch>

Follow this with periodic snapshotter (rosrun periodic_snapshotter periodic_snapshotter) I use the periodic_snapshotter.cpp file below. You can change the time buffer for the snapshotter in the timerCallback

/*********************************************************************
* Software License Agreement (BSD License)
*
*  Copyright (c) 2008, Willow Garage, Inc.
*  All rights reserved.
*
*  Redistribution and use in source and binary forms, with or without
*  modification, are permitted provided that the following conditions
*  are met:
*
*   * Redistributions of source code must retain the above copyright
*     notice, this list of conditions and the following disclaimer.
*   * Redistributions in binary form must reproduce the above
*     copyright notice, this list of conditions and the following
*     disclaimer in the documentation and/or other materials provided
*     with the distribution.
*   * Neither the name of the Willow Garage nor the names of its
*     contributors may be used to endorse or promote products derived
*     from this software without specific prior written permission.
*
*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
*  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
*  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
*  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
*  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
*  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
*  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
*  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
*  POSSIBILITY OF SUCH DAMAGE.
*********************************************************************/

#include <cstdio>
#include <ros/ros.h>

// Services
#include "laser_assembler/AssembleScans.h"

// Messages
#include "sensor_msgs/PointCloud.h"


/***
 * This a simple test app that requests a point cloud from the
 * point_cloud_assembler every 80 seconds, and then publishes the
 * resulting data
 */
namespace laser_assembler
{

class PeriodicSnapshotter
{

public:

  PeriodicSnapshotter()
  {
    // Create a publisher for the clouds that we assemble
    pub_ = n_.advertise<sensor_msgs::PointCloud> ("assembled_cloud", 1);

    // Create the service client for calling the assembler
    client_ = n_.serviceClient<AssembleScans>("assemble_scans");

    // Start the timer that will trigger the processing loop (timerCallback)
    timer_ = n_.createTimer(ros::Duration(80,0), &PeriodicSnapshotter::timerCallback, this);

    // Need to track if we've called the timerCallback at least once
    first_time_ = true;
  }

  void timerCallback(const ros::TimerEvent& e)
  {

    // We don't want to build a cloud the first callback, since we we
    //   don't have a start and end time yet
    if (first_time_)
    {
      first_time_ = false;
      return;
    }

    // Populate our service request based on our timer callback times
    AssembleScans srv;
    srv.request.begin ...
(more)
edit flag offensive delete link more

Comments

Hi,

Can you help me with this question. I have the laser_assembler up and running with periodic_snapshotter. I want to convert the pointcloud to octomap using octomap server. However the pointcloud data required is pointcloud2. How do I convert the data to pointcloud2. Is there any default package.

AlexR gravatar image AlexR  ( 2015-04-26 00:32:21 -0500 )edit

Hi, I follow the steps described but it doesn't work for me. I run a bag file, then launch the laser_scan_assembler.launch and finally the periodic snapshotter, but I got this:

INFO Published Cloud with 0 points

How could I solve it? Thank you.

jcgarciaca gravatar image jcgarciaca  ( 2015-10-12 11:51:23 -0500 )edit

Hi jcgarciaca, Can you run "rosbag info" on your bagfile and update the question? It could be an issue of the pointcloud2 being expected instead of pointcloud. Thanks!

redarean gravatar image redarean  ( 2015-10-12 12:30:57 -0500 )edit

Hi redarean, thanks for your answer. The rosbag info on my file is:

path: 2015-09-25-17-07-26.bag

version: 2.0

duration: 1:59s (119s)

start: Sep 25 2015 17:07:27.47 (1443218847.47)

end: Sep 25 2015 17:09:27.14 (1443218967.14)

size: 33.6 MB

messages: 71663

jcgarciaca gravatar image jcgarciaca  ( 2015-10-12 23:04:52 -0500 )edit

compression: none [44/44 chunks]

types: rosgraph_msgs/Log [acffd30cd6b6de30f120938c17c593fb]

sensor_msgs/LaserScan [90c7ef2dc6895d81024acba2ac42f369]

jcgarciaca gravatar image jcgarciaca  ( 2015-10-12 23:06:02 -0500 )edit

topics: /rosout 7 msgs : rosgraph_msgs/Log (3 connections)

/scan 71656 msgs : sensor_msgs/LaserScan

Thank you

jcgarciaca gravatar image jcgarciaca  ( 2015-10-12 23:07:17 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2013-11-20 18:02:33 -0500

Seen: 1,537 times

Last updated: Feb 14 '14