Open SengHongLEE opened 1 year ago
Hi, I believe you are in the "instancable" asset USD. If you want to add contact sensor, you can go into the anymal_base.usd and do it there, although instancable asset will be the one you want to load. My suggestions are:
a) just put the contact sensor on the LF_SHANK prim, not actually on the mesh.
b) look into the example tasks of anymal.py
and anymal_terrain.py
. One of them is actually preparing the model for contacts programmatically, so you might not need to edit the USD at all.
Hope this helps.
Hi, I believe you are in the "instancable" asset USD. If you want to add contact sensor, you can go into the anymal_base.usd and do it there, although instancable asset will be the one you want to load. My suggestions are: a) just put the contact sensor on the LF_SHANK prim, not actually on the mesh. b) look into the example tasks of
anymal.py
andanymal_terrain.py
. One of them is actually preparing the model for contacts programmatically, so you might not need to edit the USD at all.Hope this helps.
where is the exact location of the model for contacts? I can't find it.
prepare_contacts()
at the bottom here:
Andrej
On Fri, Nov 17, 2023, 02:10 SENG HONG LEE @.***> wrote:
Hi, I believe you are in the "instancable" asset USD. If you want to add contact sensor, you can go into the anymal_base.usd and do it there, although instancable asset will be the one you want to load. My suggestions are: a) just put the contact sensor on the LF_SHANK prim, not actually on the mesh. b) look into the example tasks of anymal.py and anymal_terrain.py. One of them is actually preparing the model for contacts programmatically, so you might not need to edit the USD at all.
Hope this helps.
where is the exact location of the model for contacts? I can't find it.
— Reply to this email directly, view it on GitHub https://github.com/NVIDIA-Omniverse/OmniIsaacGymEnvs/issues/106#issuecomment-1815577029, or unsubscribe https://github.com/notifications/unsubscribe-auth/APPIYM5TTAGANPPWF63NXWLYE22OPAVCNFSM6AAAAAA7MOBSIGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJVGU3TOMBSHE . You are receiving this because you commented.Message ID: @.***>
Btw, how could I get the torque value of each joint of _anymals (an object of AnymalView)?
Get inspired from the task anymal_terrain
. They use the position control
mode, so they compute the torque based on the default joint positions, the
stiffness and damping of the joint drives etc. Also see the
articulation_view.py
in 'omni.isaac.corelibrary. There you will find functions such as
get_joint_forces()and
get_joint_efforts()` I believe.
On Wed, Nov 22, 2023, 21:05 SENG HONG LEE @.***> wrote:
Btw, how could I get the torque value of each joint of _anymals (an object of AnymalView)?
— Reply to this email directly, view it on GitHub https://github.com/NVIDIA-Omniverse/OmniIsaacGymEnvs/issues/106#issuecomment-1823159711, or unsubscribe https://github.com/notifications/unsubscribe-auth/APPIYM6RDLXVOVSV3QHCO33YFYWGVAVCNFSM6AAAAAA7MOBSIGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRTGE2TSNZRGE . You are receiving this because you commented.Message ID: @.***>
prepare_contacts()
at the bottom here: https://github.com/NVIDIA-Omniverse/OmniIsaacGymEnvs/blob/main/omniisaacgymenvs/robots/articulations/anymal.py Andrej … On Fri, Nov 17, 2023, 02:10 SENG HONG LEE @.> wrote: Hi, I believe you are in the "instancable" asset USD. If you want to add contact sensor, you can go into the anymal_base.usd and do it there, although instancable asset will be the one you want to load. My suggestions are: a) just put the contact sensor on the LF_SHANK prim, not actually on the mesh. b) look into the example tasks of anymal.py and anymal_terrain.py. One of them is actually preparing the model for contacts programmatically, so you might not need to edit the USD at all. Hope this helps. where is the exact location of the model for contacts? I can't find it. — Reply to this email directly, view it on GitHub <#106 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/APPIYM5TTAGANPPWF63NXWLYE22OPAVCNFSM6AAAAAA7MOBSIGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJVGU3TOMBSHE . You are receiving this because you commented.Message ID: @.>
Regarding this, I can't fully understand the content of this function, where may I get through this (i.e. does there have some detailed tutorials or documentations to get the feedback of the robot's foot contact situation with the ground) ?
Hi, its a bit more complicated. The answer to your questions is anymal_view.py
. You need to create a RigidPrimView() where the track_contact_forces = True and prepare_contact_sensors=True. You don't set it there directly, make sure the boolean variables track_contact_forces
and prepare_contact_sensors
are set to True by putting anymal.prepare_contacts(self._stage, anymal.prim)
in get_anymal()
function in omniisaacgymenvs/tasks/anymal.py
and track_contact_forces=True
in the set_up_scene()
in tasks/anymal.py
, as written in the second snippet below.
This is a snippet from omniisaacgymenvs/robots/articulations/views/anymal_view.py
:
self._knees = RigidPrimView(
prim_paths_expr="/World/envs/.*/anymal/.*_THIGH",
name="knees_view",
reset_xform_properties=False,
track_contact_forces=track_contact_forces,
prepare_contact_sensors=prepare_contact_sensors,
)
self._base = RigidPrimView(
prim_paths_expr="/World/envs/.*/anymal/base",
name="base_view",
reset_xform_properties=False,
track_contact_forces=track_contact_forces,
prepare_contact_sensors=prepare_contact_sensors,
)
You need to add a RigidPrimView() to the prim (primitive) you want to attach the force sensor to add the view to the scene as is done in tasks/anymal.py
in setup_scene()
as:
def set_up_scene(self, scene) -> None:
self.get_anymal()
super().set_up_scene(scene)
self._anymals = AnymalView(prim_paths_expr="/World/envs/.*/anymal", name="anymalview", track_contact_forces=True)
scene.add(self._anymals) # <<< like these
scene.add(self._anymals._knees) # <<< like these
scene.add(self._anymals._base)
return
Then you can access the forces of the given rigid prim view as is written for example in tasks/anymal_terrain.py
in function check_termination()
:
...
knee_contact = (
torch.norm(self._anymals._knees.get_net_contact_forces(clone=False).view(self._num_envs, 4, 3), dim=-1)
> 1.0
)
...
The documentation is not good enough, tutorials are covering only very basic usage and I just sort of searched all the repos until I found what I was looking for... So checking the omni.isaac.core
folder where you have the omni libraries installed will help you with some function definitions on rigid_prim_view
and rigic_contact_view
etc.
Hope this helps.
I would like to add a foot contact sensor on the foot (mesh_1) respectively, unfortunately it can't be done due to the exist of the 'visuals', how can I deal with it alternatively? Thanks in advanced.