Skip to content

Instantly share code, notes, and snippets.

@davetcoleman
Created May 4, 2015 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davetcoleman/e2411ea7b5a0c3750020 to your computer and use it in GitHub Desktop.
Save davetcoleman/e2411ea7b5a0c3750020 to your computer and use it in GitHub Desktop.
Eigen::Affine3d RvizVisualTools::convertXYZRPY(std::vector<double> transform6)
{
if (transform6.size() != 6)
{
ROS_ERROR_STREAM_NAMED("rviz_visual_tools","Incorrect number of variables passed for 6-size transform");
throw;
}
// Eigen::AngleAxisd roll_angle (transform6[3], Eigen::Vector3d::UnitZ());
// Eigen::AngleAxisd pitch_angle(transform6[4], Eigen::Vector3d::UnitX());
// Eigen::AngleAxisd yaw_angle (transform6[5], Eigen::Vector3d::UnitY());
Eigen::AngleAxisd roll_angle (transform6[3], Eigen::Vector3d::UnitX());
Eigen::AngleAxisd pitch_angle(transform6[4], Eigen::Vector3d::UnitY());
Eigen::AngleAxisd yaw_angle (transform6[5], Eigen::Vector3d::UnitZ());
Eigen::Quaternion<double> quaternion = roll_angle * yaw_angle * pitch_angle;
return Eigen::Translation3d(transform6[0], transform6[1], transform6[2]) * quaternion;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment