Hey @dornhege and @piyushk,
Thanks for taking the time to reply to my questions! However, I am still getting some errors so I am just going to post a little bit of my code here and maybe you can help me fix the problems.
So my global variables for the transform are:
tf::StampedTransform transform;
boost::share_ptr<tf::TransformListener> transform_ptr;
Then I have my
int main (int argc, char** argv)
{
ros::init (argc, argv, "SitAssessManager");
transform_ptr.reset(new tf::TransformListener);
ros::NodeHandle n;
try{
transform_ptr->waitForTransform("/base_link","/camera_depth_optical_frame",ros::Time::now(),ros::Duration(3));
transform_ptr->lookupTransform("/base_link", "/camera_depth_optical_frame",ros::Time::now(), transform);
}
catch (tf::TransformException ex){
ROS_WARN("Base to camera transform unavailable %s", ex.what());
}
while(n.ok())
{
ros::spinOnce();
loop_rate.sleep();
}
Where in my Kinect frames callback I use a vector3f point and use transform to go from the frame to frame just by: t_point = transform*point;
Here is the compiling error:
In function ‘void callback(const PointCloud2ConstPtr&)’:
/martin/ros_workspace/SituationAssessmentManager/src/H20.cpp:559:13: error: reference to ‘transform’ is ambiguous
/martin/ros_workspace/SituationAssessmentManager/src/H20.cpp:80:22: error: candidates are: tf::StampedTransform transform
/usr/include/c++/4.6/bits/stl_algo.h:4907:5: error: template<class _IIter1, class _IIter2, class _OIter, class _BinaryOperation> _OIter std::transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation)
/usr/include/c++/4.6/bits/stl_algo.h:4871:5: error: template<class _IIter, class _OIter, class _UnaryOperation> _OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation)
/martin/ros_workspace/SituationAssessmentManager/src/H20.cpp:718:96: error: reference to ‘transform’ is ambiguous
/martin/ros_workspace/SituationAssessmentManager/src/H20.cpp:80:22: error: candidates are: tf::StampedTransform transform
So the error shows up from both calls to 'transform', once in the callback and once in main
Thanks again!
Kind Regards,
Martin