diff --git a/unitree_controller/src/servo.cpp b/unitree_controller/src/servo.cpp index f1b5336..55b0c82 100644 --- a/unitree_controller/src/servo.cpp +++ b/unitree_controller/src/servo.cpp @@ -54,6 +54,15 @@ public: lowState.imu.quaternion[1] = msg.orientation.x; lowState.imu.quaternion[2] = msg.orientation.y; lowState.imu.quaternion[3] = msg.orientation.z; + + lowState.imu.gyroscope[0] = msg.angular_velocity.x; + lowState.imu.gyroscope[1] = msg.angular_velocity.y; + lowState.imu.gyroscope[2] = msg.angular_velocity.z; + + lowState.imu.accelerometer[0] = msg.linear_acceleration.x; + lowState.imu.accelerometer[1] = msg.linear_acceleration.y; + lowState.imu.accelerometer[2] = msg.linear_acceleration.z; + } void FRhipCallback(const unitree_legged_msgs::MotorState& msg) @@ -233,6 +242,7 @@ int main(int argc, char **argv) */ lowState_pub.publish(lowState); sendServoCmd(); + } return 0; } diff --git a/unitree_legged_msgs/msg/IMU.msg b/unitree_legged_msgs/msg/IMU.msg index 625fc60..71c741a 100644 --- a/unitree_legged_msgs/msg/IMU.msg +++ b/unitree_legged_msgs/msg/IMU.msg @@ -1,5 +1,4 @@ float32[4] quaternion float32[3] gyroscope float32[3] accelerometer -float32[3] rpy int8 temperature \ No newline at end of file diff --git a/unitree_legged_real/include/convert.h b/unitree_legged_real/include/convert.h index 578b7e8..87eded1 100644 --- a/unitree_legged_real/include/convert.h +++ b/unitree_legged_real/include/convert.h @@ -34,9 +34,9 @@ unitree_legged_msgs::IMU ToRos(UNITREE_LEGGED_SDK::IMU& lcm) ros.accelerometer[0] = lcm.accelerometer[0]; ros.accelerometer[1] = lcm.accelerometer[1]; ros.accelerometer[2] = lcm.accelerometer[2]; - ros.rpy[0] = lcm.rpy[0]; - ros.rpy[1] = lcm.rpy[1]; - ros.rpy[2] = lcm.rpy[2]; + // ros.rpy[0] = lcm.rpy[0]; + // ros.rpy[1] = lcm.rpy[1]; + // ros.rpy[2] = lcm.rpy[2]; ros.temperature = lcm.temperature; return ros; } @@ -53,9 +53,9 @@ unitree_legged_msgs::IMU ToRos(aliengo::IMU& lcm){ ros.accelerometer[0] = lcm.acceleration[0]; ros.accelerometer[1] = lcm.acceleration[1]; ros.accelerometer[2] = lcm.acceleration[2]; - ros.rpy[0] = lcm.rpy[0]; - ros.rpy[1] = lcm.rpy[1]; - ros.rpy[2] = lcm.rpy[2]; + // ros.rpy[0] = lcm.rpy[0]; + // ros.rpy[1] = lcm.rpy[1]; + // ros.rpy[2] = lcm.rpy[2]; ros.temperature = lcm.temp; return ros; }