Jaeyoung-Lim / mavros_controllers

Aggressive trajectory tracking using mavros for PX4 enabled vehicles
BSD 3-Clause "New" or "Revised" License
416 stars 166 forks source link

How to use this code #34

Closed weiqil closed 6 years ago

weiqil commented 6 years ago

Hi, Thank you for your sharing of this work. It does help me to understand the papers much. But when I try to run this code on my computer, there comes some errors. I type this command: roslaunch geometric_controller trajectory_track_circle.launch Part of the output is: UAV autoquad icarous matrixpilot paparazzi slugs standard uAvionix ualberta [ INFO] [1540910990.048991065]: MAVROS started. MY ID 1.240, TARGET ID 1.1 0x2002e10 void QWindowPrivate::setTopLevelScreen(QScreen, bool) ( QScreen(0x192de90) ): Attempt to set a screen on a child window. 0x1fff110 void QWindowPrivate::setTopLevelScreen(QScreen, bool) ( QScreen(0x192de90) ): Attempt to set a screen on a child window. 0x2029880 void QWindowPrivate::setTopLevelScreen(QScreen, bool) ( QScreen(0x192de90) ): Attempt to set a screen on a child window. 0x2028be0 void QWindowPrivate::setTopLevelScreen(QScreen, bool) ( QScreen(0x192de90) ): Attempt to set a screen on a child window. [ERROR] [1540910994.865435761]: MODE: Unsupported FCU [ERROR] [1540910999.875788522]: MODE: Unsupported FCU [ERROR] [1540911004.886073662]: MODE: Unsupported FCU

Is there any thing wrong for my operation? Thanks a lot!

Jaeyoung-Lim commented 6 years ago

@weiqil Thanks for the interest,

I guess the repo is currently badly documented. I will include a brief tutorial on how to setup the environment. The current simulation is based on the PX4 SITL

It seems like your SITL is not running properly, as in this document

You need to check if the following command is working properly.

cd <Firmware>
make posix_sitl_default gazebo

Once this is working, you can run the ROS node in this repo

weiqil commented 6 years ago

@Jaeyoung-Lim Really nice of you to reply me so fast. I check the command: $ make posix_sitl_default gazebo it works well because I can fly the drone by typing the command $commander takeoff .

but the error still exists when running the launch file in this repo. The output shown in the terminal:

px4

starting.

INFO [Unknown] Calling startup script: /bin/sh etc/init.d-posix/rcS 0 ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands process[gazebo-5]: started with pid [26252] ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands process[gazebo_gui-6]: started with pid [26261] ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands process[vehicle_spawn_Asus_25663_5254384993934981838-7]: started with pid [26271] ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands process[rviz-8]: started with pid [26280] ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands ERROR [px4_daemon] pipe open fail (13) ERROR [px4_daemon] Could not send commands Error: no autostart file found (etc/init.d-posix/ERROR [px4_daemon] pipe open fail (13) ERROR [px4daemon] Could not send commands) etc/init.d-posix/rcS: 167: exit: Illegal number: -1 ERROR [Unknown] Startup script returned with return value: 512 pxh> Traceback (most recent call last): File "/opt/ros/kinetic/lib/gazebo_ros/spawn_model", line 32, in import tf.transformations as tft File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf/init.py", line 28, in from tf2_ros import TransformException as Exception, ConnectivityException, LookupException, ExtrapolationException File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_ros/init.py", line 39, in from .buffer_interface import File "/opt/ros/kinetic/lib/python2.7/dist-packages/tf2_ros/buffer_interface.py", line 32, in import roslib; roslib.load_manifest('tf2_ros') File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/launcher.py", line 62, in load_manifest sys.path = _generate_python_path(package_name, _rospack) + sys.path File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslib/launcher.py", line 93, in _generate_python_path m = rospack.get_manifest(pkg) File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 167, in get_manifest return self._load_manifest(name) File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 211, in _load_manifest retval = self._manifests[name] = parse_manifest_file(self.get_path(name), self._manifest_name, rospack=self) File "/usr/lib/python2.7/dist-packages/rospkg/manifest.py", line 412, in parse_manifest_file _static_rosdep_view = init_rospack_interface() File "/usr/lib/python2.7/dist-packages/rosdep2/rospack.py", line 59, in init_rospack_interface lookup = _get_default_RosdepLookup(Options()) File "/usr/lib/python2.7/dist-packages/rosdep2/main.py", line 130, in _get_default_RosdepLookup verbose=options.verbose) File "/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py", line 633, in create_default sources = load_cached_sources_list(sources_cache_dir=sources_cache_dir, verbose=verbose) File "/usr/lib/python2.7/dist-packages/rosdep2/sources_list.py", line 529, in load_cached_sources_list with open(cache_index, 'r') as f: IOError: [Errno 13] Permission denied: '/home/weiqi_liu/.ros/rosdep/sources.cache/index' [ INFO] [1540976461.771004240]: Finished loading Gazebo ROS API Plugin. [ INFO] [1540976461.771475341]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting... [ INFO] [1540976461.809180670]: Finished loading Gazebo ROS API Plugin. [ INFO] [1540976461.809550099]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting... [vehicle_spawn_Asus_25663_5254384993934981838-7] process has died [pid 26271, exit code 1, cmd /opt/ros/kinetic/lib/gazebo_ros/spawn_model -sdf -file /home/weiqi_liu/src/Firmware/Tools/sitl_gazebo/models/iris/iris.sdf -model iris -x 0 -y 0 -z 0 -R 0 -P 0 -Y 0 name:=vehicle_spawn_Asus_25663_5254384993934981838 log:=/home/weiqi_liu/.ros/log/7cf7ff42-dceb-11e8-84b2-1c872c47930c/vehicle_spawn_Asus_25663_5254384993934981838-7.log]. log file: /home/weiqi_liu/.ros/log/7cf7ff42-dceb-11e8-84b2-1c872c47930c/vehicle_spawn_Asus_25663_5254384993934981838-7.log 0x2189e20 void QWindowPrivate::setTopLevelScreen(QScreen, bool) ( QScreen(0x1a56e90) ): Attempt to set a screen on a child window. 0x2188c50 void QWindowPrivate::setTopLevelScreen(QScreen, bool) ( QScreen(0x1a56e90) ): Attempt to set a screen on a child window. 0x216b7f0 void QWindowPrivate::setTopLevelScreen(QScreen, bool) ( QScreen(0x1a56e90) ): Attempt to set a screen on a child window. 0x218a730 void QWindowPrivate::setTopLevelScreen(QScreen*, bool) ( QScreen(0x1a56e90) ): Attempt to set a screen on a child window. [ INFO] [1540976462.300133567, 0.022000000]: waitForService: Service [/gazebo/set_physics_properties] is now available. [ INFO] [1540976462.322595656, 0.044000000]: Physics dynamic reconfigure ready. [ INFO] [1540976462.509700954, 0.228000000]: waitForService: Service [/gazebo/set_physics_properties] is now available. [ INFO] [1540976462.531036438, 0.250000000]: Physics dynamic reconfigure ready. [ERROR] [1540976467.296763168, 5.008000000]: MODE: Unsupported FCU

