Servers by jDrones

Is it possible to change waypoint speed and camera mount pitch?

Hi,
I need to change waypoint speed and camera mount pitch during a mission. The simplest way seems to be a LUA script. Do the necessary bindings exist or is it possible to send a mavlink command?

Thank you,
Tobias

You can do the waypoint speed by changing the param from the lua script.

Mount pitch is a little harder, you could add a binding to do that. If its servo controller you can change the servo output from the script.

1 Like

Thank you very much!

I use a Basecam setup as descriped here:
https://ardupilot.org/copter/docs/common-simplebgc-gimbal.html

I guess it is not possible to control without adding bindings (I do not know yet how to do that)?

But I think you guided me to the right approach.
I will try to modify a mission after it was loaded and add the waypoint speed and do mount control items. I think that should work.

You will need new bindings for the gimbal over serial.

Why not just change the WPNAV_SPEED param? Much easier script.

Yes, you are right.

This would mean I need to add a pull request for the new bindings? I think that is beyond my current knowledge.

I guess the method is this one:

void set_angle_targets(uint8_t instance, float roll, float tilt, float pan);

in line 121 in /libraries/AP_Mount/AP_Mount.h

Then I open a new section in /AP_Scripting/generator/description/bindings.desc

include AP_Mount/AP_Mount.h
singleton AP_Mount method set_angle_targets boolean uint8_t instance, float -90 90 , float -90 90, float -180 180

Even if that is right, the next step is beyond my unterstanding.

Open a command line prompt and cd to the /libraries/AP_Scripting/generator directory and type “make run”

Since that is a method which is interesting for many people it might be useful to implement it?

Yes, A PR would be great, you can always open a draft and ask for advice

Your binding is nearly correct, not much point in using the version with a instance as AP_MOUNT_MAX_INSTANCES is 1. This builds on master (but I have not tested in any way):

include AP_Mount/AP_Mount.h
singleton AP_Mount alias mount
singleton AP_Mount method set_angle_targets void float -90 90 float -90 90 float -180 180

You should then be able to use in lua with:

mount:set_angle_targets(roll, pitch, yaw)

No need to manually run the generator anymore, it is run automatically when you build the main code.

Thank you very much! I have tried to make a pull request. First time ever. I hope that is right.

Servers by jDrones