Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gazebo] Simulate Bebop1 camera #2225

Merged
merged 9 commits into from Feb 4, 2018

Conversation

tomvand
Copy link
Contributor

@tomvand tomvand commented Feb 1, 2018

New:

  • Set up fisheye front camera for the bebop model
  • Adjust FoV of bebop model's bottom camera
  • Emulate MT9F002_OUTPUT_[WIDTH|HEIGHT], MT9F002_OUTPUT_SCALER and MT9F002_TARGET_FPS defines.

Fixed:

  • Removed NPS_SIMULATE_VIDEO define from conf/simulator/gazebo/airframes/ardrone2.xml as this is already set by the video_thread module and should not be set if the video is not used.

Copy link
Member

@kirkscheper kirkscheper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might also consider updating the course 2017 to course 2018

image_create(img, cam->ImageWidth(), cam->ImageHeight(), IMAGE_YUV422);
xstart = 0;
ystart = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can set these in the definition of the variables and remove these. Seems safer

@@ -638,12 +668,22 @@ static void init_gazebo_video(void)
gazebo_cams[i].cam = cam;
gazebo_cams[i].last_measurement_time = cam->LastMeasurementTime();
// Copy video_config settings from Gazebo's camera
#if defined(MT9F002_OUTPUT_WIDTH) && defined(MT9F002_OUTPUT_HEIGHT)
// See boards/bebop/mt9f002.c
cameras[i]->output_size.w = MT9F002_OUTPUT_WIDTH;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this set every camera to the settings of the front camera when this is defined? Shouldn't you check that the current cam is indeed the front camera?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, fixed!

@@ -98,7 +98,15 @@ struct gazebocam_t {
};
static struct gazebocam_t gazebo_cams[VIDEO_THREAD_MAX_CAMERAS] =
{ { NULL, 0 } };

// For bebop camera simulation
#ifndef MT9F002_INITIAL_OFFSET_X
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange to include this here, isn't it better to include mt9f002.h here instead. That has all the defaults of that camera. It should only be included if that sensor is used though.

Alternatively you can add an nps_sensors_params file for the bebop sensors.

At some point we are going to have to split this file up. Adding all the sensors here seems like it is a bad idea (for later though).

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.
@tomvand
Copy link
Contributor Author

tomvand commented Feb 2, 2018

All problems should be fixed now.

I will update the name in a later pull request when the mavlabCourse branch has been completely set up.

@kirkscheper kirkscheper merged commit ff8c58a into paparazzi:master Feb 4, 2018
biancabndris pushed a commit to biancabndris/paparazzi that referenced this pull request Aug 29, 2018
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants