HuaYuXiao / px4ctrl

A ROS package to control multi-copters using PX4-Autopilot platform.
https://www.yuque.com/easonhua/nx9k7f
GNU General Public License v3.0
2 stars 0 forks source link

RLException: Unable to launch [uav_control/px4_pos_controller-8] #15

Closed HuaYuXiao closed 7 months ago

HuaYuXiao commented 7 months ago
RLException: Unable to launch [uav_control/px4_pos_controller-8]. 
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
[tf_2Dlidar-7] killing on exit
[uav_control/px4_pos_controller-8] killing on exit
[mavros-6] killing on exit
[p450_rplidar_monocular_1_spawn-5] killing on exit
[gazebo_gui-3] 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 47, in <module>
    from std_msgs.msg import Header
  File "/opt/ros/noetic/lib/python3/dist-packages/std_msgs/msg/__init__.py", line 1, in <module>
    from ._Bool import *
  File "/opt/ros/noetic/lib/python3/dist-packages/std_msgs/msg/_Bool.py", line 6, in <module>
    import genpy
  File "/opt/ros/noetic/lib/python3/dist-packages/genpy/__init__.py", line 34, in <module>
    from . message import Message, SerializationError, DeserializationError, MessageException, struct_I
  File "/opt/ros/noetic/lib/python3/dist-packages/genpy/message.py", line 46, in <module>
    import genmsg
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/__init__.py", line 34, in <module>
    from . gentools import compute_md5, compute_full_text, compute_md5_text
  File "/opt/ros/noetic/lib/python3/dist-packages/genmsg/gentools.py", line 43, in <module>
    import hashlib
  File "/usr/lib/python3.8/hashlib.py", line 167, in <module>
    import _hashlib
KeyboardInterrupt
[sitl_1-4] killing on exit
ERROR [px4] Startup script returned with return value: 2
[gazebo-2] killing on exit
Fatal Python error: init_import_size: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
  File "/usr/lib/python3.8/site.py", line 597, in <module>
Fatal Python error: init_import_size: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
  File "/usr/lib/python3.8/site.py", line 81, in <module>
    import _sitebuiltins
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 844, in exec_module
  File "<frozen importlib._bootstrap_external>", line 976, in get_code
    main()
  File "/usr/lib/python3.8/site.py", line 590, in main
  File "<frozen importlib._bootstrap_external>", line 640, in _compile_bytecode
KeyboardInterrupt
    execsitecustomize()
  File "/usr/lib/python3.8/site.py", line 529, in execsitecustomize
    import sitecustomize
  File "/usr/lib/python3.8/sitecustomize.py", line 3, in <module>
    import apport_python_hook
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 914, in _find_spec
  File "<frozen importlib._bootstrap_external>", line 1407, in find_spec
  File "<frozen importlib._bootstrap_external>", line 1379, in _get_spec
  File "<frozen importlib._bootstrap_external>", line 1510, in find_spec
  File "<frozen importlib._bootstrap_external>", line 1553, in _fill_cache
KeyboardInterrupt
[rosout-1] killing on exit
[master] killing on exit
HuaYuXiao commented 7 months ago

这个错误似乎是由于在 Python 中出现了键盘中断引起的。这可能是因为某些程序正在等待键盘输入或执行了一些需要键盘输入的操作。为了解决这个问题,你可以尝试以下几种方法:

  1. 检查程序逻辑:确保程序中的键盘输入操作处于适当的位置,并且没有无限循环等待用户输入的情况。你可以添加适当的错误处理来处理用户的意外输入,或者设置超时来避免程序永远等待输入。

  2. 检查环境中的其他进程:有时候,其他正在运行的程序可能会导致 Python 程序被阻塞或出现异常。检查并终止其他可能正在影响程序执行的进程。

  3. 尝试重启程序:尝试重新启动出现错误的程序,有时候这样可以解决临时的问题。

  4. 检查系统资源:可能是系统资源不足导致程序执行异常,你可以检查系统资源使用情况,并尝试释放或增加资源。

  5. 查看错误日志:检查 ROS 日志文件以获取更多关于程序中断的信息,这可能有助于更准确地定位问题所在。

以上是一些常见的排查方法,你可以根据具体情况尝试逐一排查,找到并解决导致程序中断的原因。

HuaYuXiao commented 7 months ago

删除之前编译安装的所有有关uav_control的文件夹,然后重新手动编译安装。