Danfoa / MorphoSymm

Tools for exploiting Morphological Symmetries in robotics
https://danfoa.github.io/MorphoSymm/
MIT License
49 stars 3 forks source link

PinBulletWrapper Attribute Missing #4

Closed itaouil closed 7 months ago

itaouil commented 7 months ago

Hi,

When running the following example:

from morpho_symm.utils.robot_utils import load_symmetric_system

robot, G = load_symmetric_system(robot_name='mini_cheetah')
_, v_js = robot.get_joint_space_state()

rep_TqQ_js = G.representations["TqQ_js"]
for g in G.elements:
  g_v_js = rep_TqQ_js(g) @ v_js

I get this error:

image

Danfoa commented 7 months ago

Hi @itaouil,

As stated in the function documentation, this method fetches the joint-space state of the system from the current physics simulator used (PyBullet in this case). This means that you need to configure it using bullet simulation.

pb = configure_bullet_simulation(gui=True/False)

before trying to get the system state within the simulation.

I should clearly state this in the examples. Sorry, and thanks for catching this.

Danfoa commented 7 months ago

Added it to documentation in Readme:

from morpho_symm.utils.pybullet_visual_utils import configure_bullet_simulation

# Load robot to pybullet simulation environment. Robot state will be the simulation state. 
bullet_client = configure_bullet_simulation(gui=True)         # Start pybullet simulation
robot.configure_bullet_simulation(bullet_client, world=None)  # Load robot in pybullet environment

# Get the state of the system
q, v = robot.get_state()  #  q ∈ Q, v ∈ TqQ
# Get the robot's base configuration XB ∈ E3 as a homogenous transformation matrix.
XB = robot.get_base_configuration()
# Get joint space position and velocity coordinates  (q_js, v_js) | q_js ∈ Qjs, dq_js ∈ TqQjs
q_js, v_js = robot.get_joint_space_state()
Danfoa commented 7 months ago

Please note that the use of the pybullet simulator is not required for this repository.

While I utilized pybullet primarily for visualization purposes, practitioners are not limited to this particular physics simulator. The main value of the repository lies in the definitions of the group representations for each robot.

Future versions of the repository will aim to minimize development efforts towards integrating a specific physics simulator. Instead, the focus will be on providing group representations that can be utilized across various applications and physics simulators, according to user preference.