Viewpro gimbal setting help

With the recent contribution of Ardu pilot developers, I expect to utilize viewpro gimbal.

After receiving the file from github and installing it on the FC, I received the following message.

Prearm:Scripting: /APM/scripts/mount-viewpro-driver.lua:555: attempt to index a nil value (global ‘camera’)

May I know the solution?

All settings are set according to the wiki page and github md file.

Set SERIALx_PROTOCOL = 28 (Scripting) where "x" corresponds to the serial port connected to the gimbal
Set SCR_ENABLE = 1 to enable scripting and reboot the autopilot
Set MNT1_TYPE = 9 (Scripting) to enable the mount/gimbal scripting driver
Set CAM1_TYPE = 7 (Scripting) to enable the camera scripting driver
Set RCx_OPTION = 300 (Scripting1) to allow real-time selection of the video feed and camera control

Is there anything I missed?


Hi @steampunk,

Thanks for giving this a try. I think the issue is the link on the wiki is to “latest” when it should be to our Copter-4.4. branch. I will update the wiki.

Could you try the version here in our Copter-4.4 directory?

Hi @rmackay9 , I’m trying the viewpro gimbal settings too. I’m getting an error in the Lua Script.
I have got a message saying " PreArm: Scripting: Error: /APM/scripts/mount-viewp ".Could anyone help me out with this? I had downloaded the lua file for 4.4. I’m using the same version firrmware as well.
Screenshot 2023-05-02 194639

File “C:\Users\Amit\Downloads\mount-viewpro-driver.lua”, line 72
SyntaxError: Non-ASCII character ‘\xc2’ in file C:\Users\Amit\Downloads\mount-viewpro-driver.lua on line 72, but no encoding declared; see PEP 263 – Defining Python Source Code Encodings | for details


One tricky thing about downloading the script is that you need to be sure that you get the text file and not the web page.

It might help to download it using this RAW link instead.

Another idea is to open the file in an editor on your machine and make sure that it looks like what’s shown at the link above and doesn’t look like HTML.

1 Like

thank you to reply

it’s work at your link file

mount control, retract, neutral, and camera shutter, record, eo/ir change… working well.

1 Like

Hey all, sorry this might be dump question from me. I’m getting mount not healthy message. Is there any other settings that I need to check?. I have followed the page and added the params as explained. Need a help here for that.

@rmackay9 still its not working for me. I tried the steps as given in the LUA file.


Any chance you could include an onboard log?

Hi @rmackay9 ,
Thanks for the patience, I’m back on testing. Took a while. I’m attaching the image.

Hi @vpaul57,

It looks like you’re trying to run the script on the ground station but the script it meant to be loaded on the autopilot’s SD card. Wiki instructions are here.

@rmackay9 , I have the script running inside the memory card. May be channel setting thing. I have followed the instructions. Is there any other settings I need to check?

The script has to run on the flight controller, not on your PC

Hi @vpaul57,

To help further I really need to see an onboard log. This will give me all kinds of information about the configuration and even the script that is loaded.

I have the script in my flight controller. I had run in the console as it showed some error and to check that out.

The memory card is inside the flight controller and not in the computer. I’ll share you the logs.


OK, that screen shot of Visual Studio threw us off.
I wonder if perhaps the file ends in .txt instead of .lua?

raw.githubusercontent.com_ArduPilot_ardupilot_Copter-4.4_libraries_AP_Scripting_drivers_mount-viewpro-driver.txt (22.4 KB)
This is the file from the SD card

1 Like

00000037.BIN (401.5 KB)
The BIN file

1 Like

Hi @vpaul57,

Thanks for that. So the issue is that the file has a super long name and ends in .txt.

Could you rename the file on the SD card to mount-viewpro-driver.lua?