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

Copter: Add an element of NAV_CONTROLLER_OUTPUT to ZIGZAG mode #17456

Conversation

muramura
Copy link
Contributor

@muramura muramura commented May 16, 2021

The distance from point A to point B in ZIGZAG mode will be several tens of meters to several hundred meters.
In this case, the operator will not know until the WP is reached.
In Japan, the assistant will notify the distance between the WP and the vehicle by transceiver.
The auxiliary notifies 10 meters, 5 meters, and 0 meters before the WP.
I would like to add this notification to ZIGZAG.

AFTER:
Screenshot from 2021-05-16 14-19-13

Copy link
Contributor

@khancyr khancyr left a comment

Choose a reason for hiding this comment

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

Adding this much parameters for optional notifications is a no go for me

@muramura
Copy link
Contributor Author

muramura commented May 16, 2021

@khancyr san.
The parameters that could be reduced are 2 and 3.
In this case, if the distance to be notified can be calculated from the flight speed and the distance to the WP, and if the distance can be notified within 10m or 5m, I think 2 and 3 can be removed.
Is there a problem with my idea?

  1. Suppression of message notification
  2. 10 meter message notification distance
  3. 5 meter message notification distance

@muramura muramura force-pushed the AP_Add_WP_front_notifications_to_ZIGZAG_mode branch from a4f8daa to afb1c47 Compare May 16, 2021 09:31
@muramura
Copy link
Contributor Author

@khancyr san.
I made a decision based on the expected distance 500 milliseconds after the flight speed.
The 500 milliseconds takes into account the time it takes for the GCS to receive the message and provide voice notification.

@muramura muramura force-pushed the AP_Add_WP_front_notifications_to_ZIGZAG_mode branch from afb1c47 to 2243b49 Compare May 16, 2021 23:27
@peterbarker
Copy link
Contributor

This information can be conveyed in the NAV_CONTROLLER_OUTPUT message instead.

Implement

    virtual int32_t wp_bearing() const { return 0; }
    virtual uint32_t wp_distance() const { return 0; }

on mode_zigzag instead.

This information is presented in the MAVProxy interface you've pasted in anbove.

Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

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

Use NAV_CONTROLLER_OUTPUT instead.

@muramura
Copy link
Contributor Author

@peterbarker san. I would change it to NAV_CONTROLLER_OUTPUT.

@muramura muramura force-pushed the AP_Add_WP_front_notifications_to_ZIGZAG_mode branch from 2243b49 to 05857b9 Compare May 17, 2021 23:17
@muramura muramura changed the title Copter: Add WP front notifications to ZIGZAG mode Copter: Add an element of NAV_CONTROLLER_OUTPUT to ZIGZAG mode May 17, 2021
@muramura
Copy link
Contributor Author

I added the following methods.
I was able to get distance, direction and cross error in telemetry.

uint32_t wp_distance() const override { return wp_nav->get_wp_distance_to_destination(); }
int32_t wp_bearing() const override { return wp_nav->get_wp_bearing_to_destination(); }
float crosstrack_error() const override { return wp_nav->crosstrack_error(); }

Screenshot from 2021-05-18 08-07-58

Copy link
Contributor

@khancyr khancyr left a comment

Choose a reason for hiding this comment

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

Excellent, that is much better !

@peterbarker
Copy link
Contributor

Much nicer :-)

image

One caveat - we send the NAV_CONTROLLER_OUTPUT all the time, and the packet doesn't have a field to indicate if it is in use. That means MAVProxy has a fixed list of modes in which to display the NAV_CONTROLLER_OUTPUT message, and ZIGZAG isn't on that list. I added it to take that screenshot.

What this means is that while being piloted in manual mode the distance-to-waypoint message will update to grow - as we're moving away from the previous target.

Still, this is much better than statustexts :-)

@rmackay9
Copy link
Contributor

I'm not super keen on how it points towards the last waypoint when the pilot is flying the manually flying the vehicle. I think we need to find a way so that the GCSs (especially MP) don't show the line pointing back to the last waypoint. Could you try setting the distance to zero and see how the GCSs handle this?

Comment on lines +1573 to +1575
uint32_t wp_distance() const override { return wp_nav->get_wp_distance_to_destination(); }
int32_t wp_bearing() const override { return wp_nav->get_wp_bearing_to_destination(); }
float crosstrack_error() const override { return wp_nav->crosstrack_error(); }
Copy link
Contributor

Choose a reason for hiding this comment

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

We should send back zero for all of these while in the pilot-controlled aspect of zigzag.

@khancyr
Copy link
Contributor

khancyr commented Jul 14, 2021

@muramura hello, could you address Peter request ?

@khancyr
Copy link
Contributor

khancyr commented Sep 21, 2023

closed by #23327

@khancyr khancyr closed this Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants