tf_listener error transform.tf::Transform::getOrigin does not have class type
Hello, I used the "Writing a tf listener (C++)" tutorial and Publishing Sensor Streams Over ROS tutorial and I created a sensor_msgs/pointcloud msg after listening to tfs... and the my code is shown bellow:
#include <ros/ros.h>
#include <tf/transform_listener.h>
//#include <turtlesim/Velocity.h>
#include <geometry_msgs/Twist.h>
#include <turtlesim/Spawn.h>
#include "sensor_msgs/PointCloud.h"
#include "tf/message_filter.h"
#include "laser_geometry/laser_geometry.h"
int main(int argc, char** argv){
ros::init(argc, argv, "my_tf_listener");
ros::NodeHandle node;
//ros::service::waitForService("spawn");// ##
//ros::ServiceClient add_turtle = node.serviceClient<turtlesim::Spawn>("spawn"); //##
//turtlesim::Spawn srv; // ##
//add_turtle.call(srv); // ##
ros::Publisher cloud_pub = node.advertise<sensor_msgs::PointCloud>("cloud", 50);
unsigned int num_points = 100;
tf::TransformListener listener;
int count = 0;
ros::Rate rate(10.0);
sensor_msgs::PointCloud cloud;
while (node.ok()){
tf::StampedTransform transform;
try{
listener.lookupTransform("/obstacle/right_up_corner", "/base_link",ros::Time(0), transform);
cloud.header.stamp = ros::Time::now();
cloud.header.frame_id = "sensor_frame";
cloud.points.resize(num_points);
//we'll also add an intensity channel to the cloud
cloud.channels.resize(1);
cloud.channels[0].name = "intensities";
cloud.channels[0].values.resize(num_points);
//cloud.points.x = transform.getOrigin.x();
//cloud.points.y = transform.getOrigin.y();
//cloud.points.z = transform.getOrigin.z();
// generate some fake data for our point cloud
for(unsigned int i = 0; i < num_points; ++i){
cloud.points[i].x =transform.getOrigin.x();// 1 + count;
cloud.points[i].y =transform.getOrigin.y();// 2 + count;
cloud.points[i].z =transform.getOrigin.z();// 3 + count;
cloud.channels[0].values[i] = 100 + count;//#
}
cloud_pub.publish(cloud);
++count;
}
catch (tf::TransformException ex){
ROS_ERROR("%s",ex.what());
}
rate.sleep();
}
return 0;
};
I got the following error
transform.tf::Transform::getOrigin’ does not have class type
What is the error in this code ?