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

Add hardware parameters #31

Conversation

CarlottaSartore
Copy link
Collaborator

No description provided.

@CarlottaSartore
Copy link
Collaborator Author

@Giulero @traversaro I am having a few issues in fixing the error with NumPy and the computation of the CoM, has can be seen in the CI

                # Adding the link transform
>               T_fk = T_fk @ T_link
E               ValueError: matmul: Input operand 1 does not have enough dimensions (has 0, gufunc core with signature (n?,k),(k,m?)->(n?,m?) requires 1)

So it seems like T_link is the wrong dimension, but actually its shape is (4,4).

Anyhow I saw that, when cast to np.array, its shape became (,), which could be the source of the error, but I do not know how to fix it, do you have any idea ?

Side note: I saw that the problem does not lay in the implementation of https://github.com/ami-iit/ADAM/blob/5d50695e0ed839552ec9143764e8a985a3510c13/src/adam/numpy/numpy_like.py#L50, the program does not enter in the function.

In addition, we have the same old problem that I would need the stickbot for running the test with hardware parameters online, @traversaro If I do not recall wrong there should be someway to load that urdf here in a smart way, Am I correct ?

Thanks :)

@CarlottaSartore CarlottaSartore marked this pull request as draft December 15, 2022 16:47
@traversaro
Copy link
Contributor

In addition, we have the same old problem that I would need the stickbot for running the test with hardware parameters online, @traversaro If I do not recall wrong there should be someway to load that urdf here in a smart way, Am I correct ?

Sorry, I do not recall what the "same old problem" is :)

@traversaro
Copy link
Contributor

Anyhow I saw that, when cast to np.array, its shape became (,), which could be the source of the error, but I do not know how to fix it, do you have any idea ?

See https://github.com/ami-iit/ADAM/pull/31/files#r1050528666 .

@CarlottaSartore
Copy link
Collaborator Author

In addition, we have the same old problem that I would need the stickbot for running the test with hardware parameters online, @traversaro If I do not recall wrong there should be someway to load that urdf here in a smart way, Am I correct ?

Sorry, I do not recall what the "same old problem" is :)

I would need to load here the stickbot model https://github.com/icub-tech-iit/ergocub-gazebo-simulations/tree/master/models/stickBot or any urdf with simple shapes but without including it in the repo, something similar to this
https://github.com/ami-iit/ADAM/blob/5d50695e0ed839552ec9143764e8a985a3510c13/tests/test_CasADi_computations.py#L16

@traversaro
Copy link
Contributor

If the model is available and does not have meshes (that are the tricky part when dealing with URDF files), we can easily either:

  1. Copy it in the repo
  2. Download it in a temporary directory and use it (see https://stackoverflow.com/questions/22676/how-to-download-a-file-over-http and https://stackoverflow.com/questions/3223604/how-to-create-a-temporary-directory-and-get-its-path-file-name)

If the file is not big, option 1. is not bad, as it make sure that the tests work fine even if there is no internet or for some reason the remote resource is not available (the server is offline, permanently down or the content itself has been removed).

@CarlottaSartore
Copy link
Collaborator Author

The PR is ready for review !
It introduces the following changes:

  • Hardware parametrization for the links defined in the input list link_parametric_list w.r.t. links length multiplier and densities;
  • The link can change along all the directions;
  • The growing direction of the kinematic chain as assumed to be the z direction of the base frame
  • This works only with basic shapes, namely cylinder, sphere, and box
  • Such shapes can be rotated in any direction

Few assumptions:

  • The growing direction is assumed to be along the z axis of the base frame when all joints are set to zero;
  • The visual of the urdf are used
  • The rpy of the visual are assumed to be equal to the rpy of the link origin
  • Independently from the link shape, always three length multiplier per link must be defined, but they will be used as follows:
Shape LengthMultiplier
Sphere $r_n = rl_{m,0}$
Cylinder $r_n = rl_{m,0}$, $h_n = hl_{m,1}$
Box $x_n = xl_{m,0}$, $y_n = yl_{m,1}$, $z_n = zl_{m,1}$

Note that the urdf_tree object can be used independently from the rest of the repo

C.C. @Giulero @traversaro @lrapetti

@CarlottaSartore CarlottaSartore marked this pull request as ready for review December 21, 2022 12:35
@CarlottaSartore CarlottaSartore changed the title WIP Add hardware parameters Add hardware parameters Dec 21, 2022
@CarlottaSartore
Copy link
Collaborator Author

rebased on top of #34

@Giulero Giulero changed the base branch from main to CarlottaSartore/hw-parametrization January 23, 2023 10:20
@CarlottaSartore
Copy link
Collaborator Author

Changed class names to follow the repo convention with ce6c270

@Giulero Giulero self-requested a review February 2, 2023 10:35
@CarlottaSartore CarlottaSartore merged commit 66babc1 into ami-iit:CarlottaSartore/hw-parametrization Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants