Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions vortex_utils_ros/include/vortex/utils/ros/ros_conversions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <geometry_msgs/msg/pose_stamped.hpp>
#include <geometry_msgs/msg/pose_with_covariance.hpp>
#include <geometry_msgs/msg/pose_with_covariance_stamped.hpp>
#include <geometry_msgs/msg/twist_with_covariance_stamped.hpp>
#include <vortex_msgs/msg/landmark_array.hpp>
#include <vortex_msgs/msg/operation_mode.hpp>

Expand Down Expand Up @@ -201,6 +202,25 @@ inline std::vector<vortex::utils::types::Pose> ros_to_pose_vec(
return poses;
}

/**
* @brief Converts a ROS geometry_msgs::msg::TwistWithCovarianceStamped to an
* internal Twist type.
* @param twist_msg geometry_msgs::msg::TwistWithCovarianceStamped
* @return vortex::utils::types::Twist Internal twist representation
*/
inline vortex::utils::types::Twist ros_twist_cov_msg_to_twist(
const geometry_msgs::msg::TwistWithCovarianceStamped& twist_msg) {
const auto& t = twist_msg.twist.twist;
return vortex::utils::types::Twist{
.u = t.linear.x,
.v = t.linear.y,
.w = t.linear.z,
.p = t.angular.x,
.q = t.angular.y,
.r = t.angular.z,
};
Comment on lines +213 to +221
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy paster spotted

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤡

}

/**
* @brief Converts a ROS vortex_msgs::msg::OperationMode to an internal Mode
* enum.
Expand Down
Loading