Can I include an ode45 in a for loop
3 次查看(过去 30 天)
显示 更早的评论
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
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
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 Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!