So I have my nodes almost done. There are acceleration streams, angular velocity, compass, gravity, reference frames and sonar distances and all these have to translate somehow to PWM pulses for the motors.
My initial diagram (here) showed a rate PID – with angular velocity as input and torque as output – but it’s missing something: the target angular velocity. I’m missing the input.
I kept thinking how can I model the input that controls all these nodes and it hit me – I’m missing the pilot. The central node that reads all the input sources and gives commands to the actuators – the sink nodes. The pilot knows if it’s piloting an airplane, a multirotor, a rover or a boat so I need one for each vehicle type.
The pilot receives the inputs from the Comms class and outputs a torque stream that will be fed in the motor mixer and then in thrust node.
So I created the processing node Multirotor_Pilot that takes these streams:
– an angular velocity for the Rate Pids
– a reference frame stream for the stability (horizontal) pids
– a location stream for the assisted pids and for the RTH and other AI behaviors
– a vertical distance stream (from a sonar usually but maybe from a laser as well) for the ground avoidance
It will use these streams based on the current input mode and state (landing, take off, crash etc) and process them into a torque stream. This basically means how the pilot wants the quad to rotate.
The streams are generated from sensors and passed through low-pass filters and resampled to around 20-50Hz. No need for more as it will just result in noise.
If I want to use silkopter with an airplane I will have to add a new Plane_Pilot class to model the plane. Same for any other vehicle.
Things are clearer now.