Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 171

Im trying to transform a pointcloud (rotation along z) using the following code. however i get an error with respect to the data types used in the transformPoinCloud() method. What am I doing wrong here or is there a simpler method?

$
0
0
#include #include #include #include void callback(const sensor_msgs::PointCloud2ConstPtr &cloud_msg) { ROS_INFO("Message recieved:"); //msg to c string Eigen::Matrix4f transform_1 = Eigen::Matrix4f::Identity(); float theta = M_PI/18; // The angle of rotation in radians transform_1 (0,0) = cos (theta); transform_1 (0,1) = -sin(theta); transform_1 (1,0) = sin (theta); transform_1 (1,1) = cos (theta); printf ("Method #1: using a Matrix4f\n"); std::cout << transform_1 << std::endl; sensor_msgs::PointCloud2 op_cloud; pcl_ros::transformPointCloud(transform_1,*cloud_msg,op_cloud); } int main (int argc, char **argv) { ros::init(argc, argv, "cloud_trfm"); ros::NodeHandle nh; ros::Subscriber sub = nh.subscribe("/velodyne_points",1,callback); //topic name, buffer size untill node can read, callback fn ros::spin(); }

Viewing all articles
Browse latest Browse all 171

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>