Explorar el Código

补充更新iic方式读取加速度信息时数据正负号问题

corvin_zhang hace 4 años
padre
commit
dc938f0942

+ 1 - 1
src/CMakeLists.txt

@@ -1 +1 @@
-/opt/ros/kinetic/catkin/cmake/toplevel.cmake
+/opt/ros/kinetic/share/catkin/cmake/toplevel.cmake

+ 4 - 4
src/rasp_imu_hat_6dof/rasp_imu_hat_6dof/nodes/imu_node.py

@@ -30,7 +30,7 @@ degrees2rad = math.pi/180.0
 imu_yaw_calibration = 0.0
 yaw = 0.0
 
-# Server return Yaw data
+# ros server return Yaw data
 def return_yaw_data(req):
     return GetYawDataResponse(yaw)
 
@@ -109,9 +109,9 @@ while not rospy.is_shutdown():
     # Publish imu message
     #rospy.loginfo("acc_x:%f acc_y:%f acc_z:%f", myIMU.raw_ax,
     #              myIMU.raw_ay, myIMU.raw_az)
-    imuMsg.linear_acceleration.x = float(myIMU.raw_ax)*accel_factor
-    imuMsg.linear_acceleration.y = float(myIMU.raw_ay)*accel_factor
-    imuMsg.linear_acceleration.z = float(myIMU.raw_az)*accel_factor
+    imuMsg.linear_acceleration.x = -float(myIMU.raw_ax)*accel_factor
+    imuMsg.linear_acceleration.y = -float(myIMU.raw_ay)*accel_factor
+    imuMsg.linear_acceleration.z = -float(myIMU.raw_az)*accel_factor
 
     imuMsg.angular_velocity.x = float(myIMU.raw_gx)*degrees2rad
     imuMsg.angular_velocity.y = float(myIMU.raw_gy)*degrees2rad