-
Notifications
You must be signed in to change notification settings - Fork 20
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
Migrate to tf2 #93
Migrate to tf2 #93
Conversation
- Add tf2 dependencies instead of tf. - Update yp-spur requirements (same as in package.xml). - Set compiler to cpp14. - Replace calls to tf functions with their tf2 equivalent.
[45] FAILED on noetic
[45] FAILED on melodic
|
[45] FAILED on kinetic
|
[46] PASSED on melodicAll tests passed
[46] PASSED on noeticAll tests passed
[46] PASSED on kineticAll tests passed
|
src/ypspur_ros.cpp
Outdated
for (unsigned int i = 0; i < joints_.size(); i++) | ||
{ | ||
joint_trans[i].transform.rotation = | ||
tf::createQuaternionMsgFromYaw(joint.position[i]); | ||
quat_tf.setRPY(0, 0, joint.position[i]); |
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.
quat_tf.setRPY(0, 0, joint.position[i]); | |
const tf2::Quaternion quat_tf(0, 0, joint.position[i]); |
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.
This method seems to be deprecated http://docs.ros.org/en/noetic/api/tf2/html/classtf2_1_1Quaternion.html#a3e763411f10c67bd23bbfcc1b880793f. We can use this one though: http://docs.ros.org/en/noetic/api/tf2/html/classtf2_1_1Quaternion.html#ae23b2f32c74adb17fceb71187346f3af
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.
trans.transform.rotation = tf2::toMsg(tf2::Quaternion(tf2::Vector3(0, 0, 1), msg->position[i]));
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.
Done in f8fbe7e
src/ypspur_ros.cpp
Outdated
joint_trans[i].transform.rotation = | ||
tf::createQuaternionMsgFromYaw(joint.position[i]); | ||
quat_tf.setRPY(0, 0, joint.position[i]); | ||
joint_trans[i].transform.rotation = tf2::toMsg(quat_tf); |
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.
or
joint_trans[i].transform.rotation = tf2::toMsg(quat_tf); | |
joint_trans[i].transform.rotation = tf2::toMsg(tf2::Quaternion(0, 0, joint.position[i])); |
would be more simple.
[47] PASSED on noeticAll tests passed
|
[47] PASSED on kineticAll tests passed
|
[47] PASSED on melodicAll tests passed
|
src/ypspur_ros.cpp
Outdated
@@ -88,6 +88,7 @@ class YpspurRosNode | |||
tf2_ros::Buffer tf_buffer_; | |||
tf2_ros::TransformListener tf_listener_; | |||
tf2_ros::TransformBroadcaster tf_broadcaster_; | |||
tf2::Vector3 z_axis_; |
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.
Could it be const?
- Use const.
[48] PASSED on melodicAll tests passed
[48] PASSED on noeticAll tests passed
|
[48] PASSED on kineticAll tests passed
|
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.
LGTM
This PR replaces calls to
tf
functions with theirtf2
equivalent.