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

Statically Sized Parameters #190

Open
jcarpinelli-bdai opened this issue Apr 1, 2024 · 3 comments
Open

Statically Sized Parameters #190

jcarpinelli-bdai opened this issue Apr 1, 2024 · 3 comments

Comments

@jcarpinelli-bdai
Copy link

Is it possible to configure std::array-valued parameters for fixed-size definitions? For example, for Cartesian stiffness gains, I'm currently using...

cartesian_impedance_parameters:
  stiffness: 
    x: {
        type: double,
    }, 
    y: {
        type: double,
    },
    ...

It may be nice to have a single parameter for stiffness gains, but still have stack-allocated values. For example...

cartesian_impedance_parameters:
  stiffness: {
    type: double_array_fixed_06,
  }

Do you agree this feature does not currently exist, but may be a nice feature to have?

@pac48
Copy link
Collaborator

pac48 commented Apr 7, 2024

@jcarpinelli-bdai we do support a feature that is similar to what you are asking for. You can check here in the example for how it is used. The referenced example creates a vector that is at most size 10 and is stack-allocated. If you want to require a specific size, you could probably use gt<> and lt<> validators.

To answer your question, we somewhat support that and it is useful. Also, you may have issues with the leading zero in front of the 6. I'm not positive if that is valid.

@jcarpinelli-bdai
Copy link
Author

Thank you, @pac48! To clarify, what value should the resulting parameter take? Is it an std::vector that is somehow stack allocated, with a maximum size? Or is it supposed to be an std::array?

@pac48
Copy link
Collaborator

pac48 commented Apr 12, 2024

@jcarpinelli-bdai The type is a rsl::StaticVector<double, 10>, which is a custom type in the Robot Support Library. Here is the definition https://github.com/PickNikRobotics/RSL/blob/e93c5456c2a328de6ae18f4b663a7dbc74c1a81d/include/rsl/static_vector.hpp#L18 . Under the hood, it does use a std::array.

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

No branches or pull requests

2 participants