These are chat archives for dronekit/dronekit-android

12th
Feb 2016
Dennis Baldwin
@dbaldwin
Feb 12 2016 00:14
@hamishwillee thank you for the prompt reply. I've got a lot to learn but will look into these details further. Right now I'm using DroneKit-Android and have been able to program some basic functionality through the ControlApi.
@chaviw Great idea. I've used Tower a good bit, but never really thought about it as a means to "learn" about mission commands. Off the top of your head do you know if there's a way to simulate a gimbal with dronekit-sitl? Thank you for the response. Glad to know this channel exists!
Hamish Willee
@hamishwillee
Feb 12 2016 00:24

@dbaldwin Off the top of my head, you can simulate a gimbal, but there isn't much point because the messages you get back just mirror whatever you sent out in the command. Also you can't use DK sitl "yet" because you need to reset sitl to enable this, and dk-sitl will clear away your gimbal settings when you do the reset. So the only way to simulate this is to use native SITL build. The gimbal simulation info is here: http://dev.ardupilot.com/wiki/using-sitl-for-ardupilot-testing/#adding_a_virtual_gimbal

Last of all, one of the team had to do this last week, and ended up just using a Solo drone for the testing - the simulation of this feature was "just too hard". Apparently running on the hardware only took minutes.

Dennis Baldwin
@dbaldwin
Feb 12 2016 00:29
@hamishwillee sounds like a plan. I have a Solo on the bench I can test with. thx
Randy Mackay
@rmackay9
Feb 12 2016 01:15
@tongzahub, sorry for the very late reply. Re a mission command to set-mode, we don' have that in Copter. We had it but removed support because nobody used it and we thought it was potentially dangerous to have the mission switch into a manual flight mode as part of the mission.
It's not hard to add back if it important to have.
@kalnir, the DO_CHANGE_SPEED will actually change the ground speed (not the airspeed). So maybe that's what you want?
kalnir
@kalnir
Feb 12 2016 14:22
Yes, in android there was no field for specifying the airSpeed/groundSpeed and in the plan it showed up as an AirSpeed command when checked on other desktop ground stations. That is the only reason I was confused...thank you for your help!
Dennis Baldwin
@dbaldwin
Feb 12 2016 22:56

Can someone share a snippet that demonstrates how to control Solo's gimbal? This is what we're trying to do and unfortunately it's not working. When the STATE_CONNECTED event fires we are trying to enable control like this:

// Let's enable gimbal control
GimbalApi.getApi(this.drone).startGimbalControl(new GimbalApi.GimbalOrientationListener() {
    @Override
    public void onGimbalOrientationUpdate(GimbalApi.GimbalOrientation orientation) {
        //showToast("Enabling gimbal control: " + orientation.getPitch());
    }

    @Override
    public void onGimbalOrientationCommandError(int error) {
        showToast("Error enabling gimbal control");
    }
});

Then with a button in our UI we are trying to pitch the gimbal straight down like this:

GimbalApi.getApi(drone).updateGimbalOrientation(-90, 0, 0, new GimbalApi.GimbalOrientationListener() {
    @Override
    public void onGimbalOrientationUpdate(GimbalApi.GimbalOrientation orientation) {
        showToast("Pitch success");
    }

    @Override
    public void onGimbalOrientationCommandError(int error) {
        showToast("Pitch error");
    }
});

But an error gets thrown every time. The interesting thing is when trying to pitch the gimbal with the control knob on the transmitter it doesn't respond, which tells us that startGimbalControl appears to be working. Any ideas here?

Thanks

chaviw
@chaviw
Feb 12 2016 22:57
@dbaldwin You need to use the same GimbalApi.GimbalOrientationListener object in both requests