I need to replace PID controller in ardupilot with custom torque controller. So, to approach the problem, I am starting with making a new manual mode which doesnt use AC libraries, applies my basic PID in the mode only(which will later be replaced) and pass commands directly to motors. I will later include the control loop in attitude control so i can use it with other Autopilot modes too. Any suggestions or advice which could help?
People over in the gitter research channel might be able to help out.
We’ve got some info here on the attitude controllers. I think it’s the AC_AttitudeControl library that you’ll have to modify. AP uses cascading PIDs though (attitude -> rate, rate->motors) so I’m unsure if you’ll have to replace both PIDs or just one. We also do a bunch of linearisation at various levels to make the PIDs perform better, I hope this doesn’t get in the way of what you’re trying to do.
Re chatting on Gitter, also feel free to ask question in the main gitter channel: https://gitter.im/ArduPilot/ardupilot