2. Reference

2.1. Simulating with the lwr4 model

Constants (class variables):

  • lwrsim.lwr4.DynamicsSimulator.numJointsModel

    Number of joints the model describes (int)

  • lwrsim.lwr4.DynamicsSimulator.numJointsRobot

    Number of joints the robot actually has (int)

  • lwrsim.lwr4.DynamicsSimulator.simulatedJoints

    List of joints wrt. the whole robot which are described by the model (List)

class lwrsim.lwr4.DynamicsSimulator

DynamicsSimulator(sampleTime=0.01, q0=None, dq0=None, makeConsistent=True, **kwargs)

This class interconntects the ODE solver SUNDIALS IDA, one of the dynamic robot models via the lwrsundialsmodels library and Python. It does most of the setup of the ODE solver and provides robot-specific functions to simulate and to get the results.

Args:
sampleTime (float): The sampling time to use. A single simulation run
will always simulate for this long, in [s].

q0 (list of floats): List of initial joint positions, in [rad].

dq0 (list of floats): List of initial joint velocities, in [rad/s].

makeConsistent (bool): Compute consistent inital values for the solver.
In general recommended. See also SUNDIALS IDA documentation.
Kwargs:

abstol (float): Absolute tolerance setting for the solver (required)

reltol (float): Relative tolerance setting for the solver (required)

mxsteps (int): Maximum number of internal steps allowed to be
calculated within a single simulation run

Note

Even if the model only describes some joints of the robot, the simulator expects and returns lists with values for all joints of the robot.

calc_next_state(self, list torques)
Simulate the motion dynamics of the robot for the supplied
joint torques to time plus sampling time
Args:
torques (list): List of torques to be used as input for the system
of robot motion dynamics. Unit: Nm
Raises:
IDAError

Note

Even if the model only describes some joints of the robot, the simulator expects and returns lists with values for all joints of the robot.

get_joint_positions(self)

Return the current joint positions from the state of the simulated system of robot motion dynamics.

Returns:
List of joint positions in rad

Note

Even if the model only describes some joints of the robot, the simulator expects and returns lists with values for all joints of the robot.

get_joint_velocities(self)

Return the current joint velocities from the state of the simulated system of robot motion dynamics.

Returns:
List of joint velocities in rad/s

Note

Even if the model only describes some joints of the robot, the simulator expects and returns lists with values for all joints of the robot.

sampleTime

sampleTime: ‘double’

set_state(self, list q, list dq, makeconsistent)

Set the current state of the simulated system of robot motion dynamics.

Args:

q (list): Joint positions the system should be set to

dq (list): Joint velocities the system should be set to

makeconsistent (bool): Recompute consistent values for the
solver.

Note

Even if the model only describes some joints of the robot, the simulator expects and returns lists with values for all joints of the robot.

settings

settings: sundials.sundials.IDASettings

stat(self)

Return solver statistics

2.2. Simulating with the lwr4_q1q2q4 model

Constants (class variables):

  • lwrsim.lwr4_q1q2q4.DynamicsSimulator.numJointsModel

    Number of joints the model describes (int)

  • lwrsim.lwr4_q1q2q4.DynamicsSimulator.numJointsRobot

    Number of joints the robot actually has (int)

  • lwrsim.lwr4_q1q2q4.DynamicsSimulator.simulatedJoints

    List of joints wrt. the whole robot which are described by the model (List)

class lwrsim.lwr4_q1q2q4.DynamicsSimulator

DynamicsSimulator(sampleTime=0.01, q0=None, dq0=None, makeConsistent=True, **kwargs)

This class interconntects the ODE solver SUNDIALS IDA, one of the dynamic robot models via the lwrsundialsmodels library and Python. It does most of the setup of the ODE solver and provides robot-specific functions to simulate and to get the results.

Args:
sampleTime (float): The sampling time to use. A single simulation run
will always simulate for this long, in [s].

q0 (list of floats): List of initial joint positions, in [rad].

dq0 (list of floats): List of initial joint velocities, in [rad/s].

makeConsistent (bool): Compute consistent inital values for the solver.
In general recommended. See also SUNDIALS IDA documentation.
Kwargs:

abstol (float): Absolute tolerance setting for the solver (required)

reltol (float): Relative tolerance setting for the solver (required)

mxsteps (int): Maximum number of internal steps allowed to be
calculated within a single simulation run

Note

