Hello there,
I’m currently working on a simulation environment and would like to model the PID rate controller + square root controller for position change. I thought I could extract a standalone version of the AC_AttitudeController, but turned not as straightforward as I thought.
I need the standalone version to compare the implemented code with my simulation model of the controller.
For the sake of simplicity I created a new example sketch, but it seems unclear to me how to start an instantiate the Attitude Controller. Not sure If Im taking the right path gere. Any advice or help would be much appreciated.
Right, I saw that (haven’t checked out in detail, tho). I actually hoped to also gain a deeper understanding of the code base by doing so. Eventually also with the option of applying minor modifications and doublecheck with the same modifications in the Simulink model. Do you still think it makes sense to go down the rabbit hole?
I hope it makes sense what I’m writing. Btw thanks for the quick response
You are right, but I guess learning comes from taking challenges. I’d be super grateful if you just could give me a hint on those thoughts:
I found that attitude_control used in copter is instantiated in “ArduCopter/system.cpp”. Here I stumbled across
attitude_control = new AC_AttitudeControl_Multi_6DoF(*ahrs_view, aparm, *motors);
attitude_control = new AC_AttitudeControl_Multi(*ahrs_view, aparm, *motors);
my first question would be, what is the difference between those two?
To provide the ahrs object I’d heavily copy from libraries/AP_AHRS/example/AHRS_Test/AHRS_Test.cpp and build a dummy vehicle. Although, this example seems to be bound to a board and is not runable on linux, but maybe with sitl.
motors seems to come from
motors = new AP_MotorsMatrix(copter.scheduler.get_loop_rate_hz());
ok that one should be easy to instantiate standalone. My thoughts so far.
Sorry if those questions appear super newbish, but it would help me a lot to get a deeper understanding of the code base.