Ask Your Question

Rviz or package not functioning

asked 2019-03-22 17:33:27 -0500

Pol gravatar image

updated 2019-03-22 18:24:37 -0500

jayess gravatar image

Hello all,

I am using a Raspberry Pi 3, lubuntu 16.04, ROS Kinetic, a Tim561 Lidar and the package sick_scan. I am able to get sick_scan to run correctly and publish data to the topic cloud. I am using rviz to make sure.

I am now trying to follow this tutorial in order to down sample the pointcloud2 data. I am however having some issues. I believe I followed the steps correctly, however when I try to visualize the data in rviz nothing shows up. In addition, when I run rostopic echo output nothing appears. I would also add that on the tutorial it says to select the fixed frame as "camera_depth_frame" however this option does not appear for me(in fact no options appear). I have tried typing it in but rviz continues being blank.

Could this be an issue with the fixed frame selection or rather with my code (which I will paste below)?



#include <ros/ros.h>
// PCL specific includes
#include <sensor_msgs/PointCloud2.h>
#include <pcl_conversions/pcl_conversions.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>

#include <pcl/filters/voxel_grid.h>

ros::Publisher pub;

cloud_cb (const sensor_msgs::PointCloud2ConstPtr& cloud_msg)
  // Container for original & filtered data
  pcl::PCLPointCloud2* cloud = new pcl::PCLPointCloud2; 
  pcl::PCLPointCloud2ConstPtr cloudPtr(cloud);
  pcl::PCLPointCloud2 cloud_filtered;

  // Convert to PCL data type
  pcl_conversions::toPCL(*cloud_msg, *cloud);

  // Perform the actual filtering
  pcl::VoxelGrid<pcl::PCLPointCloud2> sor;
  sor.setInputCloud (cloudPtr);
  sor.setLeafSize (0.1, 0.1, 0.1);
  sor.filter (cloud_filtered);

  // Convert to ROS data type
  sensor_msgs::PointCloud2 output;
  pcl_conversions::moveFromPCL(cloud_filtered, output);

  // Publish the data
  pub.publish (output);

main (int argc, char** argv)
  // Initialize ROS
  ros::init (argc, argv, "my_pcl_tutorial");
  ros::NodeHandle nh;

  // Create a ROS subscriber for the input point cloud
  ros::Subscriber sub = nh.subscribe ("input", 1, cloud_cb);

  // Create a ROS publisher for the output point cloud
  pub = nh.advertise<sensor_msgs::PointCloud2> ("output", 1);

  // Spin
  ros::spin ();


<?xml version="1.0"?>
<package format="2">
    <description>The my_pcl_tutorial package</description>
    <maintainer email="ubuntu@todo.todo">ubuntu</maintainer>





cmake_minimum_required(VERSION 2.8.3)

find_package(catkin REQUIRED COMPONENTS



add_executable(example src/example.cpp)
target_link_libraries(example ${catkin_LIBRARIES})
edit retag flag offensive close merge delete


I shortened your question significantly by removing the comments in your CMakeLists.txt and package.xml files.

jayess gravatar image jayess  ( 2019-03-22 18:25:26 -0500 )edit

Ah ok thank you! Any idea on how to solve my issue?

Pol gravatar image Pol  ( 2019-03-24 13:04:07 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-03-24 13:36:45 -0500

Pol gravatar image

I was able to fix this one on my own, my apologies. The tutorial tells me to run $ rosrun my_pcl_tutorial example input:=/narrow_stereo_textured/points2, I had to change the input to cloud.

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


Asked: 2019-03-22 17:33:27 -0500

Seen: 109 times

Last updated: Mar 24 '19