Bug Description
Hi team, this is not a bug but in my opinion some parameters/options need better documentation. Best example of this is the batch_dofs_info option. I had to look into the solver's code to see what this is doing and how its converting the shapes. The parameter is missing from RigidOptions docs in general.
For someone who is like me and doesn't "just get it", if you don't know about this parameter all the getter and setters for a RigidEntity will have wrong shape and from this someone can infer that the feature has not been implemented yet or get errors that scream about the shape (in setter functions).
Parameters of RigidEntity objects in the scene such as:
get_dofs_act_gain
get_dofs_bias
get_dofs_force_range
....
All are affected and have shape (n_dofs) instead of the expected (n_envs, n_dofs).
Note: I understand why this parameter is set to false by default for performance reasons.
KinematicOptions on the other hand are defined as:
|
class KinematicOptions(Options): |
|
""" |
|
Options configuring the KinematicSolver (visualization-only solver). |
|
|
|
KinematicSolver is a lightweight solver for ghost/reference entities that only computes |
|
forward kinematics for visualization. No collision, physics integration, or constraint |
|
solving is performed. |
|
|
|
Parameters |
|
---------- |
|
dt : float, optional |
|
Time duration for each simulation step in seconds. If none, it will inherit from `SimOptions`. Defaults to None. |
|
batch_links_info : bool, optional |
|
Whether to batch link info. Automatically enabled for heterogeneous simulation. Defaults to False. |
|
batch_dofs_info : bool, optional |
|
Whether to batch DOF info. Defaults to False. |
|
""" |
|
|
|
dt: PositiveFloat | None = None |
|
batch_links_info: StrictBool = False |
|
batch_joints_info: StrictBool = False |
|
batch_dofs_info: StrictBool = False |
Here we can immediately see what this is.
Steps to Reproduce
This is just the simple franka example demo +dofs getters and setters.
import torch
import genesis as gs
########################## init ##########################
gs.init(backend=gs.gpu)
########################## create a scene ##########################
scene = gs.Scene(
show_viewer=False,
viewer_options=gs.options.ViewerOptions(
camera_pos=(3.5, -1.0, 2.5),
camera_lookat=(0.0, 0.0, 0.5),
camera_fov=40,
),
rigid_options=gs.options.RigidOptions(
dt=0.01,
),
)
########################## entities ##########################
plane = scene.add_entity(
gs.morphs.Plane(),
)
franka = scene.add_entity(
gs.morphs.MJCF(file="xml/franka_emika_panda/panda.xml"),
)
########################## build ##########################
# create 20 parallel environments
B = 20
scene.build(n_envs=B, env_spacing=(1.0, 1.0))
# control all the robots
franka.control_dofs_position(
torch.tile(torch.tensor([0, 0, 0, -1.0, 0, 1.0, 0, 0.02, 0.02], device=gs.device), (B, 1)),
)
print(franka.get_dofs_act_gain().shape) # Prints Torch.size([9]) when it should be Torch.size([20, 9])
franka.set_dofs_stiffness(torch.ones([9]), envs_idx=(5,))
print(franka.get_dofs_stiffness()) # This prints tensor of 9 ones.
for i in range(1000):
scene.step()
Expected Behavior
If we set:
scene = gs.Scene(
show_viewer=False,
viewer_options=gs.options.ViewerOptions(
camera_pos=(3.5, -1.0, 2.5),
camera_lookat=(0.0, 0.0, 0.5),
camera_fov=40,
),
rigid_options=gs.options.RigidOptions(
dt=0.01,
batch_dofs_info=True
),
)
This makes everything work as intended but it was not clear.
Screenshots/Videos
No response
Relevant log output
Environment
Not relevant.
Release version or Commit ID
Latest but also not relevant.
Additional Context
No response
Bug Description
Hi team, this is not a bug but in my opinion some parameters/options need better documentation. Best example of this is the
batch_dofs_infooption. I had to look into the solver's code to see what this is doing and how its converting the shapes. The parameter is missing fromRigidOptionsdocs in general.For someone who is like me and doesn't "just get it", if you don't know about this parameter all the getter and setters for a
RigidEntitywill have wrong shape and from this someone can infer that the feature has not been implemented yet or get errors that scream about the shape (in setter functions).Parameters of
RigidEntityobjects in the scene such as:get_dofs_act_gainget_dofs_biasget_dofs_force_range....
All are affected and have shape (n_dofs) instead of the expected (n_envs, n_dofs).
Note: I understand why this parameter is set to false by default for performance reasons.
KinematicOptions on the other hand are defined as:
genesis-world/genesis/options/solvers.py
Lines 352 to 373 in 4cfb9f0
Here we can immediately see what this is.
Steps to Reproduce
This is just the simple franka example demo +dofs getters and setters.
Expected Behavior
If we set:
This makes everything work as intended but it was not clear.
Screenshots/Videos
No response
Relevant log output
Environment
Not relevant.
Release version or Commit ID
Latest but also not relevant.
Additional Context
No response