289 Commits

Author SHA1 Message Date
Kirk Scheper b9d3ea4ac3 added agl estimator when assuming non flat ground (#1910)
* added agl estimator when assuming non flat ground

* add documentation and expand message

* update pprzlink
2018-07-25 23:06:47 +02:00
Tom van Dijk c870e27ac5 [gazebo] Cyberzoo model (#2230)
* First steps towards detailed cyberzoo model. Got transparency working.

* Fix ambient lighting of cyberzoo_solid

* Import improved model

* Fix optitrack cameras

* Fix lighting colors

* Fix optitrack camera color

* Add orange pole and traffic mat objects

* Fix orange_pole2 smoothing errors

* Fix cyberzoo origin

* Add first draft of cyberzoo surroundings

* Add updated cyberzoo surroundings and outside walls

* Minor fixes to surroundings

* Create cyberzoo world

To-do: set origin coordinates and rotate environment

* Set world coordinates and rotation, fix naming conflict

* Add cyberzoo world with orange poles for orange_avoider

* Remove old cyberzoo model, fix dependencies

* Add daylight in windows on outer walls

* Separate cyberzoo model into layers

Makes it easier to hide parts of the model in the GUI.

* Add cyberzoo surroundings to main model in separate layers

* Restore cyberzoo floor collision box

* Add cyberzoo props

* Minor tweaks to models

* Compress textures

Reduced texture dimensions. Size of model folder is now approx.
20 MB instead of 60+ MB.

* Remove origin marker from worlds

* Move CyberZoo models to submodule

- All new models are moved to the tudelft/gazebo_models repository, which is included as a submodule in sw/ext/tudelft_gazebo_models/
- Changed vehicle and world SDF loading to use URI's, these can be used with multiple search paths
- Added gzclient_launcher.sh script that sets up environment variables before launching gzclient. This prevents errors if the user forgets to add the paths to .bashrc. Added as a tool to control_panel_example.xml
2018-05-30 15:32:10 +02:00
Tom van Dijk ff8c58a190 [gazebo] Simulate Bebop1 camera (#2225)
* First attempt at bebop fisheye camera

* Try setting raw camera output size during initialization, does not work

SetImageSize() is ignored and SetEnvTextureSize() causes an
exception. Currently the camera output is too large for real-time
operation.

* FIX apply MT9F002_OUTPUT_SCALER to gazebo front camera

* Add MT9F002 camera cropping to fdm_gazebo

* Apply MT9F002_TARGET_FPS to bebop front cam in gazebo

* Set up bottom camera for bebop model

* Minor fixes and cleanup

* Fix MT9F002 partially applied to all cameras

* Remove sensors_params_bebop, introduce NPS_SIMULATE_MT9F002

Reduces duplicate code for sensor parameters, and follows the
same pattern as NPS_SIMULATE_LASER_RANGE_ARRAY.
Also does not require the sensor params to be changed in every
bebop airframe.
2018-02-04 18:03:41 +01:00
Tom van Dijk cfabb51eed [gazebo] Add actuator dynamics and bebop model (#2219)
* Add gazebo model for Parrot Bebop 1

* Add first-order high pass filter

* First implementation of actuator dynamics and spinup torque

Flies ok with PID control

Does not fly ok with INDI, the required G1 R is 0.159 instead of
0.0022 (estimated by flying in adaptive mode). The other parameters
are close to those specified in the airframe file.

* FIX incorrect yaw behavior

Fixed two bugs:
1. gazebo_actuators.torques was set to NPS_ACTUATOR_THRUSTS
2. spinup torque direction is now also controlled by motor mixing

* Clean up debug code and file logger

* Clean up gazebo example airframes

* Minor cleanup

* FIX warnings about missing initializer in fdm_gazebo

* Update documentation

* Remove modules section, move to firmware

* Minor fixes to fdm_gazebo and high_pass_filter

* Move actuator dynamics to included airframe files

Should prevent duplicate actuator defines spread accross all
airframe files.

* Fix FILTER_ROLL_RATE in bebop2_indi airframe

Moved to firmware targets so it will be disabled in gazebo.
Is this actually working in jsbsim??

* Update documentation

* Fix newlines

* Minor fixes in nps_fdm_gazebo.cpp

* Re-enable filter roll rate

Caution: causes oscillations around roll axis in gazebo

* Disable roll filter and cleanup
2018-01-30 16:39:18 +01:00
Felix Ruess 27124fe32f [nps] only search/link OpenCV if NPS_DEBUG_VIDEO is configured 2017-12-29 14:08:45 +01:00
Michal Podhradsky 1ccd44c523 [NPS] Add an option to not send NPS Ivy messages during simulation 2017-11-27 09:53:35 -08:00
Tom van Dijk 85c2b23c9f Set Gazebo world in flight plan (#2172)
* update documentation
* include flight_plan.h in nps_fdm_gazebo.cpp
2017-11-15 15:51:19 +01:00
Christophe De Wagter 0e7baf2472 [warnings] Fix warnings (#2183) 2017-11-10 12:52:16 +01:00
Kirk Scheper e84ff368c2 Add rangesensor module (#2158)
* added rangesensors to gazebo model and NPS
* added module to handle the range sensors
* added sender IDS and added to abi messages
* added abi message to flight plan guided
2017-11-06 17:16:13 +01:00
Kirk Scheper 3bf4b8731d [nps] load aircraft into gazebo at run time + actuator handling (#2135)
* load aircraft into gazebo at run time + actuator handling

* Remove environment from airframe
2017-10-26 14:36:38 +02:00
Tom van Dijk a710548b6a Fix incorrect in-flight acceleration measurements in Gazebo (#2128)
* Fix Gazebo acceleration measurement

Gazebo's GetWorldLinearAccel() did not seem to take the ardrone's
velocity_decay into account, instead it measured the drone's
acceleration *without drag* which resulted in incorrect measurements
in-flight (the drone's acceleration in world frame did not go to
zero when the drone reached its steady-state velocity).

Fixed by manually deriving the drone's world velocity over time,
as in [Gazebo's own IMU implementation](https://bitbucket.org/osrf/gazebo/src/e26144434b932b4b6a760ddaa19cfcf9f1734748/gazebo/sensors/ImuSensor.cc?at=default&fileviewer=file-view-default#ImuSensor.cc-370).

Created an issue for Gazebo [here](https://bitbucket.org/osrf/gazebo/issues/2363/linear-velocity_decay-not-included-in-link).

* Remove unnecessary whitespace changes

* Make dt (nps_fdm_gazebo.cpp:338) double instead of float
2017-10-20 14:33:32 +02:00
Kirk Scheper 68255aa454 updates to gazebo so simulate pressure and acceleration (#2120) 2017-10-18 22:30:07 +02:00
Michal Podhradsky 1039b8af4b Minor updates in Vectornav driver and HITL 2017-08-08 15:40:31 -07:00
Gautier Hattenberger 6a72c5da84 [pprzlink] allow to compile paparazzi with PPRZLINK v2 (#2083)
To activate, build project with correct option:
 PPRZLINK_LIB_VERSION=2.0 make
(note that 'make clean' is usualy required before that)
2017-06-29 10:38:30 +02:00
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
Michal Podhradsky e759df8208 Coverity fixes (#2074) 2017-06-07 18:34:56 -07:00
Michal Podhradsky 8f1e082cfe [HITL] Fixed fixedwing simulation - runs now nicely with Minion Lia as an example (#2054) 2017-04-15 23:16:44 +02:00
Ewoud Smeur d85ae584bd simulation of bebop1 (#2033)
* simulation of bebop1

* update bebop sim with correct motor pos
2017-03-07 11:52:43 -08:00
Gautier Hattenberger 41ae80a307 Wind estimation (#2028)
* [nps] add angle of attack and sideslip to NPS

* [module] extra_dl can work with nps

* [module] add sideslip sensor to aoa_pwm module and fix apogee board file

* [module] add wind estimation module

This module is an experimental wind estimation filter based on UKF that
aims at estimating all 3 local wind components in real-time.
It is based on ChibiOS as the algorithm runs in a dedicated thread.
The algorithm itself is generated from a Matlab/Simulink model.

* [tool] read Meso-NH meteo data and feed NPS with wind information

* [module] remove nps target from extra_dl, uart not well supported on FW

* [mesonh] remove unused UDP interface

* [chibios] add compilation error message for wind estimator module
2017-02-28 10:42:58 -08:00
Gautier Hattenberger 363dec8693 Autopilot refactor (#2009)
* [autopilot] refactor autopilot API for both firmwares

With this, fixedwing and rotorcraft are mostly using the same interface
for the autopilot. Some specific code and messages handling are still
firmware dependent.
A large part of the autopilot logic of the fixedwing is moved from
main_ap to autopilot_static.
More getter/setter functions are provided.

* [autopilot] update the rest of the system and the conf

for using the refactored autopilot API

* [autopilot] fix some errors from CI servers

* [actuators] use dummy actuators module to prevent autoloading

* Rename Bart_heliDD_INDI.xml to tudelft_bs_helidd_indi.xml

* Rename Bart_heliDD_pid.xml to tudelft_bs_helidd_pid.xml

* Delete tudelft_course2016_bebop_colorfilter.xml

* Delete tudelft_course2016_bebop_avoider.xml

* [actuators] don't autoload actuators when set to 'none'

* [gcs] autodetect firmware for strip mode button
2017-02-19 11:45:57 +01:00
Michal Podhradsky 829c9e1a33 [lidar] Cleanup and added lidar for NPS targets 2017-01-06 16:22:41 +01:00
Gautier Hattenberger 590c9040a7 [nps] add norc option to nps simulator 2016-12-19 22:07:45 +01:00
Michal Podhradsky 760793254f Fix NPS compilation on Mac OS (#1891) 2016-10-07 15:59:49 -07:00
Michal Podhradsky 49e058010e Nps update - proof of concept of HITL+SITL integration (#1831)
* FlighGear and Ivy thread working

* Main loop replaced with main_thread

* Cleaned up nps_main

* HITL main - test TX with Vectornav

* Added AggieAir control panel

* [modules] Flight logger module added

* [fixedwing] Airframe configuration updated

* [hitl] Proof Of Concept - IO and simulation running

* [nps] Minor changes in main hitl

* [nps] Performance Test with Pthread library

* [hitl] Working with pthreads instead of glib threads

* [hitl] Minor updates

* [nps] Refactoring to get rid of Gthreads

* [nps] Minor changes, added mutex guards

* [nps] Minor Ivy fix

* [nps] Threads working properly
[hitl] Ins separated

* [hitl] Check for launch variable

* [nps] Refactoring makefile into common and hitl/sitl specific

* [hitl] Hitl works, sitl too

* [hitl] ins_vectornav comments

* [hitl] Updated launch routine

* [nps_hitl Cleaned up version of NPS/HITL
- added support for ACTUATORS message (Rotorcraft)
- resolved start issue for Fixedwing (works fine now)
- minor improvements in threads (fg_thread, ap_init)

* [nps] Minor fixes to save current work

* [nps] Minor fixes

* Update to latest pprzlink

* FlighGear and Ivy thread working

* Main loop replaced with main_thread

* Cleaned up nps_main

* HITL main - test TX with Vectornav

* Added AggieAir control panel

* [modules] Flight logger module added

* [fixedwing] Airframe configuration updated

* [hitl] Proof Of Concept - IO and simulation running

* [nps] Minor changes in main hitl

* [nps] Performance Test with Pthread library

* [hitl] Working with pthreads instead of glib threads

* [hitl] Minor updates

* [nps] Refactoring to get rid of Gthreads

* [nps] Minor changes, added mutex guards

* [nps] Minor Ivy fix

* [nps] Threads working properly
[hitl] Ins separated

* [hitl] Check for launch variable

* [nps] Refactoring makefile into common and hitl/sitl specific

* [hitl] Hitl works, sitl too

* [hitl] ins_vectornav comments

* [hitl] Updated launch routine

* [nps_hitl Cleaned up version of NPS/HITL
- added support for ACTUATORS message (Rotorcraft)
- resolved start issue for Fixedwing (works fine now)
- minor improvements in threads (fg_thread, ap_init)

* [nps] Minor fixes to save current work

* [nps] Minor fixes

* Update to latest pprzlink

* Fixed the feed function

* Compilation fixes

* More compilation fixes

* Last compilation fixes

* Added a simple automated flight plan (auto take off and landing)

* Fixes in NPS

* Removed SBUS fakerator

* Removed superfluous "else"

* Renamed "flight recorder" to "xgear"

* Fixed formatting

* Updated extra_dl module

* Initial support for extra_dl to run over USB serial

* Fixed usb_serial for extra_dl

* extra_dl_periodic() called at TELEMETRY_FREQUENCY
2016-10-04 14:42:10 +02:00
Michal Podhradsky cf6af76b05 Sockets in flight gear - check for error conditions (#1793) 2016-07-12 16:42:02 -07:00
Michal Podhradsky 3365fa9e69 Coverity fixes vol. II (#1792)
* Coverity fixes vol. II

* Minor fixes
2016-07-12 13:28:40 -07:00
Michal Podhradsky 6b777fcbf3 Coverity fixes (#1790)
* Various coverity fixes (High Impact Outstanding)

* Removed typo in comment

* Removed wrong line of code.

* Minor fixes

* snprintf finally done right

* Added space

* Wind direction finally OK
2016-07-11 15:58:23 -07:00
Felix Ruess 3b6c7d6a68 use functions instead of deprecated math macros 2016-07-01 11:49:08 +02:00
Felix Ruess 40a4803fbd [dox] fix some doxygen comments 2016-06-21 20:37:34 +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
Felix Ruess 5c1e4260fe replace bool_t with C99 bool from stdbool.h 2016-03-31 15:26:44 +02:00
Felix Ruess 0634a82b71 [nps] only feed gps if USE_GPS 2016-03-24 16:25:47 +01:00
Felix Ruess d22c7be474 [nps] fix WORLD_ENV_REQ IVY message 2016-03-14 22:48:05 +01:00
Felix Ruess 8564baaced [nps] fix WORLD_ENV_REQ IVY message
request messages in advanced format use underscore to separted pid from sequence
2016-03-14 22:41:38 +01:00
Gautier Hattenberger 87e97685ea [nps] add support for WORLD_ENV_REQ message
and fix typo for soket input
2016-03-11 14:47:11 +01:00
Gautier Hattenberger d4318671ca [nps] update wind from flight gear input socket 2016-03-11 13:44:27 +01:00
Felix Ruess 625d7558a5 [nps] add forgotten temp sensor files 2016-03-09 15:13:31 +01:00
Felix Ruess 02ede2519f [nps] add temp sensor, baro uses pressure from fdm 2016-03-09 13:58:53 +01:00
Felix Ruess 7c2bd76c56 [nps] get airspeed, pressure and temp from FDM 2016-03-08 11:50:50 +01:00
Felix Ruess 2c18a3839a [nps][fixedwing] fix sim_overwrite_ins 2016-03-07 23:23:02 +01:00
Felix Ruess d39a027c21 [nps] simulate airspeed sensor 2016-03-07 14:59:35 +01:00
Felix Ruess 6d75f4aae8 [nps] fix sonar init 2016-03-07 11:43:59 +01:00
Gautier Hattenberger c049e4b160 [pprzlink] start fixing some compilation issues 2016-01-08 23:25:07 +01:00
Gautier Hattenberger e96b4e48af fix header include in nps 2015-12-29 00:08:32 +01:00
Felix Ruess 718abd61fc fix some warnings, fabs instead of abs 2015-11-19 17:36:27 +01:00
Felix Ruess b050714681 [nps] add possibility to disable datalink again 2015-11-04 22:47:40 +01:00
Felix Ruess aba6faefcd [nps] remove datalink_enabled hacks 2015-11-04 22:43:37 +01:00
Felix Ruess 00cdd548d3 [nps] use UDP instead of IVY telemetry
- get rid off all the datalink parsing "hacks" and use the actual parser from the firmware
- this however means that you need to run link with the -udp option to use the NPS sim
2015-11-04 22:21:32 +01:00
Felix Ruess 65703aa5f0 [nps] ignore unused arg warnings in JSBSim lib 2015-09-20 16:46:33 +02:00
Felix Ruess 0f4a2034c9 [nps] reformat files 2015-08-06 21:39:34 +02:00