Example for communication between pixhawk and companion computer using MAVROS

Is there any example for interfacing a raspberry pi3 and pixhawk using the MAVROS protocol. I’m currently working on a example such as taking pictures and sending the pic info to pixhawk only when needed. I don’t want an offboard control , need only a way to transmit and receive some info from pixhawk.

Any leads would be appreciated. Thanks

@nikesh_elango Here is an example: http://dev.px4.io/master/en/ros/mavros_offboard.html

Thanks for the info, i installed ROS/Gazebo for px4 as per the instructions in https://dev.px4.io/master/en/setup/dev_env_linux_ubuntu.html#rosgazebo

And i got an error during installation

Unable to locate package ros-melodic-desktop-full

I’m using ubuntu 20.04 OS.

@nikesh_elango ros melodic is not supported in 20.04

1 Like

@Jaeyoung-Lim i reverted my OS back to 18.04. Still getting some problems as below

...............................................................................
Failed     << mavlink:make                         [ Exited with code 2 ]      
Failed    <<< mavlink                              [ 0.3 seconds ]             
Abandoned <<< libmavconn                           [ Unrelated job failed ]    
Abandoned <<< mavros                               [ Unrelated job failed ]    
Abandoned <<< mavros_extras                        [ Unrelated job failed ]    
Abandoned <<< test_mavros                          [ Unrelated job failed ]    
_______________________________________________________________________________
>Errors     << mavros_msgs:cmake /home/okulo/catkin_ws/logs/mavros_msgs/build.cmake.000.log
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "geographic_msgs"
  with any of the following names:

    geographic_msgsConfig.cmake
    geographic_msgs-config.cmake
 Add the installation prefix of "geographic_msgs" to CMAKE_PREFIX_PATH or
  set "geographic_msgs_DIR" to a directory containing one of the above files.
  If "geographic_msgs" provides a separate development package or SDK, be
  sure it has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:4 (find_package)


cd /home/okulo/catkin_ws/build/mavros_msgs; catkin build --get-env mavros_msgs | catkin env -si  /usr/bin/cmake /home/okulo/catkin_ws/src/mavros/mavros_msgs --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/okulo/catkin_ws/devel/.private/mavros_msgs -DCMAKE_INSTALL_PREFIX=/home/okulo/catkin_ws/install; cd -
...............................................................................
Failed     << mavros_msgs:cmake                    [ Exited with code 1 ]      
Failed    <<< mavros_msgs                          [ 2.3 seconds ]             
[build] Summary: 1 of 7 packages succeeded.                                    
[build]   Ignored:   None.                                                     
[build]   Warnings:  None.                                                     
[build]   Abandoned: 4 packages were abandoned.                                
[build]   Failed:    2 packages failed.                                        
[build] Runtime: 4.8 seconds total.                                            
[build] Note: Workspace packages have changed, please re-source setup files to use them.

Is this normal? should i install some other packages?

@nikesh_elango Have you tried looking at the installation instructions for mavros? https://github.com/mavlink/mavros/blob/master/mavros/README.md#installation

@Jaeyoung-Lim Thanks for the info, I tried the binary installation of MAVROS. The mavlink and mavros packages were installed successfully.But the mavros_extras were not installed.

[build] Found ‘6’ packages in 0.0 seconds.
[build] Package table is up to date.
Starting >>> mavlink
Starting >>> mavros_msgs
Finished <<< mavros_msgs [ 0.9 seconds ]
Finished <<< mavlink [ 1.1 seconds ]
Starting >>> libmavconn
Finished <<< libmavconn [ 0.2 seconds ]
Starting >>> mavros
Finished <<< mavros [ 0.7 seconds ]
Starting >>> mavros_extras


Errors << mavros_extras:make /home/okulo/catkin_ws/logs/mavros_extras/build.make.002.log
/home/okulo/catkin_ws/src/mavros/mavros_extras/src/plugins/odom.cpp: In member function ‘void mavros::extra_plugins::OdometryPlugin::odom_cb(const ConstPtr&)’:
/home/okulo/catkin_ws/src/mavros/mavros_extras/src/plugins/odom.cpp:228:53: error: ‘BODY_FRD’ is not a member of ‘mavlink::common::MAV_FRAME’
msg.child_frame_id = utils::enum_value(MAV_FRAME::BODY_FRD);
^~~~~~~~
make[2]: *** [CMakeFiles/mavros_extras.dir/src/plugins/odom.cpp.o] Error 1
make[1]: *** [CMakeFiles/mavros_extras.dir/all] Error 2
make: *** [all] Error 2
cd /home/okulo/catkin_ws/build/mavros_extras; catkin build --get-env mavros_extras | catkin env -si /usr/bin/make --jobserver-fds=6,7 -j; cd -

Failed << mavros_extras:make [ Exited with code 2 ]
Failed <<< mavros_extras [ 7.3 seconds ]
Abandoned <<< test_mavros [ Unrelated job failed ]
[build] Summary: 4 of 6 packages succeeded.
[build] Ignored: None.
[build] Warnings: None.
[build] Abandoned: 1 packages were abandoned.
[build] Failed: 1 packages failed.
[build] Runtime: 9.4 seconds total.

I encountered some problems while installing ,I had to update some python packages.

The above issue is solved :-https://github.com/mavlink/mavros/issues/1424