Sorry for troubling you again. I searched for the cause online but failed to figure out. Best Regards!

Jaeyoung-Lim commented 6 years ago

@weiqil There seems to be something wrong with your firmware installation.

Try

cd <Firmware_clone>
make posix_sitl_default gazebo
source ~/catkin_ws/devel/setup.bash    // (optional)
source Tools/setup_gazebo.bash $(pwd) $(pwd)/build/posix_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)/Tools/sitl_gazebo
roslaunch px4 posix_sitl.launch
Jaeyoung-Lim commented 5 years ago

@weiqil Could you confirm that the comment solved your problem?

weiqil commented 5 years ago

@Jaeyoung-Lim
Hi, Sorry I'm late reply. Indeed, I can not run the code by the launch file all the time.  $ roslaunch geometric_controller trajectory_track_circle.launch parts of the output are:

process[sitl-5]: started with pid [5422] INFO [Unknown] PX4 daemon already running for instance 0 (Resource temporarily unavailable) process[gazebo-6]: started with pid [5423] process[gazebo_gui-7]: started with pid [5428] process[vehicle_spawn_Asus_4746_4639041922856050695-8]: started with pid [5433] process[rviz-9]: started with pid [5434] ================================================================================REQUIRED process [sitl-5] has died! process has died [pid 5422, exit code 255, cmd /home/weiqi_liu/src/Firmware/build/posix_sitl_default/bin/px4 /home/weiqi_liu/src/Firmware/ROMFS/px4fmu_common -s etc/init.d-posix/rcS name:=sitl log:=/home/weiqi_liu/.ros/log/20f914f6-eecf-11e8-9d80-1c872c47930c/sitl-5.log]. log file: /home/weiqi_liu/.ros/log/20f914f6-eecf-11e8-9d80-1c872c47930c/sitl-5*.log Initiating shutdown!

But if I run the code step by step, I get the desired result that the vehicle takes off and then follows a circular trajectory. The main steps are:

rosrun geometric_controller geometric_controller

rosrun trajectory_publisher trajectory_publisher

Sorry for my late reply and thanks for your sharing and help again.

weiqi liu

stijojoseph commented 4 years ago

when running make posix_sitl_default gazebo

Makefile:493: *** "Make target posix_sitl_default not found. It either does not exist or posix_sitl_default cannot be the first argument. Use 'make help|list_config_targets' to get a list of all possible [configuration] targets.". Stop