Hi BlueRobotics Team!
I currently have BlueRov2 and it has been working great !
Recently, however, I developed a need to add two additional components: a thruster and relay.
I have working prototype via the following steps:
- These components are connected the GPIO pins on the Raspberry Pi.
- The ESC for the thruster is connected to the PWM GPIO of the Pi
- The relay is connected to a generic GPIO pin.
- Both additional components can be controlled via a python script that I wrote, which I am happy to share.
- The python scripts were pushed onto the raspberry pi.
- We ‘ssh’ into the raspberry, execute the scripts, and use keyboard inputs to control the components
While this is great, typing in keyboard inputs in addition to using the joystick is difficult.
Therefore we are now at the point of wanting to setup custom Joystick Buttons to perform these functions.
From what I read from these two posts ( A little help on setting up a PWM Relay Switch? and Adding gripper servos to essentially a bluerov2-Ish rov - #4 by jwalser), I believe there are two solutions. With each of the solutions, I have some questions on how to accomplish them.
S1: Connect my additional components inputs to the pixhawk and configure the buttons using QGroundControl. Looking at the following documentation (Redirecting...) the pixhawk has a RELAY_PIN and Aux1. However, I am very confused on how to set each one up when looking at QGroundControl.
Q1: Does the RELAY_PIN refer to Aux5 or Aux6 ? What Pins are they? How can I pick which Aux pin they are assigned to ? (Relay Switch — Copter documentation).
Q2: How can I change the BRD_PWM_COUNT value ? What effect does this have on the relay and PWM pins?
Q3: For the “servo_1_inc: Increase Aux1 servo output by 50 pwm” in the Servo Control subsection of Redirecting..., what does 50 pwm mean? I am used to setting a frequency and duty cycle.
S2: Utilize the AP_JSButton.cpp and AP_JSButton.h API that you guys have gracefully provided ! I would rewrite my python scripts in c++ and read digital values from the joystick controller.
Q4: Is there example code on reading the digital values either from the buttons or joy stick on the controller? I am having a hard time understanding how to leverage the API to read joystick inputs.
Thank you!