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

Zoom slew rate #81

Merged
merged 4 commits into from
Jan 30, 2024
Merged

Zoom slew rate #81

merged 4 commits into from
Jan 30, 2024

Conversation

Ryanf55
Copy link
Contributor

@Ryanf55 Ryanf55 commented Jan 23, 2024

Purpose

Solves #57 , implementing a zoom slew rate to give realistic zoom effect for optical cameras like the Nikon P1000.

Usage

Add the following to your CameraZoomPlugin:

<slew_rate>0.42514285714</slew_rate>

The value is camera-specific and can be calculated per the issue description.

Demo

zoom-plugin-demo.mp4

Dependencies

Depends on #79 to go in first.

Assumptions

  • This plugin is only used with pinhole lense cameras, which I don't think is enforced.

@Ryanf55 Ryanf55 changed the title Zoom slew Zoom slew rate Jan 23, 2024
@srmainwaring
Copy link
Collaborator

srmainwaring commented Jan 25, 2024

@Ryanf55 - can you update base to target main. We'll port to ros2 once it's merged. (The ros2 branch only runs when launched using ROS launch scripts because of upstream package resolution issues).

Update done already, prior to review.

@srmainwaring srmainwaring added the enhancement New feature or request label Jan 25, 2024
@srmainwaring srmainwaring self-assigned this Jan 25, 2024
@srmainwaring srmainwaring changed the base branch from ros2 to main January 25, 2024 09:27
src/CameraZoomPlugin.cc Outdated Show resolved Hide resolved
src/CameraZoomPlugin.cc Outdated Show resolved Hide resolved
src/CameraZoomPlugin.cc Outdated Show resolved Hide resolved
src/CameraZoomPlugin.cc Outdated Show resolved Hide resolved
src/CameraZoomPlugin.cc Outdated Show resolved Hide resolved
src/CameraZoomPlugin.cc Outdated Show resolved Hide resolved
src/CameraZoomPlugin.cc Outdated Show resolved Hide resolved
@srmainwaring
Copy link
Collaborator

@Ryanf55 - fix for the zoom returning to initial position in Ryanf55#1.

@Ryanf55
Copy link
Contributor Author

Ryanf55 commented Jan 27, 2024

I had to add a fix for if the user doesn't specify slew_rate to behave like before without a crash. Everything seems to work for both cases now.

Ryanf55 and others added 4 commits January 30, 2024 22:47
* Implements slew rate for zooming configured in m/s

Signed-off-by: Ryan Friedman <[email protected]>
* Infinite rate would crash, now it has special handling

Signed-off-by: Ryan Friedman <[email protected]>
Copy link
Collaborator

@srmainwaring srmainwaring left a comment

Choose a reason for hiding this comment

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

Looks good. Removed merge commit and updated commit comments with Camera: prefix in force push.

if (this->impl->zoomChanged) {
// Only calculate goal once each time zoom is changed.
const auto requestedZoomCmd = this->impl->zoomCommand.load();
const auto clampedZoomCmd = std::clamp(requestedZoomCmd,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Something is not quite right with the constraints. After zooming in I reset the zoom to the minimum factor using

gz topic -t "/model/gimbal/sensor/camera/zoom/cmd_zoom" -m gz.msgs.Double -p "data: 1.0"

but there was no response. Using any value larger than 1.0 is working (e.g. 1.00000001).

@srmainwaring srmainwaring merged commit 7e620cc into ArduPilot:main Jan 30, 2024
3 checks passed
@Ryanf55 Ryanf55 deleted the zoom-slew branch January 31, 2024 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants