88#ifndef VISBOX_PACKAGES_COMMON_UTILS_UTIL_LIB_INCLUDE_VB_UTIL_LIB_TRANSFORMER_H_
99#define VISBOX_PACKAGES_COMMON_UTILS_UTIL_LIB_INCLUDE_VB_UTIL_LIB_TRANSFORMER_H_
1010
11+ #include < string>
12+
1113#include < ros/ros.h>
1214#include < tf2/LinearMath/Quaternion.h>
1315#include < tf2/LinearMath/Transform.h>
1416#include < tf2_ros/transform_broadcaster.h>
1517#include < tf2_ros/transform_listener.h>
1618#include < geometry_msgs/Quaternion.h>
1719
20+ #include < Eigen/Geometry>
21+ #include < Eigen/StdVector>
22+
1823namespace am
1924{
2025#define DEFAULT_TRANSFORM_WAIT 0.07
@@ -27,21 +32,26 @@ class Transformer
2732
2833 tf2_ros::Buffer& tfBuffer ();
2934
30- // Used to fetch the latest transform between two frames
31- // Return true if it works and false otherwise
35+ // / Used to fetch the latest transform between two frames
36+ // / Return true if it works and false otherwise
3237 bool getTransform (const std::string target, const std::string source,
3338 geometry_msgs::TransformStamped& transform, double wait = -1.0 , bool debug = false );
3439
35- // Used to fetch the latest transform between two frames
36- // Checks the initialized flag and will not call the lookup if it is true.
37- // Otherwise it attempts to lookup the transform and set the initialized flag appropriately.
38- // Return true if the transform is valid and false otherwise
40+ // / Used to fetch the latest transform between two frames
41+ // / Checks the initialized flag and will not call the lookup if it is true.
42+ // / Otherwise it attempts to lookup the transform and set the initialized flag appropriately.
43+ // / Return true if the transform is valid and false otherwise
3944 bool getTransform (bool & initialized_flag, const std::string target, const std::string source,
4045 geometry_msgs::TransformStamped& transform, double wait = -1.0 , bool debug = false );
4146
42- // Used to rotate the "orientation" coordinates by the "rotation" coordinates
47+ // / Used to rotate the "orientation" coordinates by the "rotation" coordinates
4348 void rotateOrientation (geometry_msgs:: Quaternion& orientation, geometry_msgs:: Quaternion& rotation, bool debug = false );
4449
50+ // / Used to rotate a vector from source frame to target frame.
51+ // / Returns false if failed,
52+ bool rotateVector (const std::string target_frame, const std::string source_frame,
53+ Eigen::Vector3d& target_vector, const Eigen::Vector3d& source_vector, bool debug = false );
54+
4555private:
4656 // transform buffer management. Use factory creation method to auto create the tfBuffer
4757 // later make this a static to save space and make more efficient
0 commit comments