fixed IMU, removed rpy from IMU

This commit is contained in:
Bian Zekun 2020-09-22 11:17:03 +08:00
parent 7fb8cce8a0
commit 5f734598c6
3 changed files with 16 additions and 7 deletions

View File

@ -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;
}

View File

@ -1,5 +1,4 @@
float32[4] quaternion
float32[3] gyroscope
float32[3] accelerometer
float32[3] rpy
int8 temperature

View File

@ -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;
}