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

Pan servo home direction offset #6501

Merged
merged 6 commits into from
Feb 26, 2021

Conversation

avsaase
Copy link
Member

@avsaase avsaase commented Jan 13, 2021

Resolves #6500 (@Jetrell can you confirm this is what you asked for?). This PR creates two cli commands: osd_pan_servo_index to select the pan servo and osd_pan_servo_pwm2centideg to set the rotation of the pan servo as a function of the pwm signal. For a 180 degrees servo this most likely needs to be set to 18. Change the sign to reverse the offset direction.

Example:

pan_servo_home_dir_offset.mp4

Testing this on the bench is a bit of a hassle. I found the easiest way is to set a safehome nearby and remove && isImuHeadingValid() from

if (STATE(GPS_FIX) && STATE(GPS_FIX_HOME) && isImuHeadingValid()) {

This could also be applied to other OSD elements, the HUD elements would be good candidates for this (obviously that also needs a tilt offset). If there is interest I can make a separate PR for that or add it to this one.

@Jetrell
Copy link

Jetrell commented Jan 13, 2021

@avsaase Wow. I wasn't expecting anyone to take any notice this soon.
Plus, I didn't go into every detail.
In fact, I was expecting some negative questions concerning the operation of such a function.

The need for such a function. Is because to our minds getting confused between what we see in the camera and what the home arrow is trying to tell us.
This can easily happen when sight seeing in an unfamiliar location and especially when the camera is panned less than 40° left or right of center. Under these slight pan offset conditions, it is not always obvious that the camera isn't facing in the direction the plane is traveling. This can lead to a major heading changes over a distance.

e.g. If the plane is heading due east 90° and your home location is 30° to your right at that given distance.
If you then pan to the right 30° and look at your home location, you will see that the home arrow is now pointing 30° to the right of the home location you are looking at.
This can lead to confusion. Because you believe that your looking at the home location, but the arrow is saying that home is 30° to the right, of what you visually believe is home. This PR will fix that.

Although, there is another problem that also has to be addressed..... That is, the plane will not be heading towards the home. Even though you could be looking in the direction of home and the home arrow (with the new feature) will now confirm this.
So the pilot needs to be made aware that the pan servo is offset and the camera is not facing forwards. Otherwise he will never make the right course correction to bring the plane back towards home.

My idea would be to add another addition to this PR you have implemented.
This addition would make the home arrow FLASH as a reminder that the arrow is showing him the direction of home according to the direction the camera is panned.. But the plane is not heading towards home. So he must bring the pan servo back within a few degrees of center, before the home arrow will stop flashing. Then he can make his course correction for home.

How does this sound to you?

@avsaase
Copy link
Member Author

avsaase commented Jan 13, 2021

I understand why you asked for this feature, but in any case it can never solve all problems because the COG is often not the same as the direction the camera points due to crosswinds. I think flying with camera pan can always be confusing if you forget you're not looking straight ahead, regardless of this PR. Maybe a separate pan degree OSD element would be a better solution for this?

@DzikuVx DzikuVx added this to the 2.7 milestone Feb 3, 2021
@DzikuVx DzikuVx added the Release Notes Add this when a PR needs to be mentioned in the release notes label Feb 3, 2021
@avsaase
Copy link
Member Author

avsaase commented Feb 3, 2021

I have not tried this out in flight as I don't have a pan servo setup, but the more I think about it the more confusing I think this option may be. I'll leave it up to the devs to decide what they want to do with this PR.

@Jetrell
Copy link

Jetrell commented Feb 7, 2021

The more I think about it the more confusing I think this option may be. I'll leave it up to the devs to decide what they want to do with this PR.

@avsaase
I thought more about what you said Alexander. And your right.
If the user doesn't have a full understanding of how this PR works. There is potential of it leading to home arrow navigation issues in manual modes.

This feature aligns the instrumentation (home arrow) with camera image, to prevent confusion. And its nice to have that confirmation between the two. But the logic conditions below should be implemented by the user to assist the feature.

These OpenTX conditions, will prevent the Pan servo being left slightly offset. It will automatically aligning the camera with the planes heading after 25 seconds, if the pan servo is not being manually driven within that period of time..
Something similar can be accomplished using iNav programming functions.

OpenTx setup

@avsaase I would like to thank you for noticing my feature request and the time you put into writing this PR. I don't take for granted the effort you guys put in.

This PDF explains the feature limitations and setup in more detail for user who find this PR
3.0 Pan camera offset.pdf

@DzikuVx DzikuVx merged commit c15a462 into iNavFlight:master Feb 26, 2021
@avsaase avsaase deleted the avs-pan-servo-home-dir-offset branch February 26, 2021 20:07
@MrD-RC
Copy link
Collaborator

MrD-RC commented Apr 11, 2021

This sounds really cool. The home arrow being based on the viewing direction makes a lot of sense to me.

What would also be cool, would be the inverse of this. So a mode where the camera looks towards the home direction. That way, if you do get lost in an unfamiliar area, it's even easier to find your way back. Enable the pan follows home point mode and bank around until you're flying towards home. I think then you would also benefit from an OSD pan direction indicator, like @avsaase mentioned earlier.

Nice work guys.

@Jetrell
Copy link

Jetrell commented Apr 11, 2021

@MrD-RC I tested it out a while back and it works well. Alexander done a good job with it.
I often use Pan and Tilt and also fly at night with it. This gives reassurance on those times when I'm flying in 3CRS and just sight seeing.
If you haven't seen it already. Have a look through the PDF i left. To help tune the Pan servo position for best accuracy.

@MrD-RC
Copy link
Collaborator

MrD-RC commented Apr 11, 2021

Nice @Jetrell. Mind if I share the PDF in an article I’m writing on the changes in 3.0.

@DanO83
Copy link

DanO83 commented Jun 22, 2021

I have just tested this new feature, but for me the configured degrees doesn't match the servo travel. I guess the problem is my servo needs a PWM signal from 500 to 2500, so it looks like I have the use half the degrees value to make it work properly.

@avsaase
Copy link
Member Author

avsaase commented Jun 22, 2021

@danielolsman What kind of servos are that? I've never heard of that before. This feature indeed assumes servos that use 1000-2000 us PWM, so if you have double that range you probably need to double or halve something.

@DanO83
Copy link

DanO83 commented Jun 22, 2021

This is the servo I have :
https://banggood.app.link/UL7bC506hhb

it's no big deal, I will change the value until it's right. I have lowered the value and it's getting closer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release Notes Add this when a PR needs to be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Home arrow offset, to correct pan servo camera direction
5 participants