husky / husky_robot

Robot (Hardware) packages for the Clearpath Husky
http://wiki.ros.org/Robots/Husky
48 stars 37 forks source link

Fix MagneticField msg reading #15

Closed AgarwalSaurav closed 1 year ago

AgarwalSaurav commented 2 years ago

Running compute_calibration results in the following error:

Traceback (most recent call last): File "/opt/ros/noetic/lib/husky_bringup/compute_calibration", line 42, in vecs.append((float(msg.vector.x), float(msg.vector.y), float(msg.vector.z))) AttributeError: '_sensor_msgs__MagneticField' object has no attribute 'vector'

MagneticField has the following structure as given by: rosmsg show sensor_msgs/MagneticField

std_msgs/Header header uint32 seq time stamp string frame_id geometry_msgs/Vector3 magnetic_field float64 x float64 y float64 z float64[9] magnetic_field_covariance

The issue is fixed by changing msg.vector to msg.magnetic_field

AgarwalSaurav commented 2 years ago

We have a UM7 sensor. The um7.launch file has a parameter that sets use_magnetic_field_msg to be true. Perhaps this is relevant. <param name="use_magnetic_field_msg" type="bool" value="true"/>

https://github.com/husky/husky_robot/blob/noetic-devel/husky_bringup/launch/um7_config/um7.launch