Development Workflow

Prerequisites

To build an SDK based application the following are required

  • Programming experience C/C++.

  • A compatible gimbal.

  • Your Onboard Computer with an available TTL UART port.

  • Software tool to build the SDK .

  • PC to run the required software tool.

Hardware setup guide

Connect the COM2 cable to your Onboard Computer. The hardware connection between gimbal and PC or Linux machine.

Note that: The recommended choice of USB to TTL cable is FT232 module.

The onboard computer communicates to the Gimbal through a UART interface.

Power can be drawn directly from the COM2 port (1A max@5V).

  • The UART electrical interface for all SDK compatible Gremsy Gimbal is 3.3 volt TTL.

  • You must ensure that your onboard computer UART port operates at the same voltage to avoid damaging the Gimbal Controller.

    • For example, RS-232 ports will need a level-shifting circuit.

  • The UART interface does not require power from the onboard computer.

Connecting to your Onboard Computer

The diagram below shows the hardware connection between a GIMBAL and a PC or LINUX machine. Note that:

  • The recommended choice of USB to TTL cable is the FT232 module.

  • Baud rate: 115200

  • Bit data: 8 bits

  • Parity: No Parity

Software Environment Setup Guide

This guide details the software environment needed to work with the SDK

Download the gSDK and Required tools

1

Installing gTune app

2

Ensure gimbal firmware is updated to the latest version.

3

Configure Linux Development Environment

4

Install Development Tools

To build standalone Linux applications based on the gSDK, you need:

  • A supported C++ compiler.

  • A bash shell.

  • A modern Linux distribution.

5

Add UART Permissions

Please follow the steps below to add UART read and write permissions for users specified in Linux:

  • Use the sudo usermod -a -G dialout $ USER command to add the user to the dialout group.

  • After logging in to the added account again, the account can obtain UART read and write permissions.

Setting up samples

Before you start

  1. Make sure you have followed the steps in the Hardware Setup Guide to get your connection right.

  2. Follow the steps in the Environment Setup guide to get your software ready to run samples.

Run the sample on the Linux.

This is a simple MAVLink to UART interface example for Linux systems that can allow communication between a gimbal and an Onboard Computer.

This example will receive Mavlink messages from the gimbal and send MAVLink messages for controlling and setting the gimbal.

Building the gSDK and running the example.

Building

$ cd gSDK/
$ mkdir build && cd build
$ cmake ..
$ make

Execution

An FTDI cable will show up on a ttyUSB*. Run the example executable on the host shell:

You have to pick a port name; try searching for it with


$ ls /dev/ttyACM* 
$ ls /dev/ttyUSB*

Run the example executable on the host shell:

$ cd gSDK/
$ ./gSDK -d /dev/ttyUSB0

To stop the program, use the key sequence Ctrl-C.

Here's an example output:
OPEN PORT
Connected to /dev/ttyUSB0 with 115200 baud, 8 data bits, no parity, 1 stop bit (8N1)

START WRITE THREAD 

 Lost Connection!

 Lost Connection!

START READ THREAD 

 Lost Connection!

 Lost Connection!

 Lost Connection!

 Lost Connection!

 Lost Connection!

 Lost Connection!

 Lost Connection!

 Lost Connection!

 Lost Connection!

 Lost Connection!

 Lost Connection!

Found GIMBAL [SysID][CompID]: [1][154]

GOT [VERSION_X] 7

GOT [STIFF_TILT] 20

GOT [STIFF_ROLL] 70

GOT [STIFF_PAN] 60

GOT [FILTER_OUT] 1

GOT [PWR_TILT] 20

GOT [PWR_ROLL] 70

GOT [PWR_PAN] 60

GOT [FLW_LPF_TILT] 20

GOT [FLW_LPF_PAN] 20

GOT [RC_TYPE] 15

GOT [GYRO_LPF] 4

GOT [RC_LIM_MIN_TILT] -45

GOT [RC_LIM_MAX_TILT] 45

GOT [RC_LIM_MIN_ROLL] -40

GOT [RC_LIM_MAX_ROLL] 40

GOT [RC_LPF_TILT] 80

GOT [RC_LPF_ROLL] 80

GOT [RC_LPF_PAN] 80

GOT [FLW_WD_TILT] 5

GOT [FLW_WD_PAN] 20

GOT [RC_SPD_TILT] 30

GOT [RC_SPD_ROLL] 30

GOT [RC_SPD_PAN] 30

GOT [RC_REVERSE_AXIS] 24

GOT [VERSION_Y] 7

GOT [VERSION_Z] 3

GOT [RC_LIM_MIN_PAN] -320

GOT [RC_LIM_MAX_PAN] 320

GOT [MAV_TS_ENCNT] 1

Check [VERSION_X] 7

Check [VERSION_Y] 7

Check [VERSION_Z] 3

Check [STIFF_TILT] 20

Check [STIFF_ROLL] 70

Check [STIFF_PAN] 60

Check [PWR_TILT] 20

Check [PWR_ROLL] 70

Check [PWR_PAN] 60

Check [FILTER_OUT] 1

Check [GYRO_LPF] 4

Check [FLW_LPF_TILT] 20

Check [FLW_LPF_PAN] 20

Check [FLW_WD_TILT] 5

Check [FLW_WD_PAN] 20

Check [RC_SPD_TILT] 30

Check [RC_SPD_ROLL] 30

Check [RC_SPD_PAN] 30

Check [RC_LPF_TILT] 80

Check [RC_LPF_ROLL] 80

Check [RC_LPF_PAN] 80

Check [RC_REVERSE_AXIS] 24

Check [MAV_TS_ENCNT] 1

Check [RC_LIM_MIN_TILT] -45

Check [RC_LIM_MAX_TILT] 45

Check [RC_LIM_MIN_ROLL] -40

Check [RC_LIM_MAX_ROLL] 40

Check [RC_LIM_MIN_PAN] -320

Check [RC_LIM_MAX_PAN] 320

Check [RC_TYPE] 15

Use mavlink gimbal V1
Gimbal Firmware version is 7.8.3.OFFICIAL
Set gimbal send raw encoder value.

GET GIMBAL DEVICE: 

Vendor name: GREMSY

Model name: MIO

Request gimbal device information.

Please Enter y/n(yes or no) to setting gimbal mavlink message rate

n
Please Enter y/n(yes or no) to setting gimbal stiffness - follow param

n
Please Enter number to select type of gimbal

         1. Two axis

         2. Three axis

2
Please Enter number to select three axis gimbal mode 

         1. Normal mode

         2. Inverted mode

1
You selected gimbal mount mode 
Three axis Normal Mount


 Please Enter number [0-15] to seclect Gimbal control mode
         0.   OFF Gimbal
         1.   ON Gimbal
         2.   Change mount mode
         3.   Gimbal information
         4.   Config gimbal follow parameter
         5.   Set Gimbal to LOCK mode
         6.   Set Gimbal to move angle in LOCK mode
         7.   Set Gimbal to move rate in LOCK mode
         8.   Set Gimbal to FOLLOW mode
         9.   Set Gimbal to move angle in FOLLOW mode
         10.  Set Gimbal to move rate in FOLLOW mode
         11.  Set Gimbal to MAPPING mode
         12.  Set Gimbal to Return Home
         13.  Set Gimbal Reboot
         14.  Upgrade Firmware
         15.  Monitoring Encoder - Attitude - IMU
^C
TERMINATING AT USER REQUEST

CLOSE THREADS

CLOSE PORT

Last updated

Was this helpful?