We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A body at position (0,0) traveling with a speed v in the direction gamma ought to be at position (v*cos(gamma)*t, v*sin(gamma)*t) by time t.
(0,0)
v
gamma
(v*cos(gamma)*t, v*sin(gamma)*t)
t
I've set all the forces to zero (requires the work-around for issue #427 with a dummy variable)
import sympy as sp from math import radians import sympy.physics.mechanics as me from pydy.system import System import numpy as np f = sp.Symbol('f') t = sp.Symbol('t') x, y = me.dynamicsymbols('x y') # cartesian position v, gamma = me.dynamicsymbols('v gamma') # polar velocity xd, yd = me.dynamicsymbols('x y', 1) kd_eqs = [ xd - v*sp.cos(gamma), yd - v*sp.sin(gamma) ] BaseFrame = me.ReferenceFrame('BaseFrame') origin = me.Point('origin') bodycentre = origin.locatenew('bodycentre', x*BaseFrame.x + y*BaseFrame.y) # either one will do bodycentre.set_vel(BaseFrame, bodycentre.pos_from(origin).diff(t, BaseFrame)) #bodycentre.set_vel(BaseFrame, v*sp.cos(gamma)*BaseFrame.x + v*sp.sin(gamma)*BaseFrame.y) Izz = me.outer(BaseFrame.z, BaseFrame.z)*10 body = me.RigidBody(name="body", masscenter=bodycentre, frame=BaseFrame, mass=10, inertia=(Izz, bodycentre)) forces = [ (bodycentre, f*BaseFrame.x) ] bodies = [ body ] KM = me.KanesMethod(BaseFrame, q_ind=[x,y], u_ind=[v,gamma], kd_eqs=kd_eqs) fr, frstar = KM.kanes_equations(bodies, forces) times = np.linspace(0.0, 1, 101) # 0.01 second increments sys = System(KM, constants={f:0}, # hardcoding f=0 causes issue #427 initial_conditions={x:0, y:0, v:5, gamma:radians(90) }, times=times) y1 = sys.integrate() print(times[:2]) y1[:2]
If the velocity direction is gamma:radians(0) (along x), then y1[:2] is correctly:
gamma:radians(0)
array([[0. , 0. , 5. , 0. ], [0.05, 0. , 5. , 0. ]])
But if you leave it gamma:radians(90) (along y), then y1[:2] is:
gamma:radians(90)
array([[ 0. , 0. , 5. , 1.57079633], [-0.07853982, 0.05 , 5. , 1.57079633]])
For some reason it's deciding to introduce an extra component of velocity in the x-direction of v*gamma.
v*gamma
I've extracted this down from the more complex model I was trying to do, but if this doesn't work, then nothing will.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
A body at position
(0,0)
traveling with a speedv
in the directiongamma
ought to be at position(v*cos(gamma)*t, v*sin(gamma)*t)
by timet
.I've set all the forces to zero (requires the work-around for issue #427 with a dummy variable)
If the velocity direction is
gamma:radians(0)
(along x), then y1[:2] is correctly:But if you leave it
gamma:radians(90)
(along y), then y1[:2] is:For some reason it's deciding to introduce an extra component of velocity in the x-direction of
v*gamma
.I've extracted this down from the more complex model I was trying to do, but if this doesn't work, then nothing will.
The text was updated successfully, but these errors were encountered: