ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
the topic types does not mach.
You must not subscribe to the imu topic as a vector3 type but as a sensor_msgs/Imu type.
Can you provide in the question how you do the subscription?
2 | No.2 Revision |
the topic types does not mach.
You must not subscribe to the imu topic as a vector3 type but as a sensor_msgs/Imu type.
Can In your code, you provide in the question how you do the subscription?are subscribing to a topic called "imu" that must have a Vector3 type.
However, in practice the sensor publishes messages on the "imu" topic with type sensor_msgs/Imu.
3 | No.3 Revision |
the topic types does not mach.
You must not subscribe to the imu topic as a vector3 type but as a sensor_msgs/Imu type.
In your code, you are subscribing to a topic called "imu" that must have a Vector3 type.
However, in practice the sensor publishes messages on the "imu" topic with type sensor_msgs/Imu.sensor_msgs/Imu. These are the fields of a sensor_msgs/Imu:
std_msgs/Header header
geometry_msgs/Quaternion orientation
float64[9] orientation_covariance
geometry_msgs/Vector3 angular_velocity
float64[9] angular_velocity_covariance
geometry_msgs/Vector3 linear_acceleration
float64[9] linear_acceleration_covariance
You have to take the orientation field (that it is a quaternion) and convert it to euler angles (roll, pitch, yaw)... then you will have the three values you are looking. In order to do that you can use the conversion functions that exist in the "tf" library.
4 | No.4 Revision |
the topic types does not mach.
You must not subscribe to the imu topic as a vector3 type but as a sensor_msgs/Imu type.
In your code, you are subscribing to a topic called "imu" that must have a Vector3 type.
However, in practice the sensor publishes messages on the "imu" topic with type sensor_msgs/Imu. These are the fields of a sensor_msgs/Imu:
std_msgs/Header header
geometry_msgs/Quaternion orientation
float64[9] orientation_covariance
geometry_msgs/Vector3 angular_velocity
float64[9] angular_velocity_covariance
geometry_msgs/Vector3 linear_acceleration
float64[9] linear_acceleration_covariance
You have to take the orientation field (that it is a quaternion) and convert it to euler angles (roll, pitch, yaw)... then you will have the three values you are looking. In order to do that you can use the conversion functions that exist in the "tf" library.
This would be approximately a more correct code:
note: i tried this
void handle_imu(const sensor_msgs::Imu::ConstPtr &msg) { gyro_x = msg->angular_velocity.x; gyro_y = msg->angular_velocity->y; gyro_z = msg->angular_velocity->z; }
5 | No.5 Revision |
the topic types does not mach.
You must not subscribe to the imu topic as a vector3 type but as a sensor_msgs/Imu type.
In your code, you are subscribing to a topic called "imu" that must have a Vector3 type.
However, in practice the sensor publishes messages on the "imu" topic with type sensor_msgs/Imu. These are the fields of a sensor_msgs/Imu:
std_msgs/Header header
geometry_msgs/Quaternion orientation
float64[9] orientation_covariance
geometry_msgs/Vector3 angular_velocity
float64[9] angular_velocity_covariance
geometry_msgs/Vector3 linear_acceleration
float64[9] linear_acceleration_covariance
You have to take the orientation field (that it is a quaternion) and convert it to euler angles (roll, pitch, yaw)... then you will have the three values you are looking. In order to do that you can use the conversion functions that exist in the "tf" library.
This would be approximately a more correct code:
note: i tried this
void handle_imu(const sensor_msgs::Imu::ConstPtr &msg)
{
gyro_x = msg->angular_velocity.x;
gyro_y = msg->angular_velocity->y;
gyro_z = msg->angular_velocity->z;
6 | No.6 Revision |
the topic types does not mach.
You must not subscribe to the imu topic as a vector3 type but as a sensor_msgs/Imu type.
In your code, you are subscribing to a topic called "imu" that must have a Vector3 type.
However, in practice the sensor publishes messages on the "imu" topic with type sensor_msgs/Imu. These are the fields of a sensor_msgs/Imu:
std_msgs/Header header
geometry_msgs/Quaternion orientation
float64[9] orientation_covariance
geometry_msgs/Vector3 angular_velocity
float64[9] angular_velocity_covariance
geometry_msgs/Vector3 linear_acceleration
float64[9] linear_acceleration_covariance
You have to take the orientation field (that it is a quaternion) and convert it to euler angles (roll, pitch, yaw)... then you will have the three values you are looking. In order to do that you can use the conversion functions that exist in the "tf" library.
This would be approximately a more correct code:
note: i tried this
void handle_imu(const sensor_msgs::Imu::ConstPtr &msg)
{
gyro_x = msg->angular_velocity.x;
gyro_y = msg->angular_velocity->y;
gyro_z = msg->angular_velocity->z;
}
7 | No.7 Revision |
the topic types does not mach.
You must not subscribe to the imu topic as a vector3 type but as a sensor_msgs/Imu type.
In your code, you are subscribing to a topic called "imu" that must have a Vector3 type.
However, in practice the sensor publishes messages on the "imu" topic with type sensor_msgs/Imu. These are the fields of a sensor_msgs/Imu:
std_msgs/Header header
geometry_msgs/Quaternion orientation
float64[9] orientation_covariance
geometry_msgs/Vector3 angular_velocity
float64[9] angular_velocity_covariance
geometry_msgs/Vector3 linear_acceleration
float64[9] linear_acceleration_covariance
You have to take the orientation field (that it is a quaternion) and convert it to euler angles (roll, pitch, yaw)... then you will have the three values you are looking. In order to do that you can use the conversion functions that exist in the "tf" library.
This would be approximately a more correct code:
void handle_imu(const sensor_msgs::Imu::ConstPtr &msg)
{
gyro_x = msg->angular_velocity.x;
gyro_y = msg->angular_velocity->y;
msg->angular_velocity.y;
gyro_z = msg->angular_velocity->z; msg->angular_velocity.z;
}