simple_pendulum.model
Model
Submodules
simple_pendulum.model.parameters
- param ..:
!! processed by numpydoc !!
- class simple_pendulum.model.parameters.Actuators
Bases:
object
- calc_k_e(k_v)
- calc_k_m(k_t, resist)
- calc_k_t_from_k_m(k_m, resist)
- calc_k_t_from_k_v(k_v)
- calc_k_v(v_per_hz)
- class simple_pendulum.model.parameters.Environment
Bases:
object
- class simple_pendulum.model.parameters.Joints
Bases:
object
- class simple_pendulum.model.parameters.Links
Bases:
object
- calc_inertia(mass_p, mass_l, length)
- calc_inertia_com(mass_p, mass_l, length)
- calc_length_com(mass_p, mass_l, length)
- calc_m_l(mass, mass_p)
- class simple_pendulum.model.parameters.Robot
Bases:
object
- simple_pendulum.model.parameters.get_params(params_path)
Retrieve parameters from a yaml file with name
params_path
simple_pendulum.model.pendulum_plant
Pendulum Plant
- class simple_pendulum.model.pendulum_plant.PendulumPlant(mass=1.0, length=0.5, damping=0.1, gravity=9.81, coulomb_fric=0.0, inertia=None, torque_limit=inf)
Bases:
object
- forward_dynamics(state, tau)
Computes forward dynamics
- Parameters:
- statearray like
len(state)=2 The state of the pendulum [angle, angular velocity] floats, units: rad, rad/s
- taufloat
motor torque, unit: Nm
- Returns:
- float, angular acceleration, unit: rad/s^2
- forward_kinematics(pos)
Computes the forward kinematics.
- Parameters:
- posfloat, angle of the pendulum
- Returns:
- listA list containing one list (for one end-effector)
The inner list contains the x and y coordinates for the end-effector of the pendulum
- inverse_dynamics(state, accn)
Computes inverse dynamics
- Parameters:
- statearray like
len(state)=2 The state of the pendulum [angle, angular velocity] floats, units: rad, rad/s
- accnfloat
angular acceleration, unit: rad/s^2
- Returns:
- taufloat
motor torque, unit: Nm
- inverse_kinematics(ee_pos)
Comutes inverse kinematics
- Parameters:
- ee_posarray like,
len(state)=2 contains the x and y position of the end_effector floats, units: m
- Returns:
- posfloat
angle of the pendulum, unit: rad
- kinetic_energy(state)
- load_params_from_file(filepath)
Load the pendulum parameters from a yaml file.
- Parameters:
- filepathstring
path to yaml file
- potential_energy(state)
- rhs(t, state, tau)
Computes the integrand of the equations of motion.
- Parameters:
- tfloat
time, not used (the dynamics of the pendulum are time independent)
- statearray like
len(state)=2 The state of the pendulum [angle, angular velocity] floats, units: rad, rad/s
- taufloat or array like
motor torque, unit: Nm
- Returns:
- resarray like
the integrand, contains [angular velocity, angular acceleration]
- total_energy(state)
simple_pendulum.model.system_identification
System Identification
simple_pendulum.model.unit_test
Unit Tests
- class simple_pendulum.model.unit_test.Test(methodName='runTest')
Bases:
TestCase
- CFRICS = [0.0, 0.01, 0.1, 1.0]
- DAMPINGS = [0.0, 0.01, 0.1, 1.0]
- GRAVITY = [0.0, 9.81]
- LENGTHS = [0.01, 0.1, 1.0, 10.0, 100.0]
- MASSES = [0.01, 0.1, 1.0, 10.0, 100.0]
- TLIMITS = [1.0, 2.0, 3.0, 5.0, inf]
- epsilon = 0.0001
- iterations = 10
- max_angle = 5.0
- max_tau = 5.0
- max_vel = 5.0
- test_0_kinematics()
Unit test for pendulum kinematics
- test_1_dynamics()
Unit test for pendulum dynamics