Even if the model only describes some joints of the robot, the simulator expects and returns lists with values for all joints of the robot.

calc_next_state(self, list torques)
Simulate the motion dynamics of the robot for the supplied
joint torques to time plus sampling time
Args:
torques (list): List of torques to be used as input for the system
of robot motion dynamics. Unit: Nm
Raises:
IDAError

Note

Even if the model only describes some joints of the robot, the simulator expects and returns lists with values for all joints of the robot.

get_joint_positions(self)

Return the current joint positions from the state of the simulated system of robot motion dynamics.

Returns:
List of joint positions in rad

Note

Even if the model only describes some joints of the robot, the simulator expects and returns lists with values for all joints of the robot.

get_joint_velocities(self)

Return the current joint velocities from the state of the simulated system of robot motion dynamics.

Returns:
List of joint velocities in rad/s

Note

Even if the model only describes some joints of the robot, the simulator expects and returns lists with values for all joints of the robot.

sampleTime

sampleTime: ‘double’

set_state(self, list q, list dq, makeconsistent)

Set the current state of the simulated system of robot motion dynamics.

Args:

q (list): Joint positions the system should be set to

dq (list): Joint velocities the system should be set to

makeconsistent (bool): Recompute consistent values for the
solver.

Note

Even if the model only describes some joints of the robot, the simulator expects and returns lists with values for all joints of the robot.

settings

settings: sundials.sundials.IDASettings

stat(self)

Return solver statistics

2.3. Simulating with the lwr4_q2q4 model

Constants (class variables):

  • lwrsim.lwr4_q2q4.DynamicsSimulator.numJointsModel

    Number of joints the model describes (int)

  • lwrsim.lwr4_q2q4.DynamicsSimulator.numJointsRobot

    Number of joints the robot actually has (int)

  • lwrsim.lwr4_q2q4.DynamicsSimulator.simulatedJoints

    List of joints wrt. the whole robot which are described by the model (List)

class lwrsim.lwr4_q2q4.DynamicsSimulator

DynamicsSimulator(sampleTime=0.01, q0=None, dq0=None, makeConsistent=True, **kwargs)

This class interconntects the ODE solver SUNDIALS IDA, one of the dynamic robot models via the lwrsundialsmodels library and Python. It does most of the setup of the ODE solver and provides robot-specific functions to simulate and to get the results.

Args:
sampleTime (float): The sampling time to use. A single simulation run
will always simulate for this long, in [s].

q0 (list of floats): List of initial joint positions, in [rad].

dq0 (list of floats): List of initial joint velocities, in [rad/s].

makeConsistent (bool): Compute consistent inital values for the solver.
In general recommended. See also SUNDIALS IDA documentation.
Kwargs:

abstol (float): Absolute tolerance setting for the solver (required)

reltol (float): Relative tolerance setting for the solver (required)

mxsteps (int): Maximum number of internal steps allowed to be
calculated within a single simulation run

Note

Even if the model only describes some joints of the robot, the simulator expects and returns lists with values for all joints of the robot.

calc_next_state(self, list torques)
Simulate the motion dynamics of the robot for the supplied
joint torques to time plus sampling time
Args:
torques (list): List of torques to be used as input for the system
of robot motion dynamics. Unit: Nm
Raises:
IDAError

Note

Even if the model only describes some joints of the robot, the simulator expects and returns lists with values for all joints of the robot.

get_joint_positions(self)

Return the current joint positions from the state of the simulated system of robot motion dynamics.

Returns:
List of joint positions in rad

Note

Even if the model only describes some joints of the robot, the simulator expects and returns lists with values for all joints of the robot.

get_joint_velocities(self)

Return the current joint velocities from the state of the simulated system of robot motion dynamics.

Returns:
List of joint velocities in rad/s

Note

Even if the model only describes some joints of the robot, the simulator expects and returns lists with values for all joints of the robot.

sampleTime

sampleTime: ‘double’

set_state(self, list q, list dq, makeconsistent)

Set the current state of the simulated system of robot motion dynamics.

Args:

q (list): Joint positions the system should be set to

dq (list): Joint velocities the system should be set to

makeconsistent (bool): Recompute consistent values for the
solver.

Note

Even if the model only describes some joints of the robot, the simulator expects and returns lists with values for all joints of the robot.

settings

settings: sundials.sundials.IDASettings

stat(self)

Return solver statistics