Commit Graph

26 Commits

Author SHA1 Message Date
tomvand 9d1e71b1ea Add Gazebo simulation to NPS (#2069)
* Setup code for Gazebo

Currently only partially initializes the fdm struct, which produces
incorrect results in the GCS.
Compilation, however, already seems to work as expected!

Next step is to fetch data from Gazebo.

* Closed-loop flight in Gazebo

Finished the first implementation of the Gazebo FDM. It is now possible
to perform closed-loop flights using Paparazzi together with Gazebo.

Look at the example_ardrone2.xml airframe file for the required gazebo tags.
The following modifications are made:
- change fdm type to "gazebo"
- add definitions for ACTUATOR_THRUSTS and ACTUATOR_TORQUES. These were
  obtained from the JSBsim ardrone model. The oredr is the same as the
  ACTUATOR_NAMES.

The Gazebo world needs an aircraft model that is (by default) named
"paparazzi_uav". This model should include links with the names listed
in ACTUATOR_NAMES in the airframe file, as these are used to apply
forces on the quadrotor.

Known bugs:
- No fixed wing aircraft yet.
- Not all fields in the fdm struct are set. Most of the atmosphere
  fields are not implemented yet.
- AHRS and INS need to be bypassed, these do not yet work correctly.
- No quadrotor models are supplied with paparazzi yet (although it is
  included in the example world file).

* Added cameras, but sensor update causes crash

As in the quick standalone examples, gazebo regularly crashes when
cameras are used.

This is an intermediary commit where most of the camera infrastructure
is present, but not functional yet because of an unknown bug regarding
Gazebo.

* Simplified problem, located crash

Crash occurs when gazebo::sensors::run_once() is called during
the fdm update step. The exception (Ogre internal exception,
cannot create GL vertex buffer) only occurs after the main loop
has been performed a few times (10-20x typically).

Ignoring the error by catching the exception does not make it go
away.

* Add ogre to fdm_gazebo makefile

* Further changes for debugging, not fixed yet

* FIX bug

Turns out that fdm_init and fdm_run_step are not running in the same
thread, which apparently caused some problems with Gazebo.

The gazebo initialization code that starts the server is now moved
to the run_step function, and cameras work fine now.

Next step is to get the images from Gazebo to the video_thread_nps module.

* Transport images to Paparazzi

Added code that converts Gazebo's RGB888 images to Paparazzi's
YUV422 format, and calls the registered video callbacks.

* Finish video streaming

Finished video streaming. Video streaming in the paparazzi master
branch does not seem to work in simulation or even on a real ardrone.
Therefore, reverted to v5.10 viewvideo.c and rtp.c and now the streaming
works correctly.

* Separate UAV model from world.

Added a models/ directory to conf/simulator/gazebo, now the UAV model
can be included in the world file. The models/ dir is added to Gazebo's
search paths when the server is launched, so it does not require
any additional steps from the user.

* Move Gazebo modifications from examples/ardrone2.xml to examples/ardrone2_gazebo.xml

Reverted changes to the original airframe and moved these to a
separate example.

* Remove .sdp file

Remove .sdp file that should not have been included with commits.

* Move changes in conf_example.xml to separate entry

Moved the changes to conf_example.xml (selected flightplan, modules etc.)
to a separate etry named 'ardrone2 (Gazebo)'.

* Clean up changes to computer_vision module

- Removed unused viewvideo_nps.c.
- Add doc comments in video_thread_nps.c

* Fix bug in conf_example

Spaces in aircraft name caused compilation error, changed to
'ardrone2_gazebo'.

* Fix duplicate ac_id in conf_example

* Remove debug code from nps_fdm_gazebo.cpp and add comments

* Reduce weight of cameras

Cameras weighed 10 grams, which was quite much. Now reduced to 1 gram.

* Fix camera not active

During the cleanup of the ardrone gazebo model, the always_on tag
was removed. Now, the cameras are activated during gazebo_video_init

Also removed further debug code from nps_fdm_gazebo.cpp.

* Restore master branch video streamer and rtp encoder

The streamer of the master branh does not work correctly atm, but
this will be moved to a separate issue.

* Fix compilation warnings

Fixed all compilation warnings (tested with Gazebo 8).

Unused arguments are now marked as such.

The NPS makefile is modified to use CXXFLAGS in addition to CFLAGS,
which solves the std=c++11 related warnings.

fdm_gazebo.cpp now ignores deprecated warnings, as all of these
come from Gazebo. Not the cleanest solution, but it works for now.

* Add documentation to fdm module xml and add copyright notices where appropriate

* Fix code style

Fixed code style using the tool included with paparazzi.

* Fix missing model.config

.gitignore caused the model.config files for the Gazebo models to
be excluded from the commit. Added an exception to .gitignore and
added the missing file.

* Fix INS by adding placeholder atmospheric data values

Added placeholder values to the atmospheric section of the NPM
struct. These should be valid for low altitude, low speed flights.

Previously, these values were uninitialized which caused INS to fail
(incorrect altitude estimates). With these placeholder values,
the INS works ok and no longer needs to be bypassed.

* Fix makefile targets in video_rtp_stream and cv_colorfilter

(Re)added target="ap|nps" attribute to the module .xml files.
2017-06-13 22:12:11 +02:00
kirkscheper f99ee0fc51 update clipping of image intensity 2016-11-04 18:03:45 +01:00
kirkscheper 329ef46b49 remove videoshot in favour of video_capture 2016-11-04 18:02:51 +01:00
kirkscheper 9af60c7229 add possibility to stream dual video 2016-11-04 18:02:51 +01:00
Felix Ruess 888af334d7 [modules] computer vision modules only for ap target
until it is properly implemented for nps as well...
2016-06-06 14:25:21 +02:00
Roland Meertens a32b8fb6fb Dual video thread solution (#1648)
This pull request allows you to use both the front camera and the bottom camera on the bebop, and to run optical flow on the bottom camera while running something else on the front camera. 

- modules can call cv_add_to_device(&camera, fun) to register the callback fun for the specified camera with the video thread
- use a linked list with listeners for the video
- saving jpeg encoded shots is now in a separate video_capture module
2016-06-01 12:15:44 +02:00
Gautier Hattenberger 1fdea9387b [modules] split define and include
also reuse 'type' attribute for string flags
2016-03-31 22:40:46 +02:00
Felix Ruess 6c1db38118 [modules] fix video_rtp_stream and bebop_front_camera if not using UDP for telemetry
and add missing configure options to doc
2015-12-09 20:38:29 +01:00
Gautier Hattenberger 585113c060 [cv] fix netcat video module
it is compiling and "should" run correctly except that the video_tread
module is now too big and the memory is not enough on ardrone2 to fork
the process
2015-11-17 17:39:39 +01:00
TU Delft developer b5108d9299 refreshed 2015-10-09 18:18:23 +02:00
Christophe De Wagter b1caeea8a9 [video_thread] simulation 2015-09-03 14:59:04 +02:00
Christophe De Wagter e6ef98366f [computervision] Setup a re-usable framework where computer vision methods can be added to the computer vision thread 2015-09-03 10:13:27 +02:00
Christophe De Wagter 4c17a025b4 [cv] modules 2015-09-03 09:06:39 +02:00
Roland Meertens b5d76323dd [modules] viewvideo: make sending via RTP configurable
also during runtime

closes #1293 as it makes it possible to switch of rtp streaming

netcat option is not touched and needs to be fixed...
2015-08-25 21:58:30 +02:00
Christophe De Wagter 236505a473 [video_rtp_stream] Shoot button 2015-08-25 16:35:55 +02:00
TU Delft developer ee477a1200 On my way fixing viewwideo 2015-08-02 12:04:39 +02:00
Felix Ruess fd77a7c82f [modules] viewvideo: use UdpSocket instead of udp_periph 2015-04-14 19:09:10 +02:00
Freek van Tienen 9be322692f [vision] Move folders and add general image struct 2015-03-22 17:07:54 +01:00
Felix Ruess 59c13b5384 [modules] video_rtp_stream doc 2015-03-11 14:35:37 +01:00
Felix Ruess a2cc6cbb9d move STRINGIFY macro to std.h and use it a bit more 2015-03-11 14:26:50 +01:00
Felix Ruess a207d15c98 [modules] video_rtp_stream: valid xml for strings 2015-03-11 13:27:59 +01:00
Freek van Tienen 4d7389c51d [viewvideo] Fix some small netcat bugs 2015-02-26 16:08:04 +01:00
Freek van Tienen 20c0c6603f [viewvideo] Move netcat image send inside viewvideo module 2015-02-26 10:35:16 +01:00
Freek van Tienen 208d224b6c [computer_vision] Rewrite viewvideo and rename/cleanup JPEG and RTP functions. 2015-02-25 18:40:38 +01:00
Freek van Tienen 3f7a0366de [v4l2] Rename v4l2 and fix mutex lock.
This implementation of v4l2 has more chance on a lock then the previous, but requires a lot let mutexes.
2015-02-25 18:40:38 +01:00
Gautier Hattenberger 9ce18f8146 [vision] add computer vision library in standard modules + 2 modules
- video RTP stream
- image download

for ARDrone2
2014-12-10 11:03:28 +01:00