Unable to run MAVROS and PX4 with RLException error

Good day,

I am trying to run ROS/MAVROS off board example by following the steps in PX4 documentation: MAVROS Offboard control example (Python) | PX4 User Guide

However, when I insert the command: roslaunch offboard_py start_offb.launch , I was met with the following error.

RLException: Unable to launch [offb_node_py-7].
If it is a script, you may be missing a ‘#!’ declaration at the top.
The traceback for the exception was written to the log file

I’ve checked the offb_node.py script in ~/catkin_ws/src/scripts folder and there is a ‘#!’ declaration at the top.

“”"

  • File: offb_node.py
  • Stack and tested in Gazebo Classic 9 SITL
    “”"
    #! /usr/bin/env python
    import rospy

I’m not very sure what’s going wrong, would appreciate any help/insights on this! Thank you!

What is your linux platform ?

Hi! I’m running on Ubuntu Linux 20.04, I’ve managed to solve the issue.

The remedy is to delete the comments at the top of the offb_node.py file given by the PX4 user guide:

"""
 * File: offb_node.py
 * Stack and tested in Gazebo Classic 9 SITL
"""

Then move #! /usr/bin/env python to the first line of code solves the issue for me :smile:

1 Like