We are a team at Virginia Tech currently developing an autonomous reactor inspection vehicle for Framatome and we intend to use the ArduSub open source solution for our purposes.
In short, we are attempting to use ArduSub’s current implementation to control 4 600HF Hi-Flow Thrusters and then 2 additional PWM pins on the Pixhawk to control 2 additional motors (I can provide specifics on motors if needed.)
Here is what we believe to be the correct approach:
- We may use the QGroundControl to map a function to a button on our xbox 360 controller. We noticed many of these function calls (i.e. lights1_brighter) are in the joystick.cpp and also found a switch case for custom buttons. We believe that these custom buttons would be what we should use and where we should implement our custom code; one button to tell the the left and right motors to rotate clockwise, and another to do the opposite of that (maybe a third to stop the motors if buttons are not hold-to-operate).
We did also read about some servo_n functions, although we’re not sure if that’s what we need instead of implementing the custom switch cases.
- By default, 4 PWM pins are assigned to the Pixhawk for 4 thrusters, and we can change this to 6 via the BRD_PWM_COUNT parameter which we believe is part of a parameters text file we upload. We then use the DO_SET_SERVO command to operate the servos (we’re not sure how this function works, what parameters it needs, etc.)
So at this point we’re unsure whether we should be going the custom button route, or the *_servo_n route. We also don’t know if the *_servo_n function that controls the PWM output can send the output specified in (1).
- Once we know where our code should go (or how to use the *_servo_n function for our purposes), what would this code actually look like? We looked into the motors library to try and get some sense of the calls that functions we found were making to try and use as a reference, but we’re still very unsure of whether it would be correct or not.
One function of interest that seemed to revolve around our intentions was the “AP_MotorsSingle::output_test_seq(motor_seq, pwm)” function in AP_MotorsSingle.cpp, which appears to take in a motor and a pwm value? Although this was also commented to be for testing rather than normal operation.
Alternatively, we also found “AP_Motors::rc_write(chan, pwm)” in AP_motors_class.cpp, prompting for two similar parameters and then following that with what appears to be output_pwm assignment.
2/13/19: Another assignment that seemed interesting is “motor_out[i] = 1500” in AP_Motors6DOF.
We’re a team of Mechanical Engineers with minimal CS experience. I myself only have some experience with Java, C, C++ from my CS minor which is certainly not enough to fully grasp all of the intricacies of the ArduSub code.
We are hoping that we may find the answers to our many doubts here on the forums, if one is willing to help us out!