Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How to assign dof/joint indices? #37

Closed
shijiyuanaa opened this issue Mar 9, 2023 · 6 comments
Closed

[Question] How to assign dof/joint indices? #37

shijiyuanaa opened this issue Mar 9, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@shijiyuanaa
Copy link

I'm trying to use LeggedMobileManipulator to combine a quadruped and a robot arm. I use 'convert_urdf.py' to convert a URDF to USD. However, the joint indices were not as [base_dof_nums, arm_dof_nums, tool_dof_nums(which is 0 in my case)] after the robot init. (The dof indices were initialized in line 212 of articulation_view.py.) So there may be some problems when I call robot.get_default_dof_state() or robot.apply_action(), etc.

My question is how to make sure the joint order is like [base, arm, tool] when importing the USD file? Thanks a lot!

@Mayankm96
Copy link
Contributor

Mayankm96 commented Mar 20, 2023

Hi, thanks for pointing this out!

I tried the same for our ALMA (arm-on-ANYmal) robot last week and also faced the same issue. The parsing of joints in Isaac Sim is done in a breadth-first order instead of depth-first, which means the legs and arm joints are arranged differently to what the MobileManipulator class expects (base joints and arm joints in chunks).

We can't change the way PhysX parses the joints. This convention is defined by USDPhysics. However, a possible solution can be that the users specify through the configuration object, which joints belong to different parts of a heterogeneous robot. This way the inner workings of the joints handled by the physics engine will remain hidden from the user and they only "see" joints in the order they specify. If they don't specify an order then the default ordering is used.

The interface would then become:

  1. User sets and gets the joints at their pre-specified order
  2. The class converts them into simulation order

Would this be something that makes sense?

@Mayankm96 Mayankm96 added the bug Something isn't working label Mar 20, 2023
@shijiyuanaa
Copy link
Author

Hi, thanks for pointing this out!

I tried the same for our ALMA (arm-on-ANYmal) robot last week and also faced the same issue. The parsing of joints in Isaac Sim is done in a breadth-first order instead of depth-first, which means the legs and arm joints are arranged differently to what the MobileManipulator class expects (base joints and arm joints in chunks).

We can't change the way PhysX parses the joints. This convention is defined by USDPhysics. However, a possible solution can be that the users specify through the configuration object, which joints belong to different parts of a heterogeneous robot. This way the inner workings of the joints handled by the physics engine will remain hidden from the user and they only "see" joints in the order they specify. If they don't specify an order then the default ordering is used.

The interface would then become:

  1. User sets and gets the joints at their pre-specified order
  2. The class converts them into simulation order

Would this be something that makes sense?

Thank you for your reply!
I tried to change the parent link of the robot arm's first joint in my urdf and it works 😸 . But I hope there be more elegant way to change joint order. Thank you anyway!

@Mayankm96
Copy link
Contributor

Mayankm96 commented Mar 20, 2023

Interesting. Could you please elaborate more on what you mean by:

I tried to change the parent link of the robot arm's first joint in my urdf and it works

@shijiyuanaa
Copy link
Author

Interesting. Could you please elaborate more on what you mean by:

I tried to change the parent link of the robot arm's first joint in my urdf and it works

In the original urdf file, I simply attach the arm to the trunk link of the quadruped, and I found that the joint order is not what I want. Then I attach the arm to imu_link, which is a child link of trunk(so that the arm's fixed joint and the thigh joints are in the same hierarchy , I guess ), then I got the correct joint order.

@Mayankm96
Copy link
Contributor

Ah I see. That is quite a bit of a hack but good to know that is a possible solution (just not the ideal kind).

I'll keep this issue open for now. Will make a fix for this that will require users to explicitly specify the joints for their heterogeneous robot parts (base, arm, gripper) to make it easier to work with.

@Murkey8895
Copy link

Interesting. Could you please elaborate more on what you mean by:

I tried to change the parent link of the robot arm's first joint in my urdf and it works

In the original urdf file, I simply attach the arm to the trunk link of the quadruped, and I found that the joint order is not what I want. Then I attach the arm to imu_link, which is a child link of trunk(so that the arm's fixed joint and the thigh joints are in the same hierarchy , I guess ), then I got the correct joint order.

Hi, I'm also trying to combine a quadruped and a robot arm. Following your idea, I attach the arm's first fixed joint to imu_link, but still get a wrong order:
['joint1', 'joint2', 'joint3', 'joint4', 'FL_hip_joint', 'FR_hip_joint', 'RL_hip_joint', 'RR_hip_joint', 'joint5', 'FL_thigh_joint', 'FR_thigh_joint', 'RL_thigh_joint', 'RR_thigh_joint', 'joint6', 'FL_calf_joint', 'FR_calf_joint', 'RL_calf_joint', 'RR_calf_joint', 'jointGripper']
where the joint[1-6] are the arm's joints. Is it convenient for you to show your urdf file to help me solve this problem? Thank you in advance!

Mayankm96 added a commit that referenced this issue Aug 2, 2023
# Description

This MR merges all the refactorings done to make the legged locomotion
environment training work. It includes the following:
* `ActionManager` class: To handle various action terms and provide
flexibility for HRL.
* Actuator simplification: We no longer have actuator groups. All that
is handled externally to the robot.
* Sensor optimization: Lazy sensor updates (only updated when `data` is
called)
* Update to new RSL-RL library
* TerrainImporter: It does import on initialization instead of expecting
input from users.

This MR breaks the behavior of the following (many of which need to be
fixed):
* `RobotBase` : Now there are two methods `write_commands_to_sim` and
`refresh_sim_data` that dictate sim read/write.
* `ActuatorGroups`: Doesn't exist anymore.
* `SensorBase`: Drop for the support of different backends (was not
supported earlier but now more explicit)

Fixes #37 , #36 

## Type of change

- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- This change requires a documentation update

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file

---------

Co-authored-by: David Hoeller <[email protected]>
Co-authored-by: Nikita Rudin <[email protected]>
Co-authored-by: Farbod Farshidian <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants