Skip to content

find a safe way to set states/pos/velocity #12

@sbarthelemy

Description

@sbarthelemy

currently, a user can mess everything when setting a world state.

For instance joint.gvel[0] = 2. is ok, but joint.gvel = 2. is not, as it breaks the link between joint.gvel and world.gvel. The same problem occurs with joint.gpos.

maybe joint.gvel should be removed completely, as it is redundant with world.gvel. Currently, joint.gvel is used...

  • in joint.integrate(), but it could be passed as an argument to integrate.
  • to set the joint initial conditions. This could be done with world.gvel[joint.dof] = ...
  • in joint.twist, which is itself called in Body.update_dynamic(). It's less easy to remove it from there.

Note also that we do not povide a joint.gforce interface, which could be useful and seem logical as long as there is joint.gvel.

The JointsList class is an attemps to provide a nicer interface. It currently provides

  • joints.dof (a 1d array or a slice)
  • joints.gvel (a 1d array wich is a copy of the selected joints gvels)
  • joints.gpos (a 1d array wich is a copy of the selected joints gpos if they are 1d)

maybe the gvel and gpos should be dropped, or moved in another class (such as a per-robot one: human36, ...)).

For reference, KDL has a different approach: they have a single joint class that handles all the (1dof) joints, and which does not store the joint state at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions