Seagull #REC2 Camera Controller Lua Script For Herelink

Further to MadRC Ian’s great post ’ Seagull#REC Camera Controller Lua Script For Herelink
here is a LUA script update for the Seagull #REC2.
Changes for the #REC2 include SBUS connection and USB power supply. The script adds Manual Photo, Camera on/off and Timelapse.

Setup instructions and the LUA script are here #REC2 LUA.zip (204.1 KB)

Hopefully it will work for you.

If I click on the setup instructions it says: “Oops! That page doesn’t exist or is private.”

Try this
https://drive.google.com/drive/folders/1_8QOdQGilx6yK8gxCfpRJploldhOYxKL?usp=sharing

1 Like

Thx, seems to work now!

Did you get it to work?

Not yet, I just wanted to take a look at the code, so I can help my own camera triggering solution.

Hi Peter,

I’m an Arducopter & Herelink newbe. I’m trying to setup your script with Solex and arducopter V4.0.4 but no luck so far. Pressing the camera button does not trigger the camera at all. It seems to change the flight mode.

Regards,

Esai

Hi Esai
It looks like you haven’t configured the Herelink buttons. You need to create a Button Profile as described here.
https://docs.cubepilot.org/user-guides/herelink/herelink-user-guides/sbus_buttons
Use the ‘HereLink Button Setup’ values as in the help file. Make sure you save the profile and it is loaded when using #REC2.
Also when changing the parameters in Mission Planner make sure you write them to the cube.
You need to get all the steps in the help file correct to make it work.
Best of luck.
Peter

I’ve just set this up on a Cube orange and am really keen to use it as looks awesome for adding a lot of flexibility for the herelink

I am getting some issues when it come to trying to run the script that I could do with some help debugging. On boot up it seems to start running the script, but I then it looks like there is an error on line 83.
image

I’m not famialr enough with scripting yet to be able to say for certain but it seems to be erroring on that line?

Any help would be appreciated

Have been attempting to get this to run again today, sadly with no luck.
I’m running 4.0.7 on a cube orange, which I think should support scripting now.

The line I’m getting an error on is

pwmaVideo = rc:get_pwm(11)

From other discussions I can see the full error line is " attempt to index a nil value".

I also added the hello world script to make sure scripts are running and that has no issues.

From the order of the messages I get in MP, it seems to me that the scripts are run before ardupilot has fully started up. Is it possible that because ardupilot isn’t fully running yet the rc parameters the script is reading haven’t been populated yet, hence the nil value error? If so, does anyone know the code to add a dwell/sleep command at the beginning that I could use to give AP more time to initialise everything?

I should add, when I look at my RC values in MP they are all agreeing with what I’ve set up on the herelink, but obviously this is much later when everything hass booted up ok

See the note in the original post.

Note: Currently at the time of writing copter is in version 4.03 and Plane is 4.05. This script only works with the Master release of ardupilot at this time. Support in release firmware will come in the future.

You will have to update to 4.1 beta

Thanks Peter, thats solved it!

I’d been following the AP Lua Scripts page that says scripting was added in 4.0, hence my confusion

where is the camera button located on the Herelink !!

Its the upper right button. and used for the Shutter and REC.

1 Like

I’ve been using the script for a while, and thought I’d share a simple edit I made to it. (See my detailed thread here )

I had the same issue as Esai in that I couldn’t trigger the camera for photos from in QGC and Solex, but it all worked well via the buttons.

My edit reads the camera channel and triggeres the camera from this, whil still allowing the buttons to be used without the need for any chages to parameters