-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transformed attitude to inertial frame for Pose #195
Conversation
@@ -100,7 +100,16 @@ class LocalPositionPlugin : public MavRosPlugin { | |||
*/ | |||
tf::Transform transform; | |||
transform.setOrigin(tf::Vector3(pos_ned.y, pos_ned.x, -pos_ned.z)); | |||
transform.setRotation(uas->get_attitude_orientation()); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a small comment here to explain what you do
q_body.header.stamp = uas->synchronise_stamp(pos_ned.time_boot_ms); | ||
geometry_msgs::QuaternionStamped q_inertial; | ||
tf::TransformListener listener; | ||
listener.transformQuaternion(child_frame_id, ros::Time::now(), q_body, fixed_frame_id, q_inertial); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use ros::time::now()?
@@ -75,10 +80,11 @@ class LocalPositionPlugin : public MavRosPlugin { | |||
|
|||
ros::NodeHandle pos_nh; | |||
ros::Publisher local_position; | |||
tf::TransformBroadcaster tf_broadcaster; | |||
boost::shared_ptr<tf::TransformBroadcaster> tf_broadcaster; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is required to make it pointers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tonybaltovski You can revert this please. And make listener normal too, without pointer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not required.
@mhkabir Just note: as i understand after publish Message::Ptr object should not be used again. |
@tonybaltovski Many thanks. Thanks for the formatting fix on the visualisation plugin. My bad, haha. |
@mhkabir @tonybaltovski Now looks good to merge. But need test. @mhkabir Don't see rviz config attachment. |
Hmm, so this won't even startup :
Looks like we are looking for the tf even before its published the first time. Workarounds? |
So for the to body -> world, I think we'll need to do it with a matrix. Generalise it in libmavros. |
Seems that tf transformation for |
But local_origin transform is generated by the plugin itself (from LOCAL_POSITION_NED) |
q.header.frame_id = child_frame_id; | ||
q.header.stamp = uas->synchronise_stamp(pos_ned.time_boot_ms); | ||
tf_listener.transformQuaternion(frame_id, q, q); | ||
|
||
tf::Transform transform; | ||
transform.setOrigin(tf::Vector3(pos_ned.y, pos_ned.x, -pos_ned.z)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be transform.setOrigin(tf::Vector3(pos_ned.x, -pos_ned.y, -pos_ned.z));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Local NED is ground frame and this conversion is according to #49
Isn't the attitude relative to the body frame assuming it has no rotation? The current tf is world -> fcu and then we would need fcu -> fcu_att? |
I think that's it. |
I think this may be solved with #208 . |
Using TF, this isn't working. Closing for now. |
Force all structs to be packed
This is for #193
Needs to be tested. Testers welcome. Anyone with a PX4Flow or other accurate position estimator (like VICON) can easily test this.
I'll attach my Rviz config file for the visualization plugin testing.