💡
aColor-BlueRov2
  • aColor-BlueRov2 ROS implementation
  • Topside computer
    • Required configuration
    • File system and ROS architecture
    • Launch ROS implementation
    • ROS-MAVlink bridge
    • Controllers
      • Depth control
      • Heading control
      • Velocity control
      • Gamepad
    • Commander
    • Graphical User Interface (GUI)
      • GUI modification
    • Additional IMUs : client
  • Companion computer
    • Required configuration
    • Additional IMUs : server
  • ArduSub
    • ArduSub parameters
  • MAVlink message
    • Pymavlink
  • Configure new frame
    • Custom Ardusub 3.5
  • Bibliography
    • Bibliography
Powered by GitBook
On this page
  • Library
  • Logitech F310
  • How it's working
  • Assignation table
  • ROS
  • Node
  • Topics

Was this helpful?

  1. Topside computer
  2. Controllers

Gamepad

description of the file gamepad.py

PreviousVelocity controlNextCommander

Last updated 5 years ago

Was this helpful?

The class Gamepad handle event from the Logitech Gamepad F310 connected by USB to topside computer. Build to test ROS implementation before we can connect ROS in parallel of QGroundControl (QGC).

If you launch QGC at the same time of ROS : Disable gamepad from QGC or not launch the gamepad file.

Library

The class Gamepad uses the library input from to handle gamepad joystick and buttons.

This library comes with the github ROS repository but you will need to build it by

cd PATH2package/src/controllers/inputs
python setup.py install

Otherwise you can install it with pip:

pip install inputs

Logitech F310

Be sure that the slider at the back of the controller is at D side

How it's working

The inputs library provides API to handle the events from gamepad. Based on the event's name, a dictionary provide a link between the name of the event and the method to call.

Assignation table

Gamepad event name

Method called

Designation

Value

ArduSub/MAVlink id

ABS_Y

_throttle

LEFT stick vertical

[0-128-255]

clicked Joy : 7

ABS_X

_lateral

LEFT stick horizontal

[0-128-255]

clicked Joy : 8

ABS_RZ

_forward

RIGHT stick vertical

[0-128-255]

/

ABS_Z

_yaw

RIGHT stick horizontal

[0-128-255]

/

ABS_HAT0Y

_NDEF

LEFT cross vertical

-1 up; 0 neutral; +1 down

up : 11 ; down : 12

ABS_HAT0X

_set_gain_light

LEFT cross horizontal

-1 up; 0 neutral; +1 down

left : 13 ; right : 14

BTN_TRIGGER

_override_controller

X

0 ; 1

2

BTN_TOP1

_NDEF

Y

0 ; 1

3

BTN_THUMB

_NDEF

A

0 ; 1

1

BTN_THUMB2

_NDEF

B

0 ; 1

0

BTN_BASE

_NDEF

LT

0 ; 1

/

BTN_BASE2

_NDEF

RT

0 ; 1

/

BTN_TOP2

_cam_down

LB

0 ; 1

9

BTN_PINKIE

_cam_up

RB

0 ; 1

10

BTN_BASE3

_disarm

BACK

0 ; 1

4

BTN_BASE4

_arm

START

0 ; 1

6

ROS

Node

Gamepad

Topics

ROS topics subscribed

Message

Description

/BlueRov2/arm

Bool

The arm status

ROS topics published

Message

Description

/Command/joy

sensor_msgs/Joy

axes : [THROTTLE, YAW, FORWARD, LATERAL]

buttons : [ARM, OVERRIDE_CONTROLLER, PWM_CAM, LIGHT_DEC, LIGHT_INC, GAIN_LIGHT]

Joy message parameters

Type

Description

THROTTLE

Float32

pwm : Uint16 [1100-1900]range

YAW

Float32

pwm : Uint16 [1100-1900]range

FORWARD

Float32

pwm : Uint16 [1100-1900]range

LATERAL

Float32

pwm : Uint16 [1100-1900]range

ARM

Int32

0 : disarm ; 1 : arm

OVERRIDE_CONTROLLER

Int32

0 : AUTOMATIC mode, 1 : MANUAL mode

PWM_CAM

Int32

pwm for camera tilt

LIGHT_DEC

Int32

1 if you want to decrease brightness, else 0

LIGHT_INC

Int32

1 if you want to increase brightness, else 0

GAIN_LIGHT

Int32

result of gain light

The LIGHT_DEC, LIGHT_INC, GAIN_LIGHT parameters are not used

https://github.com/zeth/inputs