-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Restructure bebop camera settings and ISP #2364
Conversation
271e1d5
to
005a50b
Compare
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.
except for the comment, it looks fine
005a50b
to
dfbd94b
Compare
dfbd94b
to
8317e60
Compare
8317e60
to
9acb599
Compare
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.
- great that many parameters are now computed
- great that the remaining parameters have documentation
- ok to have a bebop camera for that
- good to move the isp to bebop
- would be better to also compute default camera parameters
- should understand why this virtmem is needed
- should understand what the blanking is doing
Thanks, I will complete this in the new year after the stable release. |
9acb599
to
3984255
Compare
3984255
to
b5f9c2e
Compare
b5f9c2e
to
95c1071
Compare
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 to merge
This pull request updates the Bebop camera simulation in order to work with the new defines and settings from #2364. It also includes a number of small fixes by @kirkscheper . The new setup renders the entire camera sensor, which allows the crop and zoom settings to be changed at runtime just as on the real drone. The resolution of the simulated sensor can be reduced for better runtime performance. ---- * update gazebo sim camera * WIP Revert Bebop SDF cam hfov to 3.0, TODO update to full sensor size * WIP mt9f002.c remove OUTPUT_SCALER comment * WIP FIX image.c casting problem vectors.pos is now cast to float to prevent unwanted implicit casting to uint. I did not change the point_t types as I do not have time to test this, but this would be a good idea for a later pull request. * WIP lucas_kanade.c comment keep_bad_points * WIP opticflow_module.c replace memcpy with assignment for readability * WIP nps_fdm_gazebo fix mt9f117 check for bottom_cam instead of front_cam * WIP nps_fdm_gazebo do not set env_texture_size The current size (2048) is probably large enough for all realistic ZOOM settings. * WIP ERROR nps_fdm_gazebo fix camera, corrupt image in gazebo :/ * WIP ERROR zoom is not tuneable at runtime :/ * WIP fixed sensor resolution in gazebo Since the zoom should be adjustable at runtime, the zoom factor will need to be implemented in the image sampling routine, it cannot be set beforehand in the bebop model. * WIP include mt9f002.c and mt9v117.c in NPS Added simple wrapper files to prevent overwriting the video_thread_nps.c ones. * WIP enable runtime zoom and offset changes for mt9f002 in NPS! Zoom and offset settings can now be adjusted at runtime just like on the real drone. The mt9f002.c code handles the bounds checking etc. * WIP take out string comparison in read_image * WIP ignore GCC errors that do not appear in compilation for ARM Might be better to actually fix these errors, but I am not familiar with that part of the code. * WIP remove todo file * FIX ardrone2_gazebo build error linking error was caused by undefined reference to mt9f002 struct (which is not used in the ardrone). Removing the NPS MT9F002 define means that this struct is always linked, even though it may not be used. To fix, I added an empty `__attribute__((weak))` struct that prevents these linking errors, but could cause unexpected behavior when a Bebop model or other model with mt9f002 camera is used without the bebop_cam module. * FIX naming conflict after merge * FIX Allow arbitrary simulated sensor sizes for runtime improvement The FDM can now handle arbitrary sizes for the camera sensor. This allows the sensor size to be reduced from the real-world 4608x3288 to a lower resolution to reduce rendering times, at the cost of lower-resolution images. The downscaling of the sensor is controlled using the `NPS_MT9F002_SENSOR_RES_DIVIDER` define. * Update Bebop 2 gazebo models for new front- and bottom cam code
This pull request updates the Bebop camera simulation in order to work with the new defines and settings from paparazzi#2364. It also includes a number of small fixes by @kirkscheper . The new setup renders the entire camera sensor, which allows the crop and zoom settings to be changed at runtime just as on the real drone. The resolution of the simulated sensor can be reduced for better runtime performance. ---- * update gazebo sim camera * WIP Revert Bebop SDF cam hfov to 3.0, TODO update to full sensor size * WIP mt9f002.c remove OUTPUT_SCALER comment * WIP FIX image.c casting problem vectors.pos is now cast to float to prevent unwanted implicit casting to uint. I did not change the point_t types as I do not have time to test this, but this would be a good idea for a later pull request. * WIP lucas_kanade.c comment keep_bad_points * WIP opticflow_module.c replace memcpy with assignment for readability * WIP nps_fdm_gazebo fix mt9f117 check for bottom_cam instead of front_cam * WIP nps_fdm_gazebo do not set env_texture_size The current size (2048) is probably large enough for all realistic ZOOM settings. * WIP ERROR nps_fdm_gazebo fix camera, corrupt image in gazebo :/ * WIP ERROR zoom is not tuneable at runtime :/ * WIP fixed sensor resolution in gazebo Since the zoom should be adjustable at runtime, the zoom factor will need to be implemented in the image sampling routine, it cannot be set beforehand in the bebop model. * WIP include mt9f002.c and mt9v117.c in NPS Added simple wrapper files to prevent overwriting the video_thread_nps.c ones. * WIP enable runtime zoom and offset changes for mt9f002 in NPS! Zoom and offset settings can now be adjusted at runtime just like on the real drone. The mt9f002.c code handles the bounds checking etc. * WIP take out string comparison in read_image * WIP ignore GCC errors that do not appear in compilation for ARM Might be better to actually fix these errors, but I am not familiar with that part of the code. * WIP remove todo file * FIX ardrone2_gazebo build error linking error was caused by undefined reference to mt9f002 struct (which is not used in the ardrone). Removing the NPS MT9F002 define means that this struct is always linked, even though it may not be used. To fix, I added an empty `__attribute__((weak))` struct that prevents these linking errors, but could cause unexpected behavior when a Bebop model or other model with mt9f002 camera is used without the bebop_cam module. * FIX naming conflict after merge * FIX Allow arbitrary simulated sensor sizes for runtime improvement The FDM can now handle arbitrary sizes for the camera sensor. This allows the sensor size to be reduced from the real-world 4608x3288 to a lower resolution to reduce rendering times, at the cost of lower-resolution images. The downscaling of the sensor is controlled using the `NPS_MT9F002_SENSOR_RES_DIVIDER` define. * Update Bebop 2 gazebo models for new front- and bottom cam code
This is my effort at completing #2180. I implemented the changes that were made there (that I believed to be correct) as well as the recommended preset resolutions (VGA, 720p, 1080p and full resolution).
One of the changes was in how the camera settings were used, I built upon these suggestions and updated the settings. Now the user only sets the output resolution, image zoom and centre offsets and the rest is computed to generate a good output.
As the isp can only be used with the bebop, I moved the isp files to the bebop board folder.
In the process of doing this I realised that the documentation for the bebop cameras was quite poor and decided to make a module for the bebop cameras so that the settings can be auto documented. This results in an additional module to include in the airframe. To make this a little easier I changed all video_thread includes in bebop airframes to bebop_cam (which autoloads video_thread, plz let me know if you disagree or have an alternative).
There are also some miscellaneous changes that I found while implementing the upgrades (e.g. a setting for camera with the bebop_ae_awb even though it explicitly only works with the front camera).
Apologies for another large PR but I think that this simplifies and clarifies the camera usage for the bebop.