mavlink / MAVSDK-Java

MAVSDK client for Java.
68 stars 40 forks source link

sending commands in java #88

Closed zeev-mindali closed 2 years ago

zeev-mindali commented 2 years ago

Dear all,

after struggling to connect mavsdk to apm drone via herelink, i was finally able to connect :)

how do i send commands to the drone?

in mav proxy, i send the command: COMMAND_LONG 0 0 183 0 7 1500 0 0 0 0 0

how can i achieve that with mavsdk? once i will be able to send this commands, i can finally write a simpler higher level of sdk to implement both px4 and apm for novice users.

JonasVautherin commented 2 years ago

You don't have access to low-level mavlink messages, just the MAVSDK API. So all the functions defined here.

For instance, you don't send a command to takeoff, you call drone.getAction().takeoff().subscribe(). Did you manage to run one of the examples?

zeev-mindali commented 2 years ago

dear friend,

this is not my issue, i want to control the aux or servo for controlling custom camera. with mavproxy i was able to send the commands. is there a way to send the commands with mavsdk?

JonasVautherin commented 2 years ago

In MAVSDK-C++, you can use the mavlink_passthrough. In MAVSDK-Java, you have to use the API given above.

This said, MAVSDK-Java has the set_actuator function, which I believe would do what you want in PX4. It uses the MAV_CMD_DO_SET_ACTUATOR mavlink message. Does that not work in Ardupilot?

I think you mentioned MAV_CMD_DO_SET_SERVO in another thread. Is that what is used by Ardupilot? Would you be able to add support for MAV_CMD_DO_SET_ACTUATOR into Ardupilot? That way it would work with MAVSDK, maybe.

zeev-mindali commented 2 years ago

MAV_CMD_DO_SET_SERVO can control PWM values of servo 1-8 in mav proxy it's works, don't know if APM can handle actuator, didn't found it

zeev-mindali commented 2 years ago

I end up trying now to run mavsdk server for connection and low level (dronefleet.io) for commands. if not, I will write entire new sdk for all the commands of apm and px4 wrapper, to upper level.

Zxr1230 commented 10 months ago

Dear all,

after struggling to connect mavsdk to apm drone via herelink, i was finally able to connect :)

how do i send commands to the drone?

in mav proxy, i send the command: COMMAND_LONG 0 0 183 0 7 1500 0 0 0 0 0

how can i achieve that with mavsdk? once i will be able to send this commands, i can finally write a simpler higher level of sdk to implement both px4 and apm for novice users.

Hello,

Just wonder if you tried using the android-client in MAVSDK-Java/examples/? I am trying to control my ArduPilot drone with this example app installed on the Herelink ground station but it seems unable to run the MAVSDK server. Thank you!