ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Thanks! that's exactly what I was looking for. In brief the twist message should be converted into velocity using this function
void OnTwistMsg(const geometry_msgs::TwistConstPtr &_msg) { auto yaw = (float)model->WorldPose().Rot().Yaw(); model->SetLinearVel(ignition::math::Vector3d( _msg->linear.x * cosf(yaw) - _msg->linear.y * sinf(yaw), _msg->linear.y * cosf(yaw) + _msg->linear.x * sinf(yaw), 0)); model->SetAngularVel(ignition::math::Vector3d(0, 0, _msg->angular.z)); }
2 | No.2 Revision |
Thanks! that's exactly what I was looking for. In brief the twist message should be converted into velocity using this function
void OnTwistMsg(const geometry_msgs::TwistConstPtr &_msg) {
auto yaw = (float)model->WorldPose().Rot().Yaw();
model->SetLinearVel(ignition::math::Vector3d(
_msg->linear.x * cosf(yaw) - _msg->linear.y * sinf(yaw),
_msg->linear.y * cosf(yaw) + _msg->linear.x * sinf(yaw),
0));
model->SetAngularVel(ignition::math::Vector3d(0, 0, _msg->angular.z));