Can I include an ode45 in a for loop

조회 수: 3 (최근 30일)
Mohamed Amine BELYAMANI
Mohamed Amine BELYAMANI 2020년 7월 17일
편집: Mohamed Belyamani 2020년 7월 27일
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
Walter Roberson
Walter Roberson 2020년 7월 20일
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 2020년 7월 27일
편집: Mohamed Belyamani 2020년 7월 27일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by