Azzera filtri
Azzera filtri

Can I include an ode45 in a for loop

1 visualizzazione (ultimi 30 giorni)
Mohamed Amine BELYAMANI
Mohamed Amine BELYAMANI il 17 Lug 2020
I'm working on an LQR controller for an autonomous drone and I'm having problems with the ode45 solver. My code goes like this:
T = 20;
dt = 0.1;
X0 = zeros(12,1);
for i=0:dt:T
timeRange = i:dt:i+dt;
P = TrajectoryRef(X0);
U = Command_lqr(X0,P);
X = EquationSolver(U,X0,timeRange);
%since ode45 has an independent timestep i register the last value and sign it as the next input
X0 = X(size(X,1),:);
end
But i keep getting wrong values in the result.
  12 Commenti
Walter Roberson
Walter Roberson il 20 Lug 2020
Hmmm... I do not know enough about how that class of drones are controlled. I presume that some of the controls have to do with angles of surfaces, and that other controls have to do with velocities of motors. But I do not know, for example, anything about slew rates, about how quickly controls can be changed, about whether it is necessary to keep track of current acceleration of a control because potentially the rate of change of acceleration might be limited. And I do not know anything about issues such as difficulty in getting a motor started again... I know that in some cases (at least for much larger devices) there are cases when starting a motor is hard enough that it can make sense to have a forward motor and a reverse motor both, with one running at idling speed and not enough to overcome the full power of the other motor, so that neither motor ever needs to stop... https://www.motioncontrolonline.org/content-detail.cfm/Motion-Control-News/Understanding-Backlash-and-Stiction/content_id/310
I have never worked with drones, so I do not know which of these things need to be taken into consideration in practice.
Mohamed Belyamani
Mohamed Belyamani il 27 Lug 2020
Modificato: Mohamed Belyamani il 27 Lug 2020
I'm looking into it as well, for now the ode solver is capable of achieving the takeoff of the drone without any problems, but the real issue lies in controlling the pitch and roll, so i'm looking into implementing BVP or InverseKinematic to see if there is any change.
About the path planning, since i'm working with ultrasonic sensors for now, is it possible to simulate or implement the sensors in a way that would detect obstacles along the way. I've started working with Simscape since I modeled my drone in SolidWorks and I saw fit to actually have the command as PWM. I know that the best solution is working with Gazebo using ROS but I couldn't get to install the software since it is kinda difficult (for me) to install it on Windows.

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by