Go to the documentation of this file.
34 #define _USE_MATH_DEFINES
57 int main(
int argc,
char ** argv)
63 if (argc < 3 || argc > 4)
65 printf(
"Usage: tf_echo source_frame target_frame [echo_rate]\n\n");
66 printf(
"This will echo the transform from the coordinate frame of the source_frame\n");
67 printf(
"to the coordinate frame of the target_frame. \n");
68 printf(
"Note: This is the transform to get data from target_frame into the source_frame.\n");
69 printf(
"Default echo rate is 1 if echo_rate is not given.\n");
79 rate_hz = atof(argv[3]);
84 nh.
param(
"rate", rate_hz, 1.0);
88 std::cerr <<
"Echo rate must be > 0.0\n";
94 if (nh.
getParam(
"precision", precision))
98 std::cerr <<
"Precision must be > 0\n";
101 printf(
"Precision default value was overriden, new value: %d\n", precision);
108 std::string source_frameid = std::string(argv[1]);
109 std::string target_frameid = std::string(argv[2]);
123 std::cout.precision(precision);
124 std::cout.setf(std::ios::fixed,std::ios::floatfield);
125 std::cout <<
"At time " << echo_transform.
stamp_.
toSec() << std::endl;
126 double yaw, pitch, roll;
129 tf::Vector3 v = echo_transform.
getOrigin();
130 std::cout <<
"- Translation: [" << v.getX() <<
", " << v.getY() <<
", " << v.getZ() <<
"]" << std::endl;
131 std::cout <<
"- Rotation: in Quaternion [" << q.getX() <<
", " << q.getY() <<
", "
132 << q.getZ() <<
", " << q.
getW() <<
"]" << std::endl
133 <<
" in RPY (radian) [" << roll <<
", " << pitch <<
", " << yaw <<
"]" << std::endl
134 <<
" in RPY (degree) [" << roll*180.0/M_PI <<
", " << pitch*180.0/M_PI <<
", " << yaw*180.0/M_PI <<
"]" << std::endl;
141 std::cout <<
"Exception thrown:" << ex.what()<< std::endl;
142 std::cout <<
"The current list of frames is:" <<std::endl;
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
void getRPY(tfScalar &roll, tfScalar &pitch, tfScalar &yaw, unsigned int solution_number=1) const
Get the matrix represented as roll pitch and yaw about fixed axes XYZ.
int main(int argc, char **argv)
bool getParam(const std::string &key, bool &b) const
const TFSIMD_FORCE_INLINE tfScalar & getW() const
T param(const std::string ¶m_name, const T &default_val) const
The Quaternion implements quaternion to perform linear algebra rotations in combination with Matrix3x...
tf
Author(s): Tully Foote, Eitan Marder-Eppstein, Wim Meeussen
autogenerated on Sat Aug 19 2023 02:38:08