1 Star 0 Fork 0

Zyx/LQR_BALANCECAR

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
draw_pend.m 1.06 KB
一键复制 编辑 原始数据 按行查看 历史
Zyx 提交于 2024-04-07 17:40 . init
function draw_pend(y,m,M,L)
x = y(1);
th = y(3);
% kinematics
% x = 3; % cart position
% th = 3*pi/2; % pendulum angle
% dimensions
% L = 2; % pendulum length
W = 1*sqrt(M/5); % cart width
H = .5*sqrt(M/5); % cart height
wr = .2; % wheel radius
mr = .3*sqrt(m); % mass radius
% positions
% y = wr/2; % cart vertical position
y = wr/2+H/2; % cart vertical position
w1x = x-.9*W/2;
w1y = 0;
w2x = x+.9*W/2-wr;
w2y = 0;
px = x + L*sin(th);
py = y + L*cos(th);
plot([-10 10],[0 0],'k','LineWidth',2)
hold on
rectangle('Position',[x-W/2,y-H/2,W,H],'Curvature',.1,'FaceColor',[.5 0.5 1],'LineWidth',1.5)
rectangle('Position',[w1x,w1y,wr,wr],'Curvature',1,'FaceColor',[0 0 0],'LineWidth',1.5)
rectangle('Position',[w2x,w2y,wr,wr],'Curvature',1,'FaceColor',[0 0 0],'LineWidth',1.5)
plot([x px],[y py],'k','LineWidth',2)
rectangle('Position',[px-mr/2,py-mr/2,mr,mr],'Curvature',1,'FaceColor',[1 0.1 .1],'LineWidth',1.5)
% set(gca,'YTick',[])
% set(gca,'XTick',[])
xlim([-5 5]);
ylim([-2 2.5]);
axis equal
%set(gcf,'Position',[100 550 1000 400])
% box off
drawnow
hold off
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhang-yuexuan/lqr_-balancecar.git
git@gitee.com:zhang-yuexuan/lqr_-balancecar.git
zhang-yuexuan
lqr_-balancecar
LQR_BALANCECAR
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385