|
12 | 12 | // See the License for the specific language governing permissions and
|
13 | 13 | // limitations under the License.
|
14 | 14 |
|
| 15 | +/** |
| 16 | +@file |
| 17 | +
|
| 18 | +Conversions for ROS's geometry_msgs types for Drake and Eigen types that Drake |
| 19 | +uses. |
| 20 | +
|
| 21 | +### Type Suffixes |
| 22 | +
|
| 23 | +Note that quantities like `Eigen::Vector3d`, `Eigen::Isometry3d`, |
| 24 | +`drake::math::RigidTransformd`, etc. all have the `d` suffix to denote |
| 25 | +templating on `double`. |
| 26 | +
|
| 27 | +For simplicity, we strip these suffixes from the names in the conversion |
| 28 | +functions. |
| 29 | +
|
| 30 | +### Spatial Vectors |
| 31 | +
|
| 32 | +All 6d spatial vectors are ordered by [rotational; translational], per |
| 33 | +ttps://drake.mit.edu/doxygen_cxx/group__multibody__spatial__vectors.html |
| 34 | +
|
| 35 | +### Isometry3 Elements |
| 36 | +
|
| 37 | +All Isometry3<> conversion methods actually use RigidTransform as an |
| 38 | +intermediate. This means that we are restricted to SE(3), or more specifically, |
| 39 | +rotations are constrained to be in SO(3), not just O(3), so it is not to |
| 40 | +express mirroring in Isometry3<> results (even though the type is capable of |
| 41 | +expressing it). |
| 42 | +*/ |
| 43 | + |
15 | 44 | #pragma once
|
16 | 45 |
|
17 | 46 | #include <Eigen/Geometry>
|
|
28 | 57 |
|
29 | 58 | namespace drake_ros_core {
|
30 | 59 |
|
31 |
| -Eigen::Vector3d RosPointToVector3d(const geometry_msgs::msg::Point& point); |
| 60 | +// Vector / Translation. |
| 61 | + |
| 62 | +Eigen::Vector3d RosPointToVector3(const geometry_msgs::msg::Point& point); |
| 63 | + |
| 64 | +geometry_msgs::msg::Point Vector3ToRosPoint(const Eigen::Vector3d& point); |
| 65 | + |
| 66 | +Eigen::Vector3d RosVector3ToVector3(const geometry_msgs::msg::Vector3& point); |
32 | 67 |
|
33 |
| -geometry_msgs::msg::Point Vector3dToRosPoint(const Eigen::Vector3d& point); |
| 68 | +geometry_msgs::msg::Vector3 Vector3ToRosVector3(const Eigen::Vector3d& point); |
34 | 69 |
|
35 |
| -Eigen::Quaternion<double> RosQuatToQuat( |
| 70 | +// Orientation. |
| 71 | + |
| 72 | +Eigen::Quaternion<double> RosQuaternionToQuaternion( |
36 | 73 | const geometry_msgs::msg::Quaternion& quat);
|
37 | 74 |
|
38 |
| -geometry_msgs::msg::Quaternion QuatToRosQuat( |
| 75 | +geometry_msgs::msg::Quaternion QuaternionToRosQuaternion( |
39 | 76 | const Eigen::Quaternion<double>& quat);
|
40 | 77 |
|
41 |
| -Eigen::Isometry3d RosPoseToIsometry3d(const geometry_msgs::msg::Pose& pose); |
| 78 | +drake::math::RotationMatrixd RosQuaternionToRotationMatrix( |
| 79 | + const geometry_msgs::msg::Quaternion& quat); |
| 80 | + |
| 81 | +geometry_msgs::msg::Quaternion RotationMatrixToRosQuaternion( |
| 82 | + const drake::math::RotationMatrixd& rotation); |
42 | 83 |
|
43 |
| -geometry_msgs::msg::Pose Isometry3dToRosPose(const Eigen::Isometry3d& isometry); |
| 84 | +// Pose. |
44 | 85 |
|
45 | 86 | drake::math::RigidTransformd RosPoseToRigidTransform(
|
46 | 87 | const geometry_msgs::msg::Pose& pose);
|
47 | 88 |
|
48 | 89 | geometry_msgs::msg::Pose RigidTransformToRosPose(
|
49 | 90 | const drake::math::RigidTransformd& transform);
|
50 | 91 |
|
51 |
| -Eigen::Isometry3d RosTransformToIsometry3d( |
52 |
| - const geometry_msgs::msg::Transform& transform); |
53 |
| - |
54 |
| -geometry_msgs::msg::Transform Isometry3dToRosTransform( |
55 |
| - const Eigen::Isometry3d& isometry); |
56 |
| - |
57 | 92 | drake::math::RigidTransformd RosTransformToRigidTransform(
|
58 | 93 | const geometry_msgs::msg::Transform& transform);
|
59 | 94 |
|
60 | 95 | geometry_msgs::msg::Transform RigidTransformToRosTransform(
|
61 | 96 | const drake::math::RigidTransformd& transform);
|
62 | 97 |
|
63 |
| -drake::Vector6d RosTwistToVector6d(const geometry_msgs::msg::Twist& twist); |
| 98 | +Eigen::Isometry3d RosPoseToIsometry3(const geometry_msgs::msg::Pose& pose); |
| 99 | + |
| 100 | +geometry_msgs::msg::Pose Isometry3ToRosPose(const Eigen::Isometry3d& isometry); |
| 101 | + |
| 102 | +Eigen::Isometry3d RosTransformToIsometry3( |
| 103 | + const geometry_msgs::msg::Transform& transform); |
| 104 | + |
| 105 | +geometry_msgs::msg::Transform Isometry3ToRosTransform( |
| 106 | + const Eigen::Isometry3d& isometry); |
| 107 | + |
| 108 | +// Spatial Velocity. |
| 109 | + |
| 110 | +drake::Vector6d RosTwistToVector6(const geometry_msgs::msg::Twist& twist); |
64 | 111 |
|
65 |
| -geometry_msgs::msg::Twist Vector6dToRosTwist(const drake::Vector6d& vector); |
| 112 | +geometry_msgs::msg::Twist Vector6ToRosTwist(const drake::Vector6d& vector); |
66 | 113 |
|
67 |
| -drake::multibody::SpatialVelocity<double> RosTwistToVelocity( |
| 114 | +drake::multibody::SpatialVelocity<double> RosTwistToSpatialVelocity( |
68 | 115 | const geometry_msgs::msg::Twist& twist);
|
69 | 116 |
|
70 |
| -geometry_msgs::msg::Twist VelocityToRosTwist( |
| 117 | +geometry_msgs::msg::Twist SpatialVelocityToRosTwist( |
71 | 118 | const drake::multibody::SpatialVelocity<double>& velocity);
|
72 | 119 |
|
73 |
| -drake::Vector6d RosAccelToVector6d(const geometry_msgs::msg::Accel& accel); |
| 120 | +// Spatial Acceleration. |
74 | 121 |
|
75 |
| -geometry_msgs::msg::Accel Vector6dToRosAccel(const drake::Vector6d& vector); |
| 122 | +drake::Vector6d RosAccelerationToVector6( |
| 123 | + const geometry_msgs::msg::Accel& accel); |
| 124 | + |
| 125 | +geometry_msgs::msg::Accel Vector6ToRosAcceleration( |
| 126 | + const drake::Vector6d& vector); |
76 | 127 |
|
77 |
| -drake::multibody::SpatialAcceleration<double> RosAccelToAccel( |
| 128 | +drake::multibody::SpatialAcceleration<double> RosAccelerationToSpatialAcceleration( |
78 | 129 | const geometry_msgs::msg::Accel& accel);
|
79 | 130 |
|
80 |
| -geometry_msgs::msg::Accel AccelToRosAccel( |
| 131 | +geometry_msgs::msg::Accel SpatialAccelerationToRosAcceleration( |
81 | 132 | const drake::multibody::SpatialAcceleration<double>& accel);
|
82 | 133 |
|
83 |
| -drake::Vector6d RosWrenchToVector6d(const geometry_msgs::msg::Wrench& wrench); |
| 134 | +// Spatial Force. |
| 135 | + |
| 136 | +drake::Vector6d RosWrenchToVector6(const geometry_msgs::msg::Wrench& wrench); |
84 | 137 |
|
85 |
| -geometry_msgs::msg::Wrench Vector6dToRosWrench(const drake::Vector6d& vector); |
| 138 | +geometry_msgs::msg::Wrench Vector6ToRosWrench(const drake::Vector6d& vector); |
86 | 139 |
|
87 |
| -drake::multibody::SpatialForce<double> RosWrenchToForce( |
| 140 | +drake::multibody::SpatialForce<double> RosWrenchToSpatialForce( |
88 | 141 | const geometry_msgs::msg::Wrench& wrench);
|
89 | 142 |
|
90 |
| -geometry_msgs::msg::Wrench ForceToRosWrench( |
| 143 | +geometry_msgs::msg::Wrench SpatialForceToRosWrench( |
91 | 144 | const drake::multibody::SpatialForce<double>& force);
|
92 | 145 |
|
93 | 146 | } // namespace drake_ros_core
|
0 commit comments