HI there. We are currently working with a group of students on a project. We have a custom build Robot gripper arm, which we should be able to move and pickup objects.
The project exists with the following:
-Intel NUC -- Linux 16.04 LTS -- ROS Kinetic
-Kinect v2 (one)
-Custom build gripper arm to pick up objects
We are striving to the following goal:
1) Kinect publishes live camera feed
2) Apply object recognition on live feed
3) Recognise object and determine which one to grab
4) Apply movement to gripper to grab the object
As far as my knowledge right now goes we do need to use the following packages:
1) Publish using freenect_launch and libfreenect
2) Using pcl_recognition or Object Recognition Kitchen (ORK) for 3D point cloud processing. Which is better?
3) Using custom cpp or python scripts (?)
4) Same as 3
Things that worked:
-Getting all the 4 feeds from the Kinect using libfreenect Protonect
Things that didn't work:
-Launch the freenect to publish the Kinect's topic, it says waiting for device to connect
-Using iai_kinect2 as a bridge, couldn't install it because of the opencv3 being installed with ROS Kinetic
As i see the following https://github.com/TuZZiX/pcl_recognition a package for object recognition, if you read the readme. It talks about either pcl_recognition and using ORK. I am a bit confused, can you either pick one or do you use both?
We experimented a lot with installing different packages and trying to find the working solutions. Our question is, are we on the right way? Are we forgetting an important package?
Also I see a lot about opencv being used in different situations, is this something we should use?
Thank you
Roel
↧
What packages am I going to use to work with Kinect v2 and object recognition
↧
Better way of converting sensor_msgs::PointCloud2 to PointCloud
Hi,
I am receiving `sensor_msgs::PointCloud2` inside a callback function. I am converting it to `PointCloud` using following procedure-
1. First convert `sensor_msgs::PointCloud2` to `pcl::PCLPointCloud2`
2. Later convert `pcl::PCLPointCloud2` to `pcl::PointCloud`
3. Finally convert `pcl::PointCloud` to `pcl::PointCloud`
See below the code snippet-
inline void PointCloudXYZRGBAtoXYZRGB(pcl::PointCloud& in, pcl::PointCloud& out)
{
out.width = in.width;
out.height = in.height;
out.points.resize(in.points.size());
for (size_t i = 0; i < in.points.size (); i++)
{
out.points[i].x = in.points[i].x;
out.points[i].y = in.points[i].y;
out.points[i].z = in.points[i].z;
out.points[i].r = in.points[i].r;
out.points[i].g = in.points[i].g;
out.points[i].b = in.points[i].b;
}
}
void pointCloudCallback(const sensor_msgs::PointCloud2ConstPtr& pc_msg)
{
pcl::PCLPointCloud2 pcl_pc2;
pcl::PointCloud::Ptr cloud(new pcl::PointCloud);
pcl::PointCloud temp_cloud;
pcl_conversions::toPCL(*msg, pcl_pc2);
pcl::fromPCLPointCloud2(pcl_pc2, temp_cloud);
PointCloudXYZRGBAtoXYZRGB(temp_cloud, *cloud);
}
I am wondering if there exists better way which is efficient in terms of time taken. Kindly suggest.
↧
↧
NormalEstimation for 2D point cloud
Hi,
Is there a way to estimate normals for a 2D point cloud (XY plane & *Unorganized
point cloud*) . To give a small background the point cloud is formed from
Laser scan messages using [laser_geometry](http://wiki.ros.org/laser_geometry) package.
As per the PCL documentation, it try to fit a plane and estimate the normal
but in my case all the points are present in a plane. So is there a way to
find the normal lying the same 2D plane. Some thing like fitting a line and
finding the norm.
Thank you.
↧
Multiple publishers in a while loop
Hi there,
I want to loop while a certain criteria is met. The main problem is that I don't want to save the results of each loop and then publish them, for I need to optimize computational time. I would need to do some kind of
publisher[i]=publish[i-topic];
inside the loop. Is this possible?
EDIT: The loop takes care of the segmentation of several planes of the scene. I'm working with PointCloud Library and the message type would be pcl::PointCloud. I said I must publish it inside the loop because in each iteration the PointCloud data gets smaller as it filters out the already calculated planes. It's not a concern that publish is slow, and publisher[i] means a vector of ros::Publisher, if that's even possible to do.
Thanks in advance.
↧
ros rviz pointcloud point selection
Hi,
This page on rviz display types http://wiki.ros.org/rviz/DisplayTypes/PointCloud on the ros website mentions a attribute that the pointcloud type is "selectable". I'm not sure what that means exactly but it sounds like something I want.
I would like to display a pointcloud, and qualitatively analyse it. During this, I would like to select a point or a group of points through mouseclicks and do simple analysis like get the point coordinates or compute the group centroid etc.
Does rviz allow you to do that?
Thank you.
↧
↧
Publish message after filtering subscribed topic
Hi there,
I want to subscribe to a PointCloud topic, filter it and publish it later on a different topic in real time. What I have so far is this:
pcl::PointCloud::Ptr cloud (new pcl::PointCloud); //TODO: Avoid global variables. Is there another way?
void subCallback(const pcl::PointCloud::ConstPtr& input){
pcl::copyPointCloud(*input,*cloud);
std::cerr<<"Cloud size is "<< cloud->points.size()<::Ptr cloud_filtered (new pcl::PointCloud),
cloud_projected (new pcl::PointCloud),
cloud_p (new pcl::PointCloud),
cloud_f (new pcl::PointCloud);
std::vector> results;
//Only one Node Handle for both subscribing and publishing
ros::NodeHandle nh;
//Publishers array (one for each topic). Each topic represents a segmented plane
std::vector publishers;
while(ros::ok()){
sub=nh.subscribe("/camera/depth/points", 5, subCallback);
/*Filters and stuff
******************
******************
******************
******************/
for(int j=0;j
↧
PCL_DEFINITIONS in downstream packages
How can I pass PCL_DEFINITIONS to downstream packages ?
On my system PCL actually make use of sse which is not default for EIGEN. Hence I need to make sure that PCL_DEFINITIONS get pass to any package using a package dependent on PCL. Is there any good way to do this currently other than having
find_package(PCL 1.7 REQUIRED)
add_definitions(${PCL_DEFINITIONS})
In every project ?
↧
Navigation package without pcl
Hello
I am looking for a navigation package which I can use to plan and follow a path in a 2D-plane. Because I am using a Raspberry PI in combination with the Navio2 (emlid Raspian OS) and a RPLidar I am not able to use the PCL library(and is also not necessary because I only use a 2D-scan I think). The OS has also no GUI. Is there some way to change the navigation package in ros so that PCL is not required? Or are there also other packages available?
Kind regards,
Stef
↧
How to correctly build an OctoMap using a series of registered point clouds
Hi Guys,
I hope you can help me with this one, i'm quite new with ROS/PCL/OctoMap. It just look like a long question, but it is really simple question... I just give some extra details.
So I have a RGBD recording of a camera mounted on a robot, traversing through a corridor inside a building, and I want to build from the RGBD point-clouds I record an OctoMap of the traversed path.
In order to do so, I have built with PCL a point cloud registration pipeline. Now, I want to use this pipeline in order to build an OctoMap. Here is what I tried to do:
Iterate through the point-cloud array of the recorded point-clouds, and for each adjacent point clouds, do the following:
1. Find the registration transformation matrix (using my pipeline) between the two adjacent point clouds, where point cloud X is used as the source point cloud for registration, and point cloud X-1 is used as the target point cloud for registration.
2. Transform the source point cloud using the transformation matrix from the last step.
3. Add the transformed source point cloud to octomap.
However, it doesn't work, I suspect that I am doing something wrong in step 3. here an example source code of what I am trying to do:
octomap::OcTree octree_map(0.05);
for(int i = start; i < end; i += 1)
{
// PART 1 - Process the source point cloud (noise removal, down sampling, etc...)
point_cloud_processing_pipline_source = inference_factory.createPointCloudProcessingPipeline(inference_configuration_file, point_cloud_processing_pipeline_configuration_file);
point_cloud_processing_pipline_source->setInputCloud(pointCloud2ConstPtrVector[i]);
// PART 2 - Process the target point cloud (noise removal, down sampling, etc...)
point_cloud_processing_pipline_target = inference_factory.createPointCloudProcessingPipeline(inference_configuration_file, point_cloud_processing_pipeline_configuration_file);
point_cloud_processing_pipline_target->setInputCloud(pointCloud2ConstPtrVector[i - 1]);
// PART 3 - Create point cloud registration pipeline
auto point_cloud_registration_pipeline = inference_factory.createPointCloudRegistrationPipeline(inference_configuration_file, point_cloud_registration_pipeline_configuration_file);
// PART 4 - Set the source and target point clouds of the registration pipeline
point_cloud_registration_pipeline->setSourcePointCloudProcessingPipeline(point_cloud_processing_pipline_source);
point_cloud_registration_pipeline->setTargetPointCloudProcessingPipeline(point_cloud_processing_pipline_target);
// PART 5 - Find the trasformation matrix that transforms source into target (matrix type is Eigen::Matrix4f)
auto transformation_matrix = point_cloud_registration_pipeline->estimateTransformation();
// PART 6 - Transform the source point cloud with the registration's transformation matrix
auto point_cloud_2 = boost::make_shared();
auto source_point_cloud_transformed = boost::make_shared>();
pcl::transformPointCloud (*point_cloud_processing_pipline_source->getPoints(), *source_point_cloud_transformed, transformation_matrix);
pcl::toROSMsg(*source_point_cloud_transformed, *point_cloud_2);
// PART 7 - Add the transformed source point cloud to octomap
octomap::point3d sensor_origin = octomap::point3d(0, 0, 0);
double maxrange = 30;
bool lazy_eval = false;
bool discretize = false;
octomap::Pointcloud octomap_scan;
octomap::pointCloud2ToOctomap(*point_cloud_2, octomap_scan);
octree_map.insertPointCloud(octomap_scan, sensor_origin, maxrange, lazy_eval, discretize);
octree_map.write("test.ot");
}
There is no need to understand the full code, let's just assume that the registration matrix `transformation_matrix` that I get from my registration pipeline is correct, and let's concentrate only on `PART 7` in the code. Am I adding the transformed source point cloud correctly to octomap? Am I passing all the other parameters correctly? For some reason It looks like that the octomap I get (when i visualize it with octovis), has all the point clouds I added placed at the same point (it looks like they are all placed one on the other). I guess it is because I set `sensor_origin` to `(0,0,0)`... but I don't understand how to calculate `sensor_origin` correctly.
I will be grateful for any help.
Thanks!
↧
↧
ROS PCL tutorial actually works?
So, apparently ROS uses its own version of PCL, [pcl_ros](https://github.com/ros-perception/perception_pcl), which is different from the original PCL branch.
I was following the first **ROS+PCL tutorial**, and it seemed ok, but then I got to [this part](http://wiki.ros.org/pcl/Tutorials#pcl.2BAC8-Tutorials.2BAC8-hydro.CA-df0b218d885eb3da3cb76014e518a18a312a9e71_1) at the end of the tuto, which includes `#include `. While there is such file in the [PCL github repo](https://github.com/PointCloudLibrary/pcl/blob/master/sample_consensus/include/pcl/sample_consensus/model_types.h), I *cannot* find it in the [ROS PCL include folder](https://github.com/ros-perception/perception_pcl/tree/lunar-devel/pcl_ros/include/pcl_ros)...
From this I can only assume one of two things: either the tutorial is wrong - it should not include such file but another one instead -, **OR** you are supposed to use the actual PCL repo code, adding the libraries by editing the CMakeLists.txt and including something like
find_package(PCL 1.7 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
[...]
As described in the original PCL tutorials, which is not mentioned in the tutorial. - either way the tutorial appears to be wrong.
Am I missing something? Can you use both PCL's alongside each other, or what?
I'm afraid that would lead to some conflicts because many files have the same name in the same subfolders.
↧
CMakeLists.txt explanation
Can someone explain below mentioned CMakleLists.txt?What exactly each arg mean? I know it is a lengthy one..small overview of functions is of great use for me
I have tried to understand the tutorials, but somewhere missing the link due to the complexity.
CMakeLists.txt:
cmake_minimum_required(VERSION 2.8)
project(pcl_ros)
## Find system dependencies
find_package(cmake_modules REQUIRED)
find_package(Boost REQUIRED COMPONENTS system filesystem thread)
find_package(Eigen3 REQUIRED)
find_package(PCL REQUIRED COMPONENTS core features filters io segmentation surface)
if(NOT "${PCL_LIBRARIES}" STREQUAL "")
# For debian: https://github.com/ros-perception/perception_pcl/issues/139
list(REMOVE_ITEM PCL_LIBRARIES
"vtkGUISupportQt"
"vtkGUISupportQtOpenGL"
"vtkGUISupportQtSQL"
"vtkGUISupportQtWebkit"
"vtkViewsQt"
"vtkRenderingQt")
endif()
## Find catkin packages
find_package(catkin REQUIRED COMPONENTS
dynamic_reconfigure
genmsg
nodelet
nodelet_topic_tools
pcl_conversions
pcl_msgs
pluginlib
rosbag
rosconsole
roscpp
roslib
sensor_msgs
std_msgs
tf
tf2_eigen
)
## Add include directories
include_directories(include
${Boost_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
${Eigen3_INCLUDE_DIRS}
${PCL_INCLUDE_DIRS}
)
## Generate dynamic_reconfigure
generate_dynamic_reconfigure_options(
cfg/EuclideanClusterExtraction.cfg
cfg/ExtractIndices.cfg
cfg/ExtractPolygonalPrismData.cfg
cfg/Feature.cfg
cfg/Filter.cfg
cfg/MLS.cfg
cfg/SACSegmentation.cfg
cfg/SACSegmentationFromNormals.cfg
cfg/SegmentDifferences.cfg
cfg/StatisticalOutlierRemoval.cfg
cfg/RadiusOutlierRemoval.cfg
cfg/VoxelGrid.cfg
cfg/CropBox.cfg
)
## Declare the catkin package
catkin_package(
INCLUDE_DIRS include
LIBRARIES
pcl_ros_filters
pcl_ros_io
pcl_ros_tf
CATKIN_DEPENDS
dynamic_reconfigure
message_filters
nodelet
nodelet_topic_tools
pcl_conversions
pcl_msgs
rosbag
roscpp
sensor_msgs
std_msgs
tf
DEPENDS
Boost
Eigen3
PCL
)
## Declare the pcl_ros_tf library
add_library(pcl_ros_tf src/transforms.cpp)
target_link_libraries(pcl_ros_tf ${Boost_LIBRARIES} ${catkin_LIBRARIES} ${Eigen3_LIBRARIES} ${PCL_LIBRARIES})
add_dependencies(pcl_ros_tf pcl_ros_generate_messages_cpp ${catkin_EXPORTED_TARGETS})
## Nodelets
## Declare the pcl_ros_io library
add_library(pcl_ros_io
src/pcl_ros/io/bag_io.cpp
src/pcl_ros/io/concatenate_data.cpp
src/pcl_ros/io/concatenate_fields.cpp
src/pcl_ros/io/io.cpp
src/pcl_ros/io/pcd_io.cpp
)
target_link_libraries(pcl_ros_io pcl_ros_tf ${Boost_LIBRARIES} ${catkin_LIBRARIES} ${Eigen3_LIBRARIES} ${PCL_LIBRARIES})
class_loader_hide_library_symbols(pcl_ros_io)
## Declare the pcl_ros_features library
add_library(pcl_ros_features
src/pcl_ros/features/feature.cpp
# Compilation is much faster if we include all the following CPP files in feature.cpp
src/pcl_ros/features/boundary.cpp
src/pcl_ros/features/fpfh.cpp
src/pcl_ros/features/fpfh_omp.cpp
src/pcl_ros/features/shot.cpp
src/pcl_ros/features/shot_omp.cpp
src/pcl_ros/features/moment_invariants.cpp
src/pcl_ros/features/normal_3d.cpp
src/pcl_ros/features/normal_3d_omp.cpp
src/pcl_ros/features/pfh.cpp
src/pcl_ros/features/principal_curvatures.cpp
src/pcl_ros/features/vfh.cpp
)
target_link_libraries (pcl_ros_features ${Boost_LIBRARIES} ${catkin_LIBRARIES} ${Eigen3_LIBRARIES} ${PCL_LIBRARIES})
add_dependencies(pcl_ros_features ${PROJECT_NAME}_gencfg)
class_loader_hide_library_symbols(pcl_ros_features)
## Declare the pcl_ros_filters library
add_library(pcl_ros_filters
src/pcl_ros/filters/extract_indices.cpp
src/pcl_ros/filters/filter.cpp
src/pcl_ros/filters/passthrough.cpp
src/pcl_ros/filters/project_inliers.cpp
src/pcl_ros/filters/radius_outlier_removal.cpp
src/pcl_ros/filters/statistical_outlier_removal.cpp
src/pcl_ros/filters/voxel_grid.cpp
src/pcl_ros/filters/crop_box.cpp
)
target_link_libraries(pcl_ros_filters pcl_ros_tf ${Boost_LIBRARIES} ${catkin_LIBRARIES} ${Eigen3_LIBRARIES} ${PCL_LIBRARIES})
add_dependencies(pcl_ros_filters ${PROJECT_NAME}_gencfg)
class_loader_hide_library_symbols(pcl_ros_filters)
## Declare the pcl_ros_segmentation library
add_library (pcl_ros_segmentation
src/pcl_ros/segmentation/extract_clusters.cpp
src/pcl_ros/segmentation/extract_polygonal_prism_data.cpp
src/pcl_ros/segmentation/sac_segmentation.cpp
src/pcl_ros/segmentation/segment_differences.cpp
src/pcl_ros/segmentation/segmentation.cpp
)
target_link_libraries(pcl_ros_segmentation pcl_ros_tf ${Boost_LIBRARIES} ${catkin_LIBRARIES} ${Eigen3_LIBRARIES} ${PCL_LIBRARIES})
add_dependencies(pcl_ros_segmentation ${PROJECT_NAME}_gencfg)
class_loader_hide_library_symbols(pcl_ros_segmentation)
## Declare the pcl_ros_surface library
add_library (pcl_ros_surface
src/pcl_ros/surface/surface.cpp
# Compilation is much faster if we include all the following CPP files in surface.cpp
src/pcl_ros/surface/convex_hull.cpp
src/pcl_ros/surface/moving_least_squares.cpp
)
target_link_libraries(pcl_ros_surface ${Boost_LIBRARIES} ${catkin_LIBRARIES} ${Eigen3_LIBRARIES} ${PCL_LIBRARIES})
add_dependencies(pcl_ros_surface ${PROJECT_NAME}_gencfg)
class_loader_hide_library_symbols(pcl_ros_surface)
## Tools
add_executable(pcd_to_pointcloud tools/pcd_to_pointcloud.cpp)
target_link_libraries(pcd_to_pointcloud ${Boost_LIBRARIES} ${catkin_LIBRARIES} ${Eigen3_LIBRARIES} ${PCL_LIBRARIES})
add_executable(pointcloud_to_pcd tools/pointcloud_to_pcd.cpp)
target_link_libraries(pointcloud_to_pcd ${Boost_LIBRARIES} ${catkin_LIBRARIES} ${Eigen3_LIBRARY_DIRS} ${PCL_LIBRARIES})
add_executable(bag_to_pcd tools/bag_to_pcd.cpp)
target_link_libraries(bag_to_pcd pcl_ros_tf ${Boost_LIBRARIES} ${catkin_LIBRARIES} ${Eigen3_LIBRARY_DIRS} ${PCL_LIBRARIES})
add_executable(convert_pcd_to_image tools/convert_pcd_to_image.cpp)
target_link_libraries(convert_pcd_to_image ${Boost_LIBRARIES} ${catkin_LIBRARIES} ${Eigen3_LIBRARIES} ${PCL_LIBRARIES})
add_executable(convert_pointcloud_to_image tools/convert_pointcloud_to_image.cpp)
target_link_libraries(convert_pointcloud_to_image ${Boost_LIBRARIES} ${catkin_LIBRARIES} ${Eigen3_LIBRARIES} ${PCL_LIBRARIES})
## Downloads
catkin_download(table_scene_lms400.pcd http://download.ros.org/data/pcl/table_scene_lms400.pcd
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/samples/data
MD5 546b5b4822fb1de21b0cf83d41ad6683
)
add_custom_target(download ALL DEPENDS download_extra_data)
#############
## Testing ##
#############
if(CATKIN_ENABLE_TESTING)
find_package(rostest REQUIRED)
add_rostest_gtest(test_tf_message_filter_pcl tests/test_tf_message_filter_pcl.launch src/test/test_tf_message_filter_pcl.cpp)
target_link_libraries(test_tf_message_filter_pcl ${catkin_LIBRARIES} ${GTEST_LIBRARIES})
add_rostest(samples/pcl_ros/features/sample_normal_3d.launch ARGS gui:=false)
add_rostest(samples/pcl_ros/filters/sample_statistical_outlier_removal.launch ARGS gui:=false)
add_rostest(samples/pcl_ros/filters/sample_voxel_grid.launch ARGS gui:=false)
add_rostest(samples/pcl_ros/segmentation/sample_extract_clusters.launch ARGS gui:=false)
add_rostest(samples/pcl_ros/surface/sample_convex_hull.launch ARGS gui:=false)
endif(CATKIN_ENABLE_TESTING)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})
install(
TARGETS
pcl_ros_tf
pcl_ros_io
pcl_ros_features
pcl_ros_filters
pcl_ros_surface
pcl_ros_segmentation
pcd_to_pointcloud
pointcloud_to_pcd
bag_to_pcd
convert_pcd_to_image
convert_pointcloud_to_image
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
install(DIRECTORY plugins samples
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
↧
error on pcl_viewer
Hi everyone,
I use rgbdslam v2 to build 3D map and I save the map to file .pcd format. When I use command pcl_viewer to read the file .pcd format, it says,
The viewer window provides interactive commands; for help, press 'h' or 'H' from within the window.
Loading quicksave.pcd [pcl::PCDReader::readHeader] No points to read.
I hope someone can help me solve it. Any suggestion is welcome.
Thanks in advance.
cheers.
jwlifly
↧
why does my package not enter my main loop when using rosrun?
I have written a few packages which should communicate with each other. However one of them seems to be malfunctioning entirely, this is the code at this moment.
#include "ros/ros.h"
#include "std_msgs/String.h"
#include
#include
#include
#include
int right_person;
ros::Publisher man;
void AmirCallback(const std_msgs::String::ConstPtr& msg)
{
std::cout << msg;
if(msg->data.c_str() == "yes"){
right_person = 1;
std::cout << "message received \n";
}
else{
right_person = 0;
}
}
void personcallback (const sensor_msgs::PointCloud2ConstPtr& input)
{
std::cout << "responding";
if(right_person ==1){
pcl::PCLPointCloud2 inputcloud;
pcl::PointCloud::Ptr cloud (new pcl::PointCloud);
// Convert to PCL data type
pcl_conversions::toPCL(*input, inputcloud);
pcl::fromPCLPointCloud2(inputcloud, *cloud);
Eigen::Vector4f c;
pcl::compute3DCentroid (*cloud, c);
if(c[0] < 2 && c[1]>-1 &&c[1]<1){
sensor_msgs::PointCloud2 output;
pcl::PCLPointCloud2* outputcloud = new pcl::PCLPointCloud2;
pcl::toPCLPointCloud2(*cloud, *outputcloud);
pcl_conversions::fromPCL(*outputcloud, output);
man.publish(output);
std::cout << "model centroid position = "<< c[0] << c[1] << c[2] << "\n";
std::cout << "model sent \n";
}
}
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "personchecker");
ros::NodeHandle n;
ros::Subscriber subamir = n.subscribe("/amirs_code", 1, AmirCallback);
ros::Subscriber sub = n.subscribe("/possible_humans", 1, personcallback);
man = n.advertise ("/right_person", 1);
std::cout << "here";
ros::spin ();
}
However when I run this code none of the calls to std::cout are printed. When I publish to either one of the subscribed topics, with rostopic pub or another file nothing happens. I have checked the cmakelists already and it is fine, there are no errors when using catkin_make and only this file has this problem. My other packages are fine.
Has anyone run into this problem before and if so what is the solution?
Thanks in advance!
↧
↧
Understanding the bytes in a pcl2 message
I am using python in order to publish pointclouds. Prior to this I'd like to run some segmentation using [python-pcl](https://github.com/strawlab/python-pcl) and colorize each cluster. Unfortunately, the only function that creates a pcl message from a numpy array does so without considering color (only x, y, z).
pcl2.create_cloud_xyz32(header, nx3_numpy_array)
Therefore, I want to create a ros message then tweak it manually to change the color of each point. Here is an example message:
header:
seq: 1535
stamp:
secs: 1524593497
nsecs: 322609179
frame_id: "gripper_depth_camera_rgb_optical_frame"
height: 480
width: 640
fields:
-
name: "x"
offset: 0
datatype: 7
count: 1
-
name: "y"
offset: 4
datatype: 7
count: 1
-
name: "z"
offset: 8
datatype: 7
count: 1
-
name: "rgb"
offset: 16
datatype: 7
count: 1
is_bigendian: False
point_step: 32
row_step: 20480
data: [0, 0, 192, 127, 0, 0, 192, 127, 0, 0, 192, 127, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
It is easy to understand why x, y and z require 4 bytes each (float 32)
But why does rgb come at 16 and not 12? following the logic, z also needs 4 bytes, and the next free spot is at an offset of 12 and not 16.
Also why does rgb need 16 bytes? (point_step is 32 so one point requires 32 bytes from which 16 are for rgb). The color values themselves need only one byte each so this is confusing. Also, if we say the are float32 values, 16 bytes means 4 values, is the fourth value the transparency (RGBA?)
Here is an example from an XYZ only pointcloud where my understanding fits:
header:
seq: 5
stamp:
secs: 1524583199
nsecs: 372246980
frame_id: "gripper_depth_camera_rgb_optical_frame"
height: 1
width: 231
fields:
-
name: "x"
offset: 0
datatype: 7
count: 1
-
name: "y"
offset: 4
datatype: 7
count: 1
-
name: "z"
offset: 8
datatype: 7
count: 1
is_bigendian: False
point_step: 12
row_step: 2772
data: [125, 207, 94, 190, 220, 24, 98, 190, 254, 67, 60, 63, 69, 231, 92, 190, 6
↧
pcl contains x y and z values as nan !!
hi guys, i am doing blob detection and for my x y and z values i am using point cloud, but most of the time the values of x y and z in point cloud is Nan !
though the pixel values of x and y which i am getting from my blob is never Nan (obviously), so these pixel values of x and y i am feeding to point cloud to calculate x y and z resp.
can anyone tell me how can i retrieve continuous x y and z values from my point cloud !!! below is my code .
void getXYZ(int x, int y)
{
int arrayPosition = y * my_pcl.row_step + x * my_pcl.point_step;
int arrayPosX = arrayPosition + my_pcl.fields[0].offset; // X has an offset of 0
int arrayPosY = arrayPosition + my_pcl.fields[1].offset; // Y has an offset of 4
int arrayPosZ = arrayPosition + my_pcl.fields[2].offset; // Z has an offset of 8
float X;
float Y;
float Z;
memcpy(&X, &my_pcl.data[arrayPosX], sizeof(float));
memcpy(&Y, &my_pcl.data[arrayPosY], sizeof(float));
memcpy(&Z, &my_pcl.data[arrayPosZ], sizeof(float));
geometry_msgs::Point p;
// put data into the point p
p.x = X;
p.y = Y;
p.z = Z;
std::cout << "x :" << p.x << "y :" << p.y << "z :" << p.z << std::endl;
}
where int x and int y are my pixel values i am giving in my main programme from blob..
thanks guys
↧
IDE for ROS (kinetic) code debugging
Hello All,
Could anyone suggest me, good IDE to use for C++ code debugging in ROS environment?
Currently, I am working with ROS (Kinetic), PCL and OPENCV Libraries.
I would appreciate your recommendations in this regards. Thanks in Advcance.
↧
static_transform_publisher acting weird when giving tranlation and rotation both
I am playing a rosbag containing pointclouds on ros kinetic.
I need to set the tf so that it is at a decent location to the [Panda robot](https://frankaemika.github.io/) for some task.
The following is the relevant line from my launch file that set the static transform
When running the code like this (with translation and rotation given) the result is:
At time 1527473959.781
- Translation: [0.397, -1.842, 0.671]
- Rotation: in Quaternion [-0.815, -0.057, 0.082, 0.571]
in RPY (radian) [-1.914, 0.068, 0.188]
in RPY (degree) [-109.640, 3.898, 10.784]
When just rotation or translation is given it works fine.
Any help is greatly appreciated.
Thank you in advance.
↧
↧
ply parser problem with ROS kinetic
Hi all,
I am trying to migrate my system from Ubuntu 14.04 and ROS indigo to Ubuntu 16.04 and ROS kinetic.
Unfortunately, I can not load any ply files that were generated in Ubuntu 14.04 and ROS indigo.
my code:
pcl::PointCloud::Ptr cloud(new pcl::PointCloud());
pcl::PLYReader Reader;
Reader.read(ground_truth_filename_ply, *cloud);
The file that I could use in Ubuntu 14.04 produces a segmentation fault in Ubuntu 16.04 and ROS kinetic.
I tried load the .ply file in Meshlab and export it again, but it still could not load it.
With the newly exported .ply file in Ubuntu 16.04 I get the following error:
[pcl::PLYReader] heartDepthMap_0.ply:12: parse error
[pcl::PLYReader::read] problem parsing header!
[pcl::PLYReader::read] problem parsing header!
If I convert a valid .pcd file to ply with pcl-tools' pcl_pcd2ply command in Ubuntu 16.04 and try to load it as above, I get the following error:
[pcl::PLYReader] heartDepthMap_0.ply:22: property 'float32 focal' of element 'camera' is not handled
[pcl::PLYReader] heartDepthMap_0.ply:23: property 'float32 scalex' of element 'camera' is not handled
[pcl::PLYReader] heartDepthMap_0.ply:24: property 'float32 scaley' of element 'camera' is not handled
[pcl::PLYReader] heartDepthMap_0.ply:25: property 'float32 centerx' of element 'camera' is not handled
[pcl::PLYReader] heartDepthMap_0.ply:26: property 'float32 centery' of element 'camera' is not handled
[pcl::PLYReader] heartDepthMap_0.ply:29: property 'float32 k1' of element 'camera' is not handled
[pcl::PLYReader] heartDepthMap_0.ply:30: property 'float32 k2' of element 'camera' is not handled
[pcl::PLYReader] heartDepthMap_0.ply:31: parse error
[pcl::PLYReader::read] problem parsing header!
[pcl::PLYReader::read] problem parsing header!
Thus, I have the following questions:
What changed in pcl and the library can not load .ply files?
Why can I load a .pcd file, but if I use pcl_pcd2ply the generated .ply file can not be parsed by pcl?
Is this a ROS related issue?
Did anyone have the same problem?
↧
Create collision object from cylinder segmented using pcl::SACSegmentation
Based on [this](https://github.com/PointCloudLibrary/pcl/blob/master/sample_consensus/include/pcl/sample_consensus/impl/sac_model_cylinder.hpp#L113) I get the radius, a point on the centerline of the cylinder and a direction vector for the centerline.
Now the location of the collision object is coming correctly but the orientation is not.
I am not entirely certain what the dir vector represents?
I tried various ways to get it to work but none of them seem to work.
Any help greatly appreciated.
Thank you
↧
Convert filtered PointCloud2 to Image
Hi everyone,
I'm looking for a way to convert a filtered PointCloud2 from an RGBD camera (i.e. background removed, limited range etc.) back to an image as it might have be seen by the camera. The points that have been removed shall be black in the resulting image. I know that I need the camera_info and the exact pose of the camera for this purpose. I do of course have both.
Is there already a node or (even better) nodelet that can do that?
Thanks a lot
↧