{"id":49799,"date":"2025-07-30T19:57:17","date_gmt":"2025-07-30T11:57:17","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/49799.html"},"modified":"2025-07-30T19:57:17","modified_gmt":"2025-07-30T11:57:17","slug":"%e5%9f%ba%e4%ba%8epython%e7%9a%84%e5%9b%9b%e6%97%8b%e7%bf%bc%e6%97%a0%e4%ba%ba%e6%9c%ba%e4%bb%bf%e7%9c%9f%e7%b3%bb%e7%bb%9f%ef%bc%9a%e4%bb%8e%e6%ac%a7%e6%8b%89%e7%a7%af%e5%88%86%e5%88%b0streamlit","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/49799.html","title":{"rendered":"\u57fa\u4e8ePython\u7684\u56db\u65cb\u7ffc\u65e0\u4eba\u673a\u4eff\u771f\u7cfb\u7edf\uff1a\u4ece\u6b27\u62c9\u79ef\u5206\u5230Streamlit\u4ea4\u4e92\u5f0f\u53ef\u89c6\u5316"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730115713-688a08998c81d.png\" \/><\/p>\n<p>\u57fa\u4e8e\u56db\u65cb\u7ffc\u65e0\u4eba\u673a\u7269\u7406\u6a21\u578b\u7684\u4eff\u771f\u7cfb\u7edf&#xff0c;\u7136\u540e\u901a\u8fc7Streamlit\u63d0\u4f9b\u4ea4\u4e92\u5f0f\u53ef\u89c6\u5316\u754c\u9762\u3002\u4ee5\u4e0b\u662f\u4ee3\u7801\u7684\u7ed3\u6784\u5206\u6790\u3001\u6f5c\u5728\u95ee\u9898\u53ca\u4f18\u5316\u5efa\u8bae&#xff1a;<\/p>\n<h4>\u4ee3\u7801\u7ed3\u6784<\/h4>\n<li>\n<p>\u6838\u5fc3\u4eff\u771f\u51fd\u6570\u00a0simulate_quadcopter<\/p>\n<ul>\n<li>\u529f\u80fd&#xff1a;\u6a21\u62df\u65e0\u4eba\u673a\u7684\u98de\u884c\u52a8\u6001&#xff0c;\u5305\u62ec\u4f4d\u7f6e\u3001\u901f\u5ea6\u3001\u59ff\u6001\u89d2\u3001\u89d2\u901f\u5ea6\u3001\u87ba\u65cb\u6868\u8f6c\u901f\u7b49\u3002<\/li>\n<li>\u8f93\u5165&#xff1a;\u98de\u884c\u65f6\u95f4\u00a0flight_time\u00a0\u548c\u6cb9\u95e8\u00a0throttle\u3002<\/li>\n<li>\u8f93\u51fa&#xff1a;\u5305\u542b\u65f6\u95f4\u5e8f\u5217\u6570\u636e\u7684\u5b57\u5178\u00a0states&#xff0c;\u8bb0\u5f55\u65e0\u4eba\u673a\u7684\u98de\u884c\u72b6\u6001\u3002<\/li>\n<li>\u5173\u952e\u903b\u8f91&#xff1a;\n<ul>\n<li>\u4f7f\u7528\u6b27\u62c9\u65b9\u6cd5\u8fdb\u884c\u6570\u503c\u79ef\u5206&#xff0c;\u66f4\u65b0\u72b6\u6001\u53d8\u91cf&#xff08;\u4f4d\u7f6e\u3001\u901f\u5ea6\u3001\u59ff\u6001\u89d2\u7b49&#xff09;\u3002<\/li>\n<li>\u901a\u8fc7\u6cb9\u95e8\u63a7\u5236\u63a8\u529b&#xff0c;\u63a8\u529b\u8f6c\u5316\u4e3a\u52a0\u901f\u5ea6&#xff0c;\u8fdb\u800c\u5f71\u54cd\u901f\u5ea6\u548c\u4f4d\u7f6e\u3002<\/li>\n<li>\u4eff\u771f\u63d0\u524d\u7ec8\u6b62\u6761\u4ef6&#xff1a;\u5f53\u65e0\u4eba\u673a\u7a33\u5b9a\u5728\u67d0\u4e00\u9ad8\u5ea6\u65f6&#xff08;\u901a\u8fc7\u5224\u65ad\u9ad8\u5ea6\u53d8\u5316\u5c0f\u4e8e\u9608\u503c&#xff09;\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u53ef\u89c6\u5316\u51fd\u6570\u00a0visualize_results<\/p>\n<ul>\n<li>\u529f\u80fd&#xff1a;\u4f7f\u7528 Plotly \u548c Matplotlib \u5c55\u793a\u65e0\u4eba\u673a\u7684\u98de\u884c\u8f68\u8ff9\u3001\u9ad8\u5ea6\u3001\u59ff\u6001\u3001\u89d2\u901f\u5ea6\u3001\u87ba\u65cb\u6868\u8f6c\u901f\u7b49\u3002<\/li>\n<li>\u4ea4\u4e92\u6027&#xff1a;\u652f\u6301\u67e5\u770b\u539f\u59cb\u6570\u636e\u3001\u5173\u952e\u6307\u6807&#xff08;\u5982\u6700\u7ec8\u9ad8\u5ea6\u3001\u98de\u884c\u65f6\u95f4&#xff09;\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Streamlit \u5e94\u7528\u00a0main<\/p>\n<ul>\n<li>\u529f\u80fd&#xff1a;\u63d0\u4f9b\u7528\u6237\u754c\u9762&#xff0c;\u5141\u8bb8\u8c03\u6574\u4eff\u771f\u53c2\u6570&#xff08;\u6cb9\u95e8\u3001\u8d28\u91cf\u3001\u87ba\u65cb\u6868\u5c3a\u5bf8&#xff09;\u5e76\u542f\u52a8\u4eff\u771f\u3002<\/li>\n<li>\u4ea4\u4e92\u6027&#xff1a;\u52a8\u6001\u5c55\u793a\u4eff\u771f\u7ed3\u679c&#xff0c;\u5305\u62ec 3D \u8f68\u8ff9\u56fe\u30012D \u6307\u6807\u56fe\u548c\u6570\u636e\u8868\u683c\u3002<\/li>\n<\/ul>\n<\/li>\n<p>import streamlit as st<br \/>\nimport numpy as np<br \/>\nimport math<br \/>\nimport matplotlib.pyplot as plt<br \/>\nimport plotly.graph_objects as go<br \/>\nimport matplotlib.font_manager as fm<\/p>\n<p># \u8bbe\u7f6e\u652f\u6301\u4e2d\u6587\u7684\u5b57\u4f53<br \/>\nplt.rcParams[&#039;font.sans-serif&#039;] &#061; [&#039;SimHei&#039;]  # \u7528\u6765\u6b63\u5e38\u663e\u793a\u4e2d\u6587\u6807\u7b7e<br \/>\nplt.rcParams[&#039;axes.unicode_minus&#039;] &#061; False  # \u7528\u6765\u6b63\u5e38\u663e\u793a\u8d1f\u53f7<\/p>\n<p>class QuadcopterParams:<br \/>\n    def __init__(self):<br \/>\n        # \u7535\u673a\u53c2\u6570<br \/>\n        self.C_r &#061; 1148<br \/>\n        self.w_b &#061; -141.4<br \/>\n        self.T_m &#061; 0.02<\/p>\n<p>        # \u7269\u7406\u53c2\u6570<br \/>\n        self.c_T &#061; 1.105e-5  # \u87ba\u65cb\u6868\u62c9\u529b\u7cfb\u6570<br \/>\n        self.c_M &#061; 1.779e-7  # \u87ba\u65cb\u6868\u529b\u77e9\u7cfb\u6570<br \/>\n        self.d &#061; 0.225  # \u673a\u4f53\u4e2d\u5fc3\u548c\u4efb\u4e00\u7535\u673a\u7684\u8ddd\u79bb(m)<br \/>\n        self.m &#061; 1.4  # \u8d28\u91cf(kg)<br \/>\n        self.g &#061; 9.8  # \u91cd\u529b\u52a0\u901f\u5ea6(m\/s^2)<br \/>\n        self.I_xx &#061; 0.0211  # x\u8f74\u8f6c\u52a8\u60ef\u91cf<br \/>\n        self.I_yy &#061; 0.0219  # y\u8f74\u8f6c\u52a8\u60ef\u91cf<br \/>\n        self.I_zz &#061; 0.0366  # z\u8f74\u8f6c\u52a8\u60ef\u91cf<br \/>\n        self.J_RP &#061; 0.0001287  # \u8f6c\u5b50\u60ef\u6027<\/p>\n<p>        # \u521d\u59cb\u4f4d\u7f6e<br \/>\n        self.Pos_z &#061; -100  # \u521d\u59cb\u9ad8\u5ea6<br \/>\n        self.Pos_x &#061; 0<br \/>\n        self.Pos_y &#061; 0<\/p>\n<p>        # \u521d\u59cb\u59ff\u6001<br \/>\n        self.phi0 &#061; 0<br \/>\n        self.theta0 &#061; 0<br \/>\n        self.psi0 &#061; 0<\/p>\n<p># \u7535\u673a\u6a21\u578b<br \/>\ndef motor_model(throttle, params):<br \/>\n    # \u8ba1\u7b97\u7a33\u6001\u8f6c\u901f<br \/>\n    return (params.C_r * throttle &#043; params.w_b)<\/p>\n<p># \u63a7\u5236\u6548\u7387\u6a21\u578b<br \/>\ndef control_efficiency(w1, w2, w3, w4, params):<br \/>\n    # \u8ba1\u7b97\u603b\u62c9\u529b\u548c\u529b\u77e9<br \/>\n    f &#061; params.c_T * (w1 ** 2 &#043; w2 ** 2 &#043; w3 ** 2 &#043; w4 ** 2)<br \/>\n    tau_x &#061; params.d * params.c_T * (math.sqrt(2) \/ 2) * (-w1 ** 2 &#043; w2 ** 2 &#043; w3 ** 2 &#8211; w4 ** 2)<br \/>\n    tau_y &#061; params.d * params.c_T * (math.sqrt(2) \/ 2) * (w1 ** 2 &#8211; w2 ** 2 &#043; w3 ** 2 &#8211; w4 ** 2)<br \/>\n    tau_z &#061; params.c_M * (w1 ** 2 &#043; w2 ** 2 &#8211; w3 ** 2 &#8211; w4 ** 2)<br \/>\n    return f, tau_x, tau_y, tau_z<\/p>\n<p># \u59ff\u6001\u52a8\u529b\u5b66\u6a21\u578b<br \/>\ndef attitude_dynamics(w1, w2, w3, w4, tau_x, tau_y, tau_z, p, q, r, params):<br \/>\n    # \u8ba1\u7b97\u603b\u8f6c\u52a8\u60ef\u91cf<br \/>\n    Omega &#061; -w1 &#043; w2 &#8211; w3 &#043; w4<br \/>\n    # \u8ba1\u7b97\u89d2\u52a0\u901f\u5ea6<br \/>\n    p_dot &#061; (1 \/ params.I_xx) * (tau_x &#043; q * r * (params.I_yy &#8211; params.I_zz) &#8211; params.J_RP * q * Omega)<br \/>\n    q_dot &#061; (1 \/ params.I_yy) * (tau_y &#043; p * r * (params.I_zz &#8211; params.I_xx) &#043; params.J_RP * p * Omega)<br \/>\n    r_dot &#061; (1 \/ params.I_zz) * (tau_z &#043; p * q * (params.I_xx &#8211; params.I_yy))<br \/>\n    return p_dot, q_dot, r_dot<\/p>\n<p># \u4f4d\u7f6e\u52a8\u529b\u5b66\u6a21\u578b<br \/>\ndef position_dynamics(phi, theta, psi, f, params):<br \/>\n    # \u8ba1\u7b97\u7ebf\u52a0\u901f\u5ea6<br \/>\n    v_x_dot &#061; -f * (1 \/ params.m) * (math.cos(psi) * math.sin(theta) * math.cos(phi) &#043; math.sin(psi) * math.sin(phi))<br \/>\n    v_y_dot &#061; -f * (1 \/ params.m) * (math.sin(psi) * math.sin(theta) * math.cos(phi) &#8211; math.cos(psi) * math.sin(phi))<br \/>\n    v_z_dot &#061; -params.g &#043; f * (1 \/ params.m) * math.cos(phi) * math.cos(theta)<br \/>\n    return v_x_dot, v_y_dot, v_z_dot<\/p>\n<p># \u8fd0\u52a8\u5b66\u6a21\u578b<br \/>\ndef kinematics(p, q, r, phi, theta, psi):<br \/>\n    # \u8ba1\u7b97\u59ff\u6001\u89d2\u901f\u5ea6<br \/>\n    phi_dot &#061; p &#043; q * math.tan(theta) * math.sin(phi) &#043; r * math.tan(theta) * math.cos(phi)<br \/>\n    theta_dot &#061; q * math.cos(phi) &#8211; r * math.sin(phi)<br \/>\n    psi_dot &#061; (q * math.sin(phi) &#043; r * math.cos(phi)) \/ math.cos(theta)<br \/>\n    return phi_dot, theta_dot, psi_dot<\/p>\n<p># \u4e3b\u4eff\u771f\u51fd\u6570<br \/>\ndef simulate_quadcopter(t_total, throttle, dt&#061;0.01):<br \/>\n    params &#061; QuadcopterParams()<br \/>\n    steps &#061; int(t_total \/ dt)<\/p>\n<p>    # \u521d\u59cb\u5316\u72b6\u6001\u6570\u7ec4<br \/>\n    states &#061; {<br \/>\n        &#039;t&#039;: np.zeros(steps),<br \/>\n        &#039;x&#039;: np.zeros(steps), &#039;y&#039;: np.zeros(steps), &#039;z&#039;: np.full(steps, params.Pos_z),<br \/>\n        &#039;vx&#039;: np.zeros(steps), &#039;vy&#039;: np.zeros(steps), &#039;vz&#039;: np.zeros(steps),<br \/>\n        &#039;phi&#039;: np.zeros(steps), &#039;theta&#039;: np.zeros(steps), &#039;psi&#039;: np.zeros(steps),<br \/>\n        &#039;p&#039;: np.zeros(steps), &#039;q&#039;: np.zeros(steps), &#039;r&#039;: np.zeros(steps),<br \/>\n        &#039;w1&#039;: np.zeros(steps), &#039;w2&#039;: np.zeros(steps), &#039;w3&#039;: np.zeros(steps), &#039;w4&#039;: np.zeros(steps),<br \/>\n        &#039;f&#039;: np.zeros(steps), &#039;ax&#039;: np.zeros(steps), &#039;ay&#039;: np.zeros(steps), &#039;az&#039;: np.zeros(steps)<br \/>\n    }<\/p>\n<p>    # \u521d\u59cb\u72b6\u6001<br \/>\n    w_steady &#061; motor_model(throttle, params)<br \/>\n    w1 &#061; w2 &#061; w3 &#061; w4 &#061; w_steady<\/p>\n<p>    # \u5b9e\u9645\u4f7f\u7528\u7684\u6b65\u6570<br \/>\n    actual_steps &#061; steps<\/p>\n<p>    # \u4e3b\u4eff\u771f\u5faa\u73af<br \/>\n    for step in range(1, steps):<br \/>\n        # 1. \u66f4\u65b0\u7535\u673a\u8f6c\u901f&#xff08;\u4e00\u9636\u54cd\u5e94\u6a21\u578b&#xff09;<br \/>\n        w1 &#061; w1 &#043; (w_steady &#8211; w1) * dt \/ params.T_m<br \/>\n        w2 &#061; w2 &#043; (w_steady &#8211; w2) * dt \/ params.T_m<br \/>\n        w3 &#061; w3 &#043; (w_steady &#8211; w3) * dt \/ params.T_m<br \/>\n        w4 &#061; w4 &#043; (w_steady &#8211; w4) * dt \/ params.T_m<\/p>\n<p>        # 2. \u8ba1\u7b97\u62c9\u529b\u548c\u529b\u77e9<br \/>\n        f, tau_x, tau_y, tau_z &#061; control_efficiency(w1, w2, w3, w4, params)<\/p>\n<p>        # 3. \u59ff\u6001\u52a8\u529b\u5b66<br \/>\n        p_dot, q_dot, r_dot &#061; attitude_dynamics(w1, w2, w3, w4, tau_x, tau_y, tau_z,<br \/>\n                                                states[&#039;p&#039;][step &#8211; 1], states[&#039;q&#039;][step &#8211; 1], states[&#039;r&#039;][step &#8211; 1],<br \/>\n                                                params)<\/p>\n<p>        # 4. \u4f4d\u7f6e\u52a8\u529b\u5b66<br \/>\n        ax, ay, az &#061; position_dynamics(states[&#039;phi&#039;][step &#8211; 1], states[&#039;theta&#039;][step &#8211; 1], states[&#039;psi&#039;][step &#8211; 1], f,<br \/>\n                                       params)<\/p>\n<p>        # 5. \u8fd0\u52a8\u5b66<br \/>\n        phi_dot, theta_dot, psi_dot &#061; kinematics(states[&#039;p&#039;][step &#8211; 1], states[&#039;q&#039;][step &#8211; 1], states[&#039;r&#039;][step &#8211; 1],<br \/>\n                                                 states[&#039;phi&#039;][step &#8211; 1], states[&#039;theta&#039;][step &#8211; 1],<br \/>\n                                                 states[&#039;psi&#039;][step &#8211; 1])<\/p>\n<p>        # \u72b6\u6001\u66f4\u65b0&#xff08;\u6570\u503c\u79ef\u5206&#xff09;<br \/>\n        states[&#039;p&#039;][step] &#061; states[&#039;p&#039;][step &#8211; 1] &#043; p_dot * dt<br \/>\n        states[&#039;q&#039;][step] &#061; states[&#039;q&#039;][step &#8211; 1] &#043; q_dot * dt<br \/>\n        states[&#039;r&#039;][step] &#061; states[&#039;r&#039;][step &#8211; 1] &#043; r_dot * dt<\/p>\n<p>        states[&#039;phi&#039;][step] &#061; states[&#039;phi&#039;][step &#8211; 1] &#043; phi_dot * dt<br \/>\n        states[&#039;theta&#039;][step] &#061; states[&#039;theta&#039;][step &#8211; 1] &#043; theta_dot * dt<br \/>\n        states[&#039;psi&#039;][step] &#061; states[&#039;psi&#039;][step &#8211; 1] &#043; psi_dot * dt<\/p>\n<p>        states[&#039;vx&#039;][step] &#061; states[&#039;vx&#039;][step &#8211; 1] &#043; ax * dt<br \/>\n        states[&#039;vy&#039;][step] &#061; states[&#039;vy&#039;][step &#8211; 1] &#043; ay * dt<br \/>\n        states[&#039;vz&#039;][step] &#061; states[&#039;vz&#039;][step &#8211; 1] &#043; az * dt<\/p>\n<p>        states[&#039;x&#039;][step] &#061; states[&#039;x&#039;][step &#8211; 1] &#043; states[&#039;vx&#039;][step] * dt<br \/>\n        states[&#039;y&#039;][step] &#061; states[&#039;y&#039;][step &#8211; 1] &#043; states[&#039;vy&#039;][step] * dt<br \/>\n        states[&#039;z&#039;][step] &#061; states[&#039;z&#039;][step &#8211; 1] &#043; states[&#039;vz&#039;][step] * dt<\/p>\n<p>        # \u5730\u9762\u78b0\u649e\u68c0\u6d4b<br \/>\n        if states[&#039;z&#039;][step] &gt; 0:<br \/>\n            states[&#039;z&#039;][step] &#061; 0<br \/>\n            states[&#039;vz&#039;][step] &#061; 0<br \/>\n            states[&#039;az&#039;][step] &#061; 0<\/p>\n<p>        # \u5b58\u50a8\u5176\u4ed6\u6570\u636e<br \/>\n        states[&#039;w1&#039;][step] &#061; w1<br \/>\n        states[&#039;w2&#039;][step] &#061; w2<br \/>\n        states[&#039;w3&#039;][step] &#061; w3<br \/>\n        states[&#039;w4&#039;][step] &#061; w4<br \/>\n        states[&#039;f&#039;][step] &#061; f<br \/>\n        states[&#039;ax&#039;][step] &#061; ax<br \/>\n        states[&#039;ay&#039;][step] &#061; ay<br \/>\n        states[&#039;az&#039;][step] &#061; az<br \/>\n        states[&#039;t&#039;][step] &#061; step * dt<\/p>\n<p>        # \u63d0\u524d\u7ec8\u6b62\u5982\u679c\u65e0\u4eba\u673a\u5df2\u8d77\u98de\u5e76\u7a33\u5b9a<br \/>\n        if step &gt; 100 and abs(states[&#039;z&#039;][step] &#8211; states[&#039;z&#039;][step &#8211; 10]) &lt; 0.1:<br \/>\n            actual_steps &#061; step &#043; 1  # \u5305\u62ec\u7d22\u5f150\u5230step<br \/>\n            break<\/p>\n<p>    # \u622a\u65ad\u6240\u6709\u6570\u7ec4\u5230\u5b9e\u9645\u6b65\u6570<br \/>\n    for key in states:<br \/>\n        states[key] &#061; states[key][:actual_steps]<\/p>\n<p>    return states<\/p>\n<p># \u53ef\u89c6\u5316\u51fd\u6570<br \/>\ndef visualize_results(states, throttle):<br \/>\n    # \u521b\u5efa3D\u8f68\u8ff9\u56fe<br \/>\n    scatter &#061; go.Scatter3d(<br \/>\n        x&#061;states[&#039;x&#039;],<br \/>\n        y&#061;states[&#039;y&#039;],<br \/>\n        z&#061;states[&#039;z&#039;],<br \/>\n        mode&#061;&#039;lines&#039;,<br \/>\n        line&#061;dict(<br \/>\n            width&#061;4,<br \/>\n            color&#061;np.linspace(0, 1, len(states[&#039;z&#039;])),<br \/>\n            colorscale&#061;&#039;Viridis&#039;<br \/>\n        ),<br \/>\n        name&#061;&#039;\u8f68\u8ff9&#039;<br \/>\n    )<\/p>\n<p>    # \u6dfb\u52a0\u8d77\u70b9\u548c\u7ec8\u70b9\u6807\u8bb0<br \/>\n    start_marker &#061; go.Scatter3d(<br \/>\n        x&#061;[states[&#039;x&#039;][0]],<br \/>\n        y&#061;[states[&#039;y&#039;][0]],<br \/>\n        z&#061;[states[&#039;z&#039;][0]],<br \/>\n        mode&#061;&#039;markers&#039;,<br \/>\n        marker&#061;dict(size&#061;6, color&#061;&#039;green&#039;),<br \/>\n        name&#061;&#039;\u8d77\u70b9&#039;<br \/>\n    )<\/p>\n<p>    end_marker &#061; go.Scatter3d(<br \/>\n        x&#061;[states[&#039;x&#039;][-1]],<br \/>\n        y&#061;[states[&#039;y&#039;][-1]],<br \/>\n        z&#061;[states[&#039;z&#039;][-1]],<br \/>\n        mode&#061;&#039;markers&#039;,<br \/>\n        marker&#061;dict(size&#061;6, color&#061;&#039;red&#039;),<br \/>\n        name&#061;&#039;\u7ec8\u70b9&#039;<br \/>\n    )<\/p>\n<p>    fig &#061; go.Figure(data&#061;[scatter, start_marker, end_marker])<\/p>\n<p>    # \u8bbe\u7f6e\u56fe\u8868\u5e03\u5c40<br \/>\n    fig.update_layout(<br \/>\n        scene&#061;dict(<br \/>\n            xaxis&#061;dict(title&#061;&#039;X\u4f4d\u7f6e (\u7c73)&#039;),<br \/>\n            yaxis&#061;dict(title&#061;&#039;Y\u4f4d\u7f6e (\u7c73)&#039;),<br \/>\n            zaxis&#061;dict(title&#061;&#039;\u9ad8\u5ea6 (\u7c73)&#039;),<br \/>\n            aspectratio&#061;dict(x&#061;2, y&#061;1, z&#061;1),<br \/>\n            camera&#061;dict(eye&#061;dict(x&#061;1.5, y&#061;1.5, z&#061;0.8))<br \/>\n        ),<br \/>\n        title&#061;f&#039;\u56db\u65cb\u7ffc\u98de\u884c\u8f68\u8ff9 (\u6cb9\u95e8&#061;{throttle})&#039;,<br \/>\n        height&#061;700<br \/>\n    )<\/p>\n<p>    # \u5728Streamlit\u4e2d\u663e\u793a<br \/>\n    st.plotly_chart(fig, use_container_width&#061;True)<\/p>\n<p>    # \u521b\u5efa2D\u56fe\u8868<br \/>\n    st.subheader(&#039;\u98de\u884c\u52a8\u6001\u6307\u6807&#039;)<\/p>\n<p>    # \u9ad8\u5ea6\u548c\u901f\u5ea6<br \/>\n    col1, col2 &#061; st.columns(2)<br \/>\n    with col1:<br \/>\n        st.markdown(&#034;#### \u9ad8\u5ea6&#034;)<br \/>\n        fig, ax &#061; plt.subplots()<br \/>\n        ax.plot(states[&#039;t&#039;], states[&#039;z&#039;], &#039;b-&#039;)<br \/>\n        ax.set_xlabel(&#039;\u65f6\u95f4 (\u79d2)&#039;)<br \/>\n        ax.set_ylabel(&#039;\u9ad8\u5ea6 (\u7c73)&#039;)<br \/>\n        ax.grid(True)<br \/>\n        ax.set_title(&#039;\u9ad8\u5ea6\u53d8\u5316&#039;)<br \/>\n        st.pyplot(fig)<\/p>\n<p>    with col2:<br \/>\n        st.markdown(&#034;#### \u5782\u76f4\u901f\u5ea6&#034;)<br \/>\n        fig, ax &#061; plt.subplots()<br \/>\n        ax.plot(states[&#039;t&#039;], states[&#039;vz&#039;], &#039;g-&#039;)<br \/>\n        ax.set_xlabel(&#039;\u65f6\u95f4 (\u79d2)&#039;)<br \/>\n        ax.set_ylabel(&#039;\u5782\u76f4\u901f\u5ea6 (\u7c73\/\u79d2)&#039;)<br \/>\n        ax.grid(True)<br \/>\n        ax.set_title(&#039;\u5782\u76f4\u901f\u5ea6\u53d8\u5316&#039;)<br \/>\n        st.pyplot(fig)<\/p>\n<p>    # \u59ff\u6001\u89d2\u5ea6<br \/>\n    st.markdown(&#034;#### \u59ff\u6001\u89d2\u5ea6&#034;)<br \/>\n    fig, ax &#061; plt.subplots()<br \/>\n    ax.plot(states[&#039;t&#039;], np.degrees(states[&#039;phi&#039;]), &#039;r-&#039;, label&#061;&#039;\u6eda\u8f6c\u89d2 \u03c6&#039;)<br \/>\n    ax.plot(states[&#039;t&#039;], np.degrees(states[&#039;theta&#039;]), &#039;g-&#039;, label&#061;&#039;\u4fef\u4ef0\u89d2 \u03b8&#039;)<br \/>\n    ax.plot(states[&#039;t&#039;], np.degrees(states[&#039;psi&#039;]), &#039;b-&#039;, label&#061;&#039;\u504f\u822a\u89d2 \u03c8&#039;)<br \/>\n    ax.set_xlabel(&#039;\u65f6\u95f4 (\u79d2)&#039;)<br \/>\n    ax.set_ylabel(&#039;\u89d2\u5ea6 (\u5ea6)&#039;)<br \/>\n    ax.legend()<br \/>\n    ax.grid(True)<br \/>\n    st.pyplot(fig)<\/p>\n<p>    # \u89d2\u901f\u5ea6<br \/>\n    st.markdown(&#034;#### \u89d2\u901f\u5ea6&#034;)<br \/>\n    fig, ax &#061; plt.subplots()<br \/>\n    ax.plot(states[&#039;t&#039;], states[&#039;p&#039;], &#039;m-&#039;, label&#061;&#039;x\u8f74\u89d2\u901f\u5ea6 p&#039;)<br \/>\n    ax.plot(states[&#039;t&#039;], states[&#039;q&#039;], &#039;c-&#039;, label&#061;&#039;y\u8f74\u89d2\u901f\u5ea6 q&#039;)<br \/>\n    ax.plot(states[&#039;t&#039;], states[&#039;r&#039;], &#039;y-&#039;, label&#061;&#039;z\u8f74\u89d2\u901f\u5ea6 r&#039;)<br \/>\n    ax.set_xlabel(&#039;\u65f6\u95f4 (\u79d2)&#039;)<br \/>\n    ax.set_ylabel(&#039;\u89d2\u901f\u5ea6 (\u5f27\u5ea6\/\u79d2)&#039;)<br \/>\n    ax.legend()<br \/>\n    ax.grid(True)<br \/>\n    st.pyplot(fig)<\/p>\n<p>    # \u87ba\u65cb\u6868\u8f6c\u901f<br \/>\n    st.markdown(&#034;#### \u87ba\u65cb\u6868\u8f6c\u901f&#034;)<br \/>\n    fig, ax &#061; plt.subplots()<br \/>\n    ax.plot(states[&#039;t&#039;], states[&#039;w1&#039;], &#039;r-&#039;, label&#061;&#039;\u87ba\u65cb\u68681&#039;)<br \/>\n    ax.plot(states[&#039;t&#039;], states[&#039;w2&#039;], &#039;g-&#039;, label&#061;&#039;\u87ba\u65cb\u68682&#039;)<br \/>\n    ax.plot(states[&#039;t&#039;], states[&#039;w3&#039;], &#039;b-&#039;, label&#061;&#039;\u87ba\u65cb\u68683&#039;)<br \/>\n    ax.plot(states[&#039;t&#039;], states[&#039;w4&#039;], &#039;m-&#039;, label&#061;&#039;\u87ba\u65cb\u68684&#039;)<br \/>\n    ax.set_xlabel(&#039;\u65f6\u95f4 (\u79d2)&#039;)<br \/>\n    ax.set_ylabel(&#039;\u89d2\u901f\u5ea6 (\u5f27\u5ea6\/\u79d2)&#039;)<br \/>\n    ax.legend()<br \/>\n    ax.grid(True)<br \/>\n    st.pyplot(fig)<\/p>\n<p>    # \u663e\u793a\u5173\u952e\u6307\u6807<br \/>\n    st.subheader(&#039;\u98de\u884c\u6458\u8981&#039;)<br \/>\n    final_altitude &#061; states[&#039;z&#039;][-1]<br \/>\n    max_altitude &#061; max(states[&#039;z&#039;])<br \/>\n    flight_time &#061; states[&#039;t&#039;][-1]<\/p>\n<p>    col1, col2, col3 &#061; st.columns(3)<br \/>\n    col1.metric(&#034;\u6700\u7ec8\u9ad8\u5ea6&#034;, f&#034;{final_altitude:.2f} \u7c73&#034;)<br \/>\n    col2.metric(&#034;\u5cf0\u503c\u9ad8\u5ea6&#034;, f&#034;{max_altitude:.2f} \u7c73&#034;)<br \/>\n    col3.metric(&#034;\u98de\u884c\u65f6\u95f4&#034;, f&#034;{flight_time:.1f} \u79d2&#034;)<\/p>\n<p>    # \u663e\u793a\u539f\u59cb\u6570\u636e<br \/>\n    if st.checkbox(&#039;\u663e\u793a\u539f\u59cb\u98de\u884c\u6570\u636e&#039;):<br \/>\n        data &#061; {<br \/>\n            &#039;\u65f6\u95f4&#039;: states[&#039;t&#039;],<br \/>\n            &#039;X\u4f4d\u7f6e&#039;: states[&#039;x&#039;],<br \/>\n            &#039;Y\u4f4d\u7f6e&#039;: states[&#039;y&#039;],<br \/>\n            &#039;\u9ad8\u5ea6&#039;: states[&#039;z&#039;],<br \/>\n            &#039;\u6cb9\u95e8&#039;: np.full_like(states[&#039;t&#039;], throttle)<br \/>\n        }<br \/>\n        st.dataframe(data)<\/p>\n<p># Streamlit\u5e94\u7528\u4e3b\u51fd\u6570<br \/>\ndef main():<br \/>\n    st.title(&#034;&#x1f3ae; \u56db\u65cb\u7ffc\u65e0\u4eba\u673a\u98de\u884c\u4eff\u771f\u5668&#034;)<br \/>\n    st.markdown(&#034;&#034;&#034;<br \/>\n    \u672c\u4eff\u771f\u5668\u57fa\u4e8e\u56db\u65cb\u7ffc\u65e0\u4eba\u673a\u7684\u7269\u7406\u53c2\u6570\u6a21\u62df\u5176\u98de\u884c\u52a8\u6001\u3002<br \/>\n    \u8c03\u6574\u6cb9\u95e8\u8bbe\u7f6e\u53ef\u4ee5\u89c2\u5bdf\u5176\u5bf9\u65e0\u4eba\u673a\u98de\u884c\u7279\u6027\u7684\u5f71\u54cd\u3002<br \/>\n    &#034;&#034;&#034;)<\/p>\n<p>    # \u521b\u5efa\u53c2\u6570\u8f93\u5165\u4fa7\u8fb9\u680f<br \/>\n    st.sidebar.header(&#034;\u56db\u65cb\u7ffc\u53c2\u6570\u8bbe\u7f6e&#034;)<\/p>\n<p>    # \u7528\u6237\u53ef\u8c03\u6574\u53c2\u6570<br \/>\n    throttle &#061; st.sidebar.slider(&#034;\u6cb9\u95e8\u8f93\u5165 (0.4-0.7)&#034;, 0.4, 0.7, 0.55, 0.01,<br \/>\n                                 help&#061;&#034;\u6cb9\u95e8\u63a7\u5236\u8f93\u5165 (0.4\u2248\u60ac\u505c, 0.7\u2248\u722c\u5347)&#034;)<\/p>\n<p>    flight_time &#061; st.sidebar.slider(&#034;\u4eff\u771f\u65f6\u95f4 (\u79d2)&#034;, 2.0, 30.0, 10.0, 0.5)<\/p>\n<p>    mass &#061; st.sidebar.slider(&#034;\u65e0\u4eba\u673a\u8d28\u91cf (kg)&#034;, 0.5, 3.0, 1.4, 0.1)<\/p>\n<p>    propeller_size &#061; st.sidebar.slider(&#034;\u87ba\u65cb\u6868\u5c3a\u5bf8 (\u7c73)&#034;, 0.1, 0.5, 0.225, 0.01,<br \/>\n                                       help&#061;&#034;\u673a\u4f53\u4e2d\u5fc3\u5230\u7535\u673a\u7684\u8ddd\u79bb&#034;)<\/p>\n<p>    # \u663e\u793a\u9884\u8bbe\u53c2\u6570<br \/>\n    st.sidebar.header(&#034;\u7269\u7406\u53c2\u6570&#034;)<br \/>\n    st.sidebar.write(f&#034;\u62c9\u529b\u7cfb\u6570: 1.105e-5 N\u00b7s\u00b2\/rad\u00b2&#034;)<br \/>\n    st.sidebar.write(f&#034;\u529b\u77e9\u7cfb\u6570: 1.779e-7 N\u00b7m\u00b7s\u00b2\/rad\u00b2&#034;)<br \/>\n    st.sidebar.write(f&#034;\u91cd\u529b\u52a0\u901f\u5ea6: 9.8 m\/s\u00b2&#034;)<\/p>\n<p>    # \u6dfb\u52a0\u5f00\u53d1\u8005\u5907\u6ce8<br \/>\n    st.sidebar.markdown(&#034;&#8212;&#034;)<br \/>\n    st.sidebar.info(&#034;&#034;&#034;<br \/>\n    **\u4eff\u771f\u8bf4\u660e:**<br \/>\n    &#8211; \u65e0\u4eba\u673a\u4ece\u5730\u4e0b100\u7c73\u5904\u5f00\u59cb\u98de\u884c<br \/>\n    &#8211; \u66f4\u9ad8\u7684\u6cb9\u95e8\u503c\u4f1a\u4ea7\u751f\u66f4\u5feb\u7684\u722c\u5347\u901f\u5ea6<br \/>\n    &#8211; \u5f53\u65e0\u4eba\u673a\u8fbe\u5230\u7a33\u5b9a\u9ad8\u5ea6\u65f6\u4eff\u771f\u4f1a\u81ea\u52a8\u505c\u6b62<br \/>\n    &#034;&#034;&#034;)<\/p>\n<p>    # \u521b\u5efa\u5f00\u59cb\u4eff\u771f\u6309\u94ae<br \/>\n    if st.button(&#039;\u5f00\u59cb\u98de\u884c\u4eff\u771f&#039;, use_container_width&#061;True):<br \/>\n        with st.spinner(&#039;\u4eff\u771f\u8fd0\u884c\u4e2d&#8230;&#039;):<br \/>\n            # \u521b\u5efa\u53c2\u6570\u5bf9\u8c61<br \/>\n            params &#061; QuadcopterParams()<br \/>\n            params.m &#061; mass<br \/>\n            params.d &#061; propeller_size<\/p>\n<p>            # \u8fd0\u884c\u4eff\u771f<br \/>\n            states &#061; simulate_quadcopter(flight_time, throttle)<\/p>\n<p>            # \u663e\u793a\u7ed3\u679c<br \/>\n            if len(states[&#039;t&#039;]) &gt; 10:<br \/>\n                # \u663e\u793a\u8d77\u98de\u6210\u529f\u6d88\u606f<br \/>\n                if states[&#039;z&#039;][-1] &gt;&#061; 0:<br \/>\n                    st.success(f&#034;&#x1f681; \u65e0\u4eba\u673a\u6210\u529f\u722c\u5347\u81f3 {states[&#039;z&#039;][-1]:.1f}\u7c73\u9ad8\u5ea6!&#034;)<br \/>\n                else:<br \/>\n                    st.warning(f&#034;\u26a0\ufe0f \u65e0\u4eba\u673a\u4ecd\u5728 {states[&#039;z&#039;][-1]:.1f}\u7c73\u9ad8\u5ea6 &#8211; \u8bf7\u589e\u52a0\u6cb9\u95e8\u503c!&#034;)<\/p>\n<p>                # \u663e\u793a\u53ef\u89c6\u5316<br \/>\n                visualize_results(states, throttle)<br \/>\n            else:<br \/>\n                st.error(&#034;\u4eff\u771f\u5931\u8d25&#xff0c;\u8bf7\u5c1d\u8bd5\u4e0d\u540c\u7684\u53c2\u6570\u3002&#034;)<\/p>\n<p>if __name__ &#061;&#061; &#034;__main__&#034;:<br \/>\n    main()<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb236\u6b21\u3002\u6458\u8981\uff1a\u672c\u6587\u4ecb\u7ecd\u4e86\u4e00\u4e2a\u57fa\u4e8e\u56db\u65cb\u7ffc\u65e0\u4eba\u673a\u7269\u7406\u6a21\u578b\u7684\u4ea4\u4e92\u5f0f\u4eff\u771f\u7cfb\u7edf\uff0c\u901a\u8fc7Streamlit\u5b9e\u73b0\u53ef\u89c6\u5316\u754c\u9762\u3002\u7cfb\u7edf\u6838\u5fc3\u4e3asimulate_quadcopter\u51fd\u6570\uff0c\u91c7\u7528\u6b27\u62c9\u65b9\u6cd5\u8fdb\u884c\u6570\u503c\u79ef\u5206\uff0c\u6a21\u62df\u65e0\u4eba\u673a\u98de\u884c\u52a8\u6001\uff0c\u5305\u62ec\u4f4d\u7f6e\u3001\u901f\u5ea6\u7b49\u72b6\u6001\u53d8\u91cf\u3002visualize_results\u51fd\u6570\u5229\u7528Plotly\u548cMatplotlib\u5b9e\u73b0\u591a\u7ef4\u5ea6\u6570\u636e\u53ef\u89c6\u5316\u3002Streamlit\u5e94\u7528\u5141\u8bb8\u7528\u6237\u8c03\u8282\u6cb9\u95e8\u3001\u8d28\u91cf\u7b49\u53c2\u6570\uff0c\u52a8\u6001\u5c55\u793a3D\u8f68\u8ff9\u548c2D\u6307\u6807\u56fe\u3002\u7cfb\u7edf\u8bbe\u7f6e\u4e86\u4eff\u771f\u63d0\u524d\u7ec8\u6b62\u6761\u4ef6\uff0c\u5f53\u9ad8\u5ea6\u53d8\u5316\u5c0f\u4e8e\u9608\u503c\u65f6\u505c\u6b62\u8ba1\u7b97\uff0c\u4f18\u5316\u4e86\u4eff\u771f\u6548\u7387\u3002<\/p>\n","protected":false},"author":2,"featured_media":49798,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[81,3267],"topic":[],"class_list":["post-49799","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-python","tag-3267"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u57fa\u4e8ePython\u7684\u56db\u65cb\u7ffc\u65e0\u4eba\u673a\u4eff\u771f\u7cfb\u7edf\uff1a\u4ece\u6b27\u62c9\u79ef\u5206\u5230Streamlit\u4ea4\u4e92\u5f0f\u53ef\u89c6\u5316 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/49799.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u57fa\u4e8ePython\u7684\u56db\u65cb\u7ffc\u65e0\u4eba\u673a\u4eff\u771f\u7cfb\u7edf\uff1a\u4ece\u6b27\u62c9\u79ef\u5206\u5230Streamlit\u4ea4\u4e92\u5f0f\u53ef\u89c6\u5316 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb236\u6b21\u3002\u6458\u8981\uff1a\u672c\u6587\u4ecb\u7ecd\u4e86\u4e00\u4e2a\u57fa\u4e8e\u56db\u65cb\u7ffc\u65e0\u4eba\u673a\u7269\u7406\u6a21\u578b\u7684\u4ea4\u4e92\u5f0f\u4eff\u771f\u7cfb\u7edf\uff0c\u901a\u8fc7Streamlit\u5b9e\u73b0\u53ef\u89c6\u5316\u754c\u9762\u3002\u7cfb\u7edf\u6838\u5fc3\u4e3asimulate_quadcopter\u51fd\u6570\uff0c\u91c7\u7528\u6b27\u62c9\u65b9\u6cd5\u8fdb\u884c\u6570\u503c\u79ef\u5206\uff0c\u6a21\u62df\u65e0\u4eba\u673a\u98de\u884c\u52a8\u6001\uff0c\u5305\u62ec\u4f4d\u7f6e\u3001\u901f\u5ea6\u7b49\u72b6\u6001\u53d8\u91cf\u3002visualize_results\u51fd\u6570\u5229\u7528Plotly\u548cMatplotlib\u5b9e\u73b0\u591a\u7ef4\u5ea6\u6570\u636e\u53ef\u89c6\u5316\u3002Streamlit\u5e94\u7528\u5141\u8bb8\u7528\u6237\u8c03\u8282\u6cb9\u95e8\u3001\u8d28\u91cf\u7b49\u53c2\u6570\uff0c\u52a8\u6001\u5c55\u793a3D\u8f68\u8ff9\u548c2D\u6307\u6807\u56fe\u3002\u7cfb\u7edf\u8bbe\u7f6e\u4e86\u4eff\u771f\u63d0\u524d\u7ec8\u6b62\u6761\u4ef6\uff0c\u5f53\u9ad8\u5ea6\u53d8\u5316\u5c0f\u4e8e\u9608\u503c\u65f6\u505c\u6b62\u8ba1\u7b97\uff0c\u4f18\u5316\u4e86\u4eff\u771f\u6548\u7387\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/49799.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-30T11:57:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730115713-688a08998c81d.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/49799.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/49799.html\",\"name\":\"\u57fa\u4e8ePython\u7684\u56db\u65cb\u7ffc\u65e0\u4eba\u673a\u4eff\u771f\u7cfb\u7edf\uff1a\u4ece\u6b27\u62c9\u79ef\u5206\u5230Streamlit\u4ea4\u4e92\u5f0f\u53ef\u89c6\u5316 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-07-30T11:57:17+00:00\",\"dateModified\":\"2025-07-30T11:57:17+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/49799.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/49799.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/49799.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u57fa\u4e8ePython\u7684\u56db\u65cb\u7ffc\u65e0\u4eba\u673a\u4eff\u771f\u7cfb\u7edf\uff1a\u4ece\u6b27\u62c9\u79ef\u5206\u5230Streamlit\u4ea4\u4e92\u5f0f\u53ef\u89c6\u5316\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u57fa\u4e8ePython\u7684\u56db\u65cb\u7ffc\u65e0\u4eba\u673a\u4eff\u771f\u7cfb\u7edf\uff1a\u4ece\u6b27\u62c9\u79ef\u5206\u5230Streamlit\u4ea4\u4e92\u5f0f\u53ef\u89c6\u5316 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/49799.html","og_locale":"zh_CN","og_type":"article","og_title":"\u57fa\u4e8ePython\u7684\u56db\u65cb\u7ffc\u65e0\u4eba\u673a\u4eff\u771f\u7cfb\u7edf\uff1a\u4ece\u6b27\u62c9\u79ef\u5206\u5230Streamlit\u4ea4\u4e92\u5f0f\u53ef\u89c6\u5316 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb236\u6b21\u3002\u6458\u8981\uff1a\u672c\u6587\u4ecb\u7ecd\u4e86\u4e00\u4e2a\u57fa\u4e8e\u56db\u65cb\u7ffc\u65e0\u4eba\u673a\u7269\u7406\u6a21\u578b\u7684\u4ea4\u4e92\u5f0f\u4eff\u771f\u7cfb\u7edf\uff0c\u901a\u8fc7Streamlit\u5b9e\u73b0\u53ef\u89c6\u5316\u754c\u9762\u3002\u7cfb\u7edf\u6838\u5fc3\u4e3asimulate_quadcopter\u51fd\u6570\uff0c\u91c7\u7528\u6b27\u62c9\u65b9\u6cd5\u8fdb\u884c\u6570\u503c\u79ef\u5206\uff0c\u6a21\u62df\u65e0\u4eba\u673a\u98de\u884c\u52a8\u6001\uff0c\u5305\u62ec\u4f4d\u7f6e\u3001\u901f\u5ea6\u7b49\u72b6\u6001\u53d8\u91cf\u3002visualize_results\u51fd\u6570\u5229\u7528Plotly\u548cMatplotlib\u5b9e\u73b0\u591a\u7ef4\u5ea6\u6570\u636e\u53ef\u89c6\u5316\u3002Streamlit\u5e94\u7528\u5141\u8bb8\u7528\u6237\u8c03\u8282\u6cb9\u95e8\u3001\u8d28\u91cf\u7b49\u53c2\u6570\uff0c\u52a8\u6001\u5c55\u793a3D\u8f68\u8ff9\u548c2D\u6307\u6807\u56fe\u3002\u7cfb\u7edf\u8bbe\u7f6e\u4e86\u4eff\u771f\u63d0\u524d\u7ec8\u6b62\u6761\u4ef6\uff0c\u5f53\u9ad8\u5ea6\u53d8\u5316\u5c0f\u4e8e\u9608\u503c\u65f6\u505c\u6b62\u8ba1\u7b97\uff0c\u4f18\u5316\u4e86\u4eff\u771f\u6548\u7387\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/49799.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-07-30T11:57:17+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730115713-688a08998c81d.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"7 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/49799.html","url":"https:\/\/www.wsisp.com\/helps\/49799.html","name":"\u57fa\u4e8ePython\u7684\u56db\u65cb\u7ffc\u65e0\u4eba\u673a\u4eff\u771f\u7cfb\u7edf\uff1a\u4ece\u6b27\u62c9\u79ef\u5206\u5230Streamlit\u4ea4\u4e92\u5f0f\u53ef\u89c6\u5316 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-07-30T11:57:17+00:00","dateModified":"2025-07-30T11:57:17+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/49799.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/49799.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/49799.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u57fa\u4e8ePython\u7684\u56db\u65cb\u7ffc\u65e0\u4eba\u673a\u4eff\u771f\u7cfb\u7edf\uff1a\u4ece\u6b27\u62c9\u79ef\u5206\u5230Streamlit\u4ea4\u4e92\u5f0f\u53ef\u89c6\u5316"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/49799","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=49799"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/49799\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/49798"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=49799"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=49799"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=49799"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=49799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}