Class for running simulation#

class B1Env.b1_env.B1Sim(render_mode: Optional[str] = None, record_path=None, useFixedBase=False)#
__init__(self, render_mode: Optional[str] = None, record_path=None, useFixedBase=False)#
Parameters
  • render_mode (str or None) – if “human” the simultion will run in gui, otherwise it will be ran headless.

  • record_path (str or None) – the path where the recording of the simulation will be stored, if not specified the simulation will not be recorded.

  • useFixedBase (bool) – whether the base of the B1 robot will be fixed in air or will it be floating.

reset(self, *, seed: Optional[int] = None, options: Optional[dict] = None)#

Reset the simulation environment.

Parameters
  • seed (int or None) – random seed to be set to.

  • options (dict or None) – options for resetting the environment.

Returns

information about the dynamics and kinematics of the robot.

Return type

dict

step(self, action)#

Step the PyBullet simulation environment.

Parameters

action (ndarray) – joint torques to be applied to the robot

Returns

information about the dynamics and kinematics of the robot.

Return type

dict

get_info(self, q, dq)#

Get and compute the kinematic and dynamics information of the robot.

Parameters
  • q (ndarray) – joint positions of the robot.

  • dq (ndarray) – joint velocities of the robot.

Returns

information about the dynamics and kinematics of the robot.

Return type

dict

close(self)#

Disconnecting from the PyBullet client

get_state(self)#

Get joint position and joint velocity from PyBullet simulation

Returns

(q, dq) the joint position and joint velocity .

Return type

Tuple(ndarray, ndarry)

update_pinocchio(self, q, dq)#

Update the robot model in Pinocchio.

Parameters
  • q (ndarray) – joint positions of the robot.

  • dq (ndarray) – joint velocities of the robot.

get_state_update_pinocchio(self)#

Get the robot state from PyBullet and update the robot model in Pinocchio.

Returns

(q, dq) the joint position and joint velocity .

Return type

Tuple(ndarray, ndarry)

send_joint_command(self, tau)#

Apply the commanded joint torques to the PyBullet simulation.

Parameters

tau (ndarray) – commanded joint torques.