Skip to content

Commit

Permalink
Use correct units in sensor_msgs::Imu
Browse files Browse the repository at this point in the history
  • Loading branch information
Dima Garbuzov committed Jul 24, 2018
1 parent b72a874 commit 874b8f7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ouster_ros/src/os1_ros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ bool read_lidar_packet(const client& cli, PacketMsg& m) {
}

sensor_msgs::Imu packet_to_imu_msg(const PacketMsg& p) {
const double standard_g = 9.80665;
sensor_msgs::Imu m;
const uint8_t* buf = p.buf.data();

Expand All @@ -39,9 +40,9 @@ sensor_msgs::Imu packet_to_imu_msg(const PacketMsg& p) {
m.orientation.z = 0;
m.orientation.w = 0;

m.linear_acceleration.x = imu_la_x(buf);
m.linear_acceleration.y = imu_la_y(buf);
m.linear_acceleration.z = imu_la_z(buf);
m.linear_acceleration.x = imu_la_x(buf) * standard_g;
m.linear_acceleration.y = imu_la_y(buf) * standard_g;
m.linear_acceleration.z = imu_la_z(buf) * standard_g;

m.angular_velocity.x = imu_av_x(buf) * M_PI / 180.0;
m.angular_velocity.y = imu_av_y(buf) * M_PI / 180.0;
Expand Down

0 comments on commit 874b8f7

Please sign in to comment.