Gremsy / gSDK

SDK application used by software to control the Gremsy’s gimbal
21 stars 21 forks source link

Gimbal Interface Example

This is a simple MAVLink to UART interface example for Unix systems that can allow communication between Gremsy's Gimbal and an Onboard computer.

This will provide examples of controlling and communicating with Gremsy's Gimbal.

Documentation

Compilation

In order to compile you need the following packages:

Building

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

Hardware Setup

Connect the COM2 cable to your Onboard Computer.
The hardware connection between an GIMBAL and a PC or Linux machine. Note that: The recommended choice of USB to TTL cable is FT232 module.

Refer to: gSDK Documentation

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

Menu Structure

1. Connection Initialization

2. Gimbal Parameters Retrieval

4. Firmware and Message Settings

5. Gimbal Configuration Prompts

Usage

Follow the prompts to configure and control the gimbal. Input the required values as instructed by each prompt. This menu system is designed to facilitate easy interaction with the gimbal for setup and operation.

Troubleshooting

Contact

For further assistance, please contact support at [support@gremsy.com].