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

mocap: add SetVisionSpeedEstimate #361

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Luc-Meunier
Copy link

@Luc-Meunier Luc-Meunier commented Jan 19, 2025

Hi, we would like to add the VISION_SPEED_ESTIMATE (103) MAVLink message to the mocap proto.

See https://mavlink.io/en/messages/common.html#VISION_SPEED_ESTIMATE

Relates to issue mavlink/MAVSDK#2497

Copy link
Collaborator

@julianoes julianoes left a comment

Choose a reason for hiding this comment

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

Thanks for the pull request! Just one question regarding a comment.

// Global speed estimate from a vision source.
message VisionSpeedEstimate {
uint64 time_usec = 1; // PositionBody frame timestamp UNIX Epoch time (0 to use Backend timestamp)
SpeedBody speed_body = 2; // Global speed (m/s)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just wondering on the frame here? When you see "Global" do you mean in North, East, Down, or Forward, Left, Down? I'm pretty sure "Body" would imply in body frame, so Forward, Left, Down.

Copy link
Author

@Luc-Meunier Luc-Meunier Jan 19, 2025

Choose a reason for hiding this comment

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

Hi @julianoes! Thanks for the review!

I used the same description as in the MAVLink doc, but I guess this is a typo.

However, I see in the VisionPositionEstimate a similar case:
PositionBody position_body = 2; // Global position (m)
Should I fix it too?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Interesting. Might be worth checking what PX4 expects and whether we should update the MAVLink messages description.

Copy link
Collaborator

Choose a reason for hiding this comment

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

For position, PX4 expects NED:

https://github.com/PX4/PX4-Autopilot/blob/1eb9434b8c39fef3691684df520686231dce3939/src/modules/mavlink/mavlink_receiver.cpp#L1319C40-L1322

I don't see vision speed being used in PX4. How are you testing this?

Copy link
Author

Choose a reason for hiding this comment

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

Actually, we are currently testing with ArduPilot.
We used Intel RealSense T265 as an example (see https://ardupilot.org/copter/docs/common-vio-tracking-camera.html).

I suggest changing the "Global speed (m/s)" comment to "Body speed (m/s)"

Choose a reason for hiding this comment

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

Hi all,
to clear this up a bit, if we follow the mocap position from MAVSDK.

  1. The mocap function set_vision_position_estimate() expects global position(NED) according to documentation the input parameter for this function calls the position PositionBody so this might be a typo.
  2. MAVSDK uses the mavlink VISION_POSITION_ESTIMATE message which according to documentation expects the local frame(FRD, not body).
  3. Ardupilot does not differentiate between local(FRD) and global(NED) frame as it doesn't have a local frame, so it interprets the position in global frame. In fact, it processes the messages VISION_POSITION_ESTIMATE and GLOBAL_VISION_POSITION_ESTIMATE the same way, see here

Ardupilot also expects global(NED) position from the mocap class, and consequently global(NED) velocity. So, if PX4 is the same, I think the only thing that needs to be changed is the variable's name in the VisionPositionEstimate structure, as @Luc-Meunier suggested.
Let me know if you agree

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, so if both PX4 and ArduPilot interpret the values as NED, that's good news. In that case I'm tempted to rename the PositionBody type to PositionNed to make it clear. And then we should update the MAVSDK and MAVLink docs to make it clear.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks @fed12345 and @julianoes, I added a SpeedNed struct.

Copy link

Choose a reason for hiding this comment

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

Hello,

Just as a quick follow-up to this:

I'm tempted to rename the PositionBody type to PositionNed to make it clear...

To us it also seems like a good idea, should we do it in another PR or would it fly to add it in this one?
Aside from that, is there anything else that we should take care of?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks, sorry, I'll get back to this asap.

@Luc-Meunier Luc-Meunier force-pushed the vio branch 2 times, most recently from 64239d8 to f6ec875 Compare January 23, 2025 09:41
Co-authored-by: miodine <48156138+miodine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants