{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle l \\dot{q}_{1}\\mathbf{\\hat{a}_x} + l \\dot{q}_{2}\\mathbf{\\hat{b}_x}$" ], "text/plain": [ "l⋅q₁̇ a_x + l⋅q₂̇ b_x" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import sympy as sm\n", "import sympy.physics.mechanics as me\n", "me.init_vprinting(use_latex='mathjax')\n", "\n", "l = sm.symbols('l')\n", "q1, q2, u1, u2 = me.dynamicsymbols('q1, q2, u1, u2')\n", "\n", "N = me.ReferenceFrame('N')\n", "A = me.ReferenceFrame('A')\n", "B = me.ReferenceFrame('B')\n", "\n", "A.orient_axis(N, q1, N.z)\n", "B.orient_axis(N, q2, N.z)\n", "\n", "O = me.Point('O')\n", "P1 = me.Point('P1')\n", "P2 = me.Point('P2')\n", "\n", "O.set_vel(N, 0)\n", "\n", "P1.set_pos(O, -l*A.y)\n", "P2.set_pos(P1, -l*B.y)\n", "\n", "P1.v2pt_theory(O, N, A)\n", "P2.v2pt_theory(P1, N, B)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle l \\cos{\\left(q_{1} \\right)} \\dot{q}_{1}\\mathbf{\\hat{n}_x} + l \\sin{\\left(q_{1} \\right)} \\dot{q}_{1}\\mathbf{\\hat{n}_y}$" ], "text/plain": [ "l⋅cos(q₁)⋅q₁̇ n_x + l⋅sin(q₁)⋅q₁̇ n_y" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "P1.vel(N).express(N)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 两杆连接" ] } ], "metadata": { "kernelspec": { "display_name": "Turtle", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.8" } }, "nbformat": 4, "nbformat_minor": 2 }