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
Conversation
SetImageSize() is ignored and SetEnvTextureSize() causes an exception. Currently the camera output is too large for real-time operation.
There was a problem hiding this 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
sw/simulator/nps/nps_fdm_gazebo.cpp
Outdated
image_create(img, cam->ImageWidth(), cam->ImageHeight(), IMAGE_YUV422); | ||
xstart = 0; | ||
ystart = 0; |
There was a problem hiding this comment.
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
sw/simulator/nps/nps_fdm_gazebo.cpp
Outdated
@@ -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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, fixed!
sw/simulator/nps/nps_fdm_gazebo.cpp
Outdated
@@ -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 |
There was a problem hiding this comment.
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.
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. |
* 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.
New:
Fixed: