[ros-users] transformPointCloud
sabrinakliegl at innok.de
sabrinakliegl at innok.de
Tue Apr 5 16:15:52 UTC 2011
Hallo David,
you should instantiate the TransformListener outside the callback:
tf::TransformListener *tf_listener;
void transformCallback(const sensor_msgs::PointCloud2::ConstPtr& pcl_in)
{
ROS_INFO("Cloud received");
sensor_msgs::PointCloud2 pcl_out;
tf_listener->waitForTransform("/world", (*pcl_in).header.frame_id,
(*pcl_in).header.stamp, ros::Duration(5.0)); //return value always
false!
pcl_ros::transformPointCloud("/world", *pcl_in, pcl_out, *tf_listener);
pc2_publisher.publish(pcl_out);
}
int main()
{
...
tf_listener = new TransformListener();
...
ros.spin();
delete tf_listener;
return 0;
}
Zitat von David Fischinger <david.fischinger at gmail.com>:
> Hallo Dejan,
>
> thanks for the reply.
> But even if I use data directly from a Kinect, the problem still occurs:
>
> [ERROR] [1302000428.987287106]: You requested a transform that is
> 5.705 seconds in the past,
> but the tf buffer only has a history of 4.933 seconds.
>
> where the first second value (5.705) is a bit higher and the second
> (4.933) a bit lower than ros::Duration(5.0)) used in
> waitForTransform(). Changing the duration value does not solve the
> problem.
>
> Greetings to Munich!
> David
>
>
>
>
>
> 2011/4/4 Dejan Pangercic <dejan.pangercic at gmail.com>:
>> Hi David,
>>
>> to me it seems that you are playing back the bag file right?
>> For that to work you need to a) set the "use_sim_time" parameter to
>> true and b) play the bag with the "--clock" argument:
>> "rosbag play mybag.bag --clock"
>> See also:
>> http://www.ros.org/wiki/image_geometry/Tutorials/ProjectTfFrameToImage#Trying_it_out
>>
>> cheers, D.
>> On Mon, Apr 4, 2011 at 9:03 PM, David Fischinger
>> <david.fischinger at gmail.com> wrote:
>>> Hallo everyone!
>>>
>>> I have a problem transforming PointCloud2 data. Could somebody tell
>>> me, if I make a fundamental error in using these functions?
>>>
>>>
>>> void transformCallback(const sensor_msgs::PointCloud2::ConstPtr& pcl_in)
>>> {
>>> ROS_INFO("Cloud received");
>>> sensor_msgs::PointCloud2 pcl_out;
>>> tf::TransformListener tf_listener;
>>>
>>> tf_listener.waitForTransform("/world", (*pcl_in).header.frame_id,
>>> (*pcl_in).header.stamp, ros::Duration(5.0)); //return value always
>>> false!
>>> pcl_ros::transformPointCloud("/world", *pcl_in, pcl_out, tf_listener);
>>> pc2_publisher.publish(pcl_out);
>>> }
>>>
>>>
>>>
>>> "rosrun tf tf_echo /target_frame /source_frame" gives me results, but
>>> transformPointCloud() results in error messages like:
>>>
>>> [ERROR] [1301916374.406336425]: You requested a transform that is
>>> 244270.678 seconds in the past,
>>> but the tf buffer only has a history of 243913.670 seconds.
>>> When trying to transform between /openni_depth_optical_frame and /world.
>>>
>>> Thanks for any help.
>>>
>>> Regards
>>> David
>>> _______________________________________________
>>> ros-users mailing list
>>> ros-users at code.ros.org
>>> https://code.ros.org/mailman/listinfo/ros-users
>>>
>>
>>
>>
>> --
>> MSc. Dejan Pangercic
>> PhD Student/Researcher
>> Intelligent Autonomous Systems Group
>> Technische Universität München
>> Telephone: +49 (89) 289-26908
>> E-Mail: dejan.pangercic at cs.tum.edu
>> WWW: http://ias.cs.tum.edu/people/pangercic
>> _______________________________________________
>> ros-users mailing list
>> ros-users at code.ros.org
>> https://code.ros.org/mailman/listinfo/ros-users
>>
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
More information about the ros-users
mailing list