uwgraphics / relaxed_ik

RelaxedIK Solver
MIT License
175 stars 50 forks source link

Adjusting static weights for each objective #3

Open akgoins opened 5 years ago

akgoins commented 5 years ago

For a manipulator/task that I am working on, I am trying to decrease the position/orientation error along a target trajectory and relax some of the other constraints (i.e. joint limits, collisions). The paper mentions that there are static weights which the user can change to set the priority of the objectives for different tasks. Where can the weights be set/changed? I found weight_funcs and weight_priors being initialized here but changing the values or creating a custom weight function seems to result in erratic behavior. I also noticed that in all of the objective functions, g is set to 2 (see here), where as the paper shows in Equation 3 that the power should be 4. I tried changing the value in the hopes that it might be related, but it did not seem to help.

How are the static weights set? Is higher better or lower? What scale are the weights on? The default weights for position/orientation are 50 and 40 respectively, yet the other weights are around 1.

djrakita commented 5 years ago

Hi, thanks for the question! The best way to change the relative importance between different objectives is just to change the weight_priors values here . These static weights were set empirically, though many values worked fine and as expected during testing. The weights are unitless and are not on a particular scale; the loss function used was just designed to consider all of the term outputs on a standard scale relative to each other. The main interpretation is just that, when things are going well in the optimization, i.e., most of the term outputs are close to the central “groove” part of the loss function, a term with a weight of 2 is twice as important as a term with a weight of 1.

I would start with adjusting the weight priors on the terms and seeing if any combination matches your desired behavior given the task. If that does not work, feel free to let me know more details about the motion behavior or task you're trying to achieve, and I can maybe provide more recommendations for other parameter adjustments that may get what you’re looking for.

zichunxx commented 1 year ago

Hi! @djrakita

As @akgoins mentioned, why does parameter g have a different value in the paper and in the code?