tu-darmstadt-ros-pkg / hector_quadrotor

hector_quadrotor contains packages related to modeling, control and simulation of quadrotor UAV systems.
Other
381 stars 276 forks source link

Confusion about the transformation from camera frame to body frame #52

Closed libing64 closed 8 years ago

libing64 commented 8 years ago

I want to transform the vector from camera frame to body frame, so I listen the transformation bwtween "/base_link" and "/downward_cam_link" and covert it to rotation matrix. R_cam2body = 0 0 1 0 1 0 -1 0 0

Since the x-y-z axis of camera(downward) frame is right-back-down, then the axis of body frame is back-down-left, it is very strange. Somewhere is wrong? Please give me some advice.

tf::StampedTransform transform;
            try{
            //targe_frame <- source frame
                listener.lookupTransform("/base_link", "/downward_cam_link",
                           ros::Time(0), transform);
            }
                catch (tf::TransformException &ex) {
                ROS_ERROR("%s",ex.what());
                continue;
            }
            t_cam2body(0) = transform.getOrigin().x();
            t_cam2body(1) = transform.getOrigin().y();
            t_cam2body(2) = transform.getOrigin().z();
            Quaterniond qq;
            qq.w() = transform.getRotation().w();
            qq.x() = transform.getRotation().x();
            qq.y() = transform.getRotation().y();
            qq.z() = transform.getRotation().z();
            R_cam2body = quaternion2mat(qq);
libing64 commented 8 years ago

I have solved this problem, the camera frame should be "downward_cam_optical_frame", but not "downward_cam_frame". frame