Skip to content

[Proposal] Add an option to "set_external_force_and_torque" to choose where the forces should be applied. #1678

@AntoineRichard

Description

@AntoineRichard

Proposal

Changing the "set_external_force_and_torque" method to allow applying wrenches at a position that's not the center of the articulation.

This could look like so:

    def set_external_force_and_torque(
        self,
        forces: torch.Tensor,
        torques: torch.Tensor,
        positions: torch.Tensor | None = None,
        body_ids: Sequence[int] | slice | None = None,
        env_ids: Sequence[int] | None = None,
    ):

When no positions are provided, the implementation uses the current behavior. However, if positions are provided, then it passes them to the PhysX tensor API:

self.root_physx_view.apply_forces_and_torques_at_position(
    force_data=self._external_force_b.view(-1, 3),
    torque_data=self._external_torque_b.view(-1, 3),
    position_data=self._external_wrench_positions_b.view(-1, 3),
    indices=self._ALL_INDICES,
    is_global=False,
)

Motivation

It would be great to be able to apply forces away from the center of the object. This is useful for thruster/propeller based systems such as drones, planes, boats, and satellites. In these systems, the position where the forces are applied can vary depending on the level of realism on wants to have. Also, this can be used to easily implement morphable geometries for drones, satellites, and boats, as there is no need to have different physical configurations: just to apply forces at different positions.

Alternatives

The current alternative is to create rigid bodies where you want to apply the force, but if you want to change their positions, you need to attach it to a set of joints.

Checklist

  • [x ] I have checked that there is no similar issue in the repo (required)

Acceptance Criteria

Add the criteria for which this task is considered done. If not known at issue creation time, you can add this once the issue is assigned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions