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

Create geofence that uses a circle instead of a polygon #135

Closed
mfran89 opened this issue Jul 24, 2023 · 9 comments
Closed

Create geofence that uses a circle instead of a polygon #135

mfran89 opened this issue Jul 24, 2023 · 9 comments

Comments

@mfran89
Copy link

mfran89 commented Jul 24, 2023

Hey team!

I am currently looking into passing a keepout geofence circle using the geofence functionality through the System class (system.getGeofence()). So far I am able to pass polygons to be used as geo fences (both inclusive and exclusive). However I was hoping there was a way to pass a center point (lat, long) and radius , like a Drawingcircle object, as a geofence but I do not see that as an ability. For reference I am trying to pass something like this mavlink command https://mavlink.io/en/messages/common.html#MAV_CMD_NAV_FENCE_CIRCLE_EXCLUSION , does the java mavsdk allow the end user to pass this somehow?

Currently the only option I can think of is creating a polygon in the shape of a circle mathematically but I am not sure if there are other ways to do this either. Also I know for mavsdk c++ has a mavlink passthrough class but I dont think that is available for the mavsdk java library correct?

@JonasVautherin
Copy link
Collaborator

Hmm I think it is supported in the main branch of MAVSDK, which hasn't been released (it will be MAVSDK v2). See here: https://github.com/mavlink/MAVSDK-Proto/blob/main/protos/geofence/geofence.proto#L44

Until then, I'm afraid you have to build MAVSDK from sources.

@mfran89
Copy link
Author

mfran89 commented Jul 24, 2023

So for now if I dont build from source would you suggest that creating a polygon based of the center and radius of the circle is my best bet, and if so should I worry about a max set of points for the polygon or anything like that?

@JonasVautherin
Copy link
Collaborator

I think that in MAVLink, the geofence uses the mission protocol, which is extremely inefficient (it requires one round-trip per item). So yeah, if you don't want to compiles the main branch, then use as few points as you can accept 😅.

@mfran89
Copy link
Author

mfran89 commented Jul 24, 2023

Just making sure I understand this but there is no other way to pass the mavlink command I mentioned above correct? There is no method of Mavlink Passthrough for mavsdk java correct?

Also when will MavSDK v2 be released?

@JonasVautherin
Copy link
Collaborator

There is no method of Mavlink Passthrough for mavsdk java correct?

Hmm maybe by hijacking the mission_raw plugin? Not sure though. I would just compile from sources.

Also when will MavSDK v2 be released?

It is not planned, but the roadmap to v2 is here: mavlink/MAVSDK#2002

@mfran89
Copy link
Author

mfran89 commented Jul 25, 2023

Hypothetically if I did want to build from source would I just need to pull this repo and update the proto files for this repo to use the main branch of MAVSDK-Proto, and then build it ? Or would I need to also to some other steps to get this properly built from source?

@JonasVautherin
Copy link
Collaborator

You need to build https://github.com/mavlink/MAVSDK for your platform (that's where mavsdk_server comes from), build this repo, and use them together. Are you building for Android?

@mfran89
Copy link
Author

mfran89 commented Jul 25, 2023

Yes I am building for android, will go through the steps you mentioned.

@JonasVautherin
Copy link
Collaborator

JonasVautherin commented Jul 25, 2023

I would say that the first step is to cross-compile MAVSDK for Android. Check how we do it in CI: https://github.com/mavlink/MAVSDK/blob/main/.github/workflows/main.yml#L385. You should be able to run almost exactly that (minus some CI tricks and environment variables, of course).

@mfran89 mfran89 closed this as completed Jul 28, 2023
@mfran89 mfran89 reopened this Jul 28, 2023
@mfran89 mfran89 closed this as completed Jul 28, 2023
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

No branches or pull requests

2 participants