transform (x,y,z) coordinate from kinect to /map frame using tf
Hi, I'm tracking an object using a kinect and trying to publish the tf transform of that object in a "/map frame. I'm able to return the object's x, y and depth data using OpenCV. However, I'm struggling with the tf stuff. I've written a function which is meant to update the transform
void updatetransform(double x, double y, double z)
{
r = -1.5708;
p = 0;
y = -3.1415;
static tf::TransformBroadcaster br;
transform.setOrigin(tf::Vector3(x, y, z));
quaternion.setRPY(r,p,y); //where r p y are fixed
transform.setRotation(quaternion);
br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "kinect2_ir_optical_frame","drone/base_link"));
ROS_INFO("Sent Drone Transform at %f %f %f", x, y, z);
}
and in my launch file
<launch>
<node name = "Drone_Detector" pkg="detector" type="detect_drone" output="screen" />
<node pkg="tf" type="static_transform_publisher" name="baselink" args="0 0 1 -1.5708 0 -1.5708 /map /kinect2_link 50" />
</launch>
But when I run Rviz, using "/map" as a fixed frame, the drone/base_link tf isn't shown in the screen. I've attached a picture of what it looks like at this link. My x,y and depth values are okay from what the kinect but the transform is wrong. Am I doing something wrong here?
Also here's my tf_tree which looks about right to me. Link here