My team is trying to integrate a RealSense with a companion computer to a PixHawk running PX4 in a rover vehicle to do “simple” obstacle detection. By simple, I mean the PIxHawk would initiate simple dodge sequences upon receiving custom MAVLink messages from the companion computer. Our question is two-fold:
How do we set up custom MAVLink commands that the rover can receive? Where in the PX4 flight stack would we control the motor to check for receipt of those commands?
Upon receiving the commands, how do we actually use that to control motor functions? For example, if my first motor command upon detecting an obstacle is to kill the motors, is there a “kill motors” command that directly works? Likewise, if we want to move 5 meters in a specific heading, is there a simple command for that? Or do we have to control the specific GPIO pins directly?
What we’re looking for is where in the code we do this and what kind of commands we’re using. This question may be a bit abstract, but the goal is that we don’t want to mess too much with the PX4 flight stack but still be able to initiate a few basic commands?