jusgomen / ros-mpu9250-imu

ROS node that reads the MPU9250 accelerometer, gyroscope and AK8963 magnetometer and publishes a sensor_msgs/Imu topic.
34 stars 18 forks source link

Fix compilation, accelerometer and gyro data format as well as scaling factors #4

Open StefanKrupop opened 4 years ago

StefanKrupop commented 4 years ago

I fixed the basic errors to get the node to compile on a Raspberry Pi (current Raspbian). Also added the mandatory license tag to package.xml. I left the default "BSD" in there, as I found no license information in the code. Please check and decide on a license. Also the accelerometer and gyroscope data was the wrong endianness. Lastly, I changed the scaling factors to match what's in the datasheet (mostly the accelerometer was off). Values that are now returned at least look like they could be plausible.

robert-meiner commented 4 years ago

I got this to build using catkin tools. I get this warning about generating messages, though. Is there a fix for this?

pi@antonio:~/catkin_ws $ catkin build
----------------------------------------------------------------------
Profile:                     default
Extending:             [env] /opt/ros/melodic:/home/pi/catkin_ws/devel
Workspace:                   /home/pi/catkin_ws
----------------------------------------------------------------------
Build Space:        [exists] /home/pi/catkin_ws/build
Devel Space:        [exists] /home/pi/catkin_ws/devel
Install Space:      [unused] /home/pi/catkin_ws/install
Log Space:          [exists] /home/pi/catkin_ws/logs
Source Space:       [exists] /home/pi/catkin_ws/src
DESTDIR:            [unused] None
----------------------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
----------------------------------------------------------------------
Additional CMake Args:       -DCMAKE_BUILD_TYPE=Release
Additional Make Args:        None
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
----------------------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
----------------------------------------------------------------------
Workspace configuration appears valid.
----------------------------------------------------------------------
[build] Found '1' packages in 0.0 seconds.                                           
[build] Updating package table.                                                      
Starting  >>> mpu9250_9dof_imu                                                       
_____________________________________________________________________________________
Warnings   << mpu9250_9dof_imu:cmake /home/pi/catkin_ws/logs/mpu9250_9dof_imu/build.cmake.000.log
CMake Warning at /home/pi/catkin_ws/build/mpu9250_9dof_imu/cmake/mpu9250_9dof_imu-genmsg.cmake:3 (message):
  Invoking generate_messages() without having added any message or service
  file before.

  You should either add add_message_files() and/or add_service_files() calls
  or remove the invocation of generate_messages().
Call Stack (most recent call first):
  /opt/ros/melodic/share/genmsg/cmake/genmsg-extras.cmake:307 (include)
  CMakeLists.txt:24 (generate_messages)

cd /home/pi/catkin_ws/build/mpu9250_9dof_imu; catkin build --get-env mpu9250_9dof_imu | catkin env -si  /usr/bin/cmake /home/pi/catkin_ws/src/ros-mpu9250-imu --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/pi/catkin_ws/devel/.private/mpu9250_9dof_imu -DCMAKE_INSTALL_PREFIX=/home/pi/catkin_ws/install -DCMAKE_BUILD_TYPE=Release; cd -
.....................................................................................
Finished  <<< mpu9250_9dof_imu                [ 18.5 seconds ]                       
[build] Summary: All 1 packages succeeded!                                           
[build]   Ignored:   None.                                                           
[build]   Warnings:  1 packages succeeded with warnings.                             
[build]   Abandoned: None.                                                           
[build]   Failed:    None.                                                           
[build] Runtime: 18.6 seconds total.                                                 
[build] Note: Workspace packages have changed, please re-source setup files to use them.
pi@antonio:~/catkin_ws $