Hi everyone,
I’m encountering an issue while trying to run PX4 SITL using ROS.
Here’s the scenario:
- I successfully compiled PX4 with the command:
> make px4_sitl_default gazebo
This command launches the simulation, and I can see the drone in Gazebo, and I am able to control and fly it without any problems.
- However, when I try to launch the ROS interface with the command:
> roslaunch px4 posix_sitl.launch
I get the following error message:
> (base) ljp@ljp-MS-7E25:~/PX4-Autopilot$ roslaunch px4 posix_sitl.launch
... logging to /home/ljp/.ros/log/e545ea38-2ffe-11f0-9b8d-ab0902c6161d/roslaunch-ljp-MS-7E25-206641.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
WARNING: disk usage in log directory [/home/ljp/.ros/log] is over 1GB.
It's recommended that you use the 'rosclean' command.
started roslaunch server http://ljp-MS-7E25:33455/
SUMMARY
========
PARAMETERS
* /gazebo/enable_ros_network: True
* /rosdistro: noetic
* /rosversion: 1.17.0
* /use_sim_time: True
NODES
/
gazebo (gazebo_ros/gzserver)
gazebo_gui (gazebo_ros/gzclient)
sitl (px4/px4)
vehicle_spawn_ljp_MS_7E25_206641_4875867567744766849 (gazebo_ros/spawn_model)
ROS_MASTER_URI=http://localhost:11311
process[sitl-1]: started with pid [206712]
process[gazebo-2]: started with pid [206713]
process[gazebo_gui-3]: started with pid [206717]
process[vehicle_spawn_ljp_MS_7E25_206641_4875867567744766849-4]: started with pid [206722]
================================================================================REQUIRED process [sitl-1] has died!
process has died [pid 206712, exit code 255, cmd /home/ljp/PX4-Autopilot/build/px4_sitl_default/bin/px4 /home/ljp/PX4-Autopilot/build/px4_sitl_default/etc -s etc/init.d-posix/rcS __name:=sitl __log:=/home/ljp/.ros/log/e545ea38-2ffe-11f0-9b8d-ab0902c6161d/sitl-1.log].
log file: /home/ljp/.ros/log/e545ea38-2ffe-11f0-9b8d-ab0902c6161d/sitl-1*.log
Initiating shutdown!
================================================================================
[vehicle_spawn_ljp_MS_7E25_206641_4875867567744766849-4] killing on exit
[gazebo_gui-3] killing on exit
[gazebo-2] killing on exit
[sitl-1] killing on exit
Traceback (most recent call last):
File "/opt/ros/noetic/lib/gazebo_ros/spawn_model", line 20, in <module>
import rospy
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/__init__.py", line 49, in <module>
from .client import spin, myargv, init_node, \
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/client.py", line 49, in <module>
import rosgraph
File "/opt/ros/noetic/lib/python3/dist-packages/rosgraph/__init__.py", line 36, in <module>
from . masterapi import Master, MasterFailure, MasterError, MasterException
File "/opt/ros/noetic/lib/python3/dist-packages/rosgraph/masterapi.py", line 41, in <module>
from xmlrpc.client import ServerProxy # Python 3.x
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ljp/miniconda3/lib/python3.12/xmlrpc/client.py", line 136, in <module>
import http.client
File "/home/ljp/miniconda3/lib/python3.12/http/client.py", line 71, in <module>
import email.parser
File "/home/ljp/miniconda3/lib/python3.12/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "/home/ljp/miniconda3/lib/python3.12/email/feedparser.py", line 27, in <module>
from email._policybase import compat32
File "/home/ljp/miniconda3/lib/python3.12/email/_policybase.py", line 7, in <module>
from email import header
File "/home/ljp/miniconda3/lib/python3.12/email/header.py", line 20, in <module>
from email import charset as _charset
File "/home/ljp/miniconda3/lib/python3.12/email/charset.py", line 18, in <module>
from email.encoders import encode_7or8bit
KeyboardInterrupt
shutting down processing monitor...
... shutting down processing monitor complete
done
I have already set the necessary paths in my .bashrc
file, but the issue persists.
Could anyone help me understand what might be causing this issue or suggest a solution? I’m unsure why the Gazebo simulation works fine, but ROS fails to launch.
Thanks in advance for your help!