Skip to content

Running the example with jaxsim throws errors #35

@akhilsathuluri

Description

@akhilsathuluri

I wanted to try out the example in jaxsim but got this error,

jaxsim[38845] WARNING The joint order in the model description is not preserved when reducing the model. Consider using the `names_to_indices` method to get the correct order of the joints, or use the `joint_names()` method to inspect the internal joint ordering.
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[5], line 4
      1 # ==== Define JaxSim simulator and set initial position ====
      3 js = JaxsimSimulator(dt=js_dt, contact_model_type=JaxsimContactModelEnum.RIGID)
----> 4 js.load_model(
      5     robot_model=robot_model_init,
      6     s=s_0,
      7     xyz_rpy=xyz_rpy_0,
      8     # Possible choices are "record", "interactive" or None (no visualization)
      9     visualization_mode="record",
     10 )
     12 s_js, ds_js, tau_js = js.get_state()
     13 t = 0.0

File ~/git/comodo/src/comodo/jaxsimSimulator/jaxsimSimulator.py:220, in JaxsimSimulator.load_model(self, robot_model, xyz_rpy, s, contact_params, left_foot_link_name, right_foot_link_name, left_foot_sole_frame_name, right_foot_sole_frame_name, visualization_mode)
    216 self._to_user = get_joint_map(from_=js_joint_names, to=user_joint_names)
    218 s = np.zeros(self._model.dofs()) if s is None else np.array(s)[self._to_js]
--> 220 self._data = js.data.JaxSimModelData.build(
    221     model=self._model,
    222     velocity_representation=VelRepr.Mixed,
    223     base_position=jnp.array(xyz_rpy[:3]),
    224     base_quaternion=jnp.array(JaxsimSimulator._RPY_to_quat(*xyz_rpy[3:])),
    225     joint_positions=jnp.array(s),
    226     contacts_params=contact_params,
    227 )
    229 # Initialize tau to zero
    230 self._tau = np.zeros(self._model.dofs())

TypeError: JaxSimModelData.build() got an unexpected keyword argument 'contacts_params'

A quick check at jaxsim shows that there is a similar argument called contact_state. But simply changing it to this new argument did not fix the issue and cause a probably (un)realated error.

Maybe related to the plan here: #33

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions