Ask Your Question

How can I weight the distance metric for MoveIt?

asked 2019-04-22 18:51:27 -0500

philip.freeman gravatar image

updated 2019-04-23 06:16:26 -0500

I'm working with a 3-link robot model with a TRR kinematic arrangement. The translation axis is 1.2 m long with limts [0, 1.2]. The rotary axes are 0.4 m long each and have limits of [-pi, pi]. A distance metric of ||q||, while valid, will obviously move the translation axis quite a bit relative to the rotary axes. This is because a distance of 1 m is treated equivalent to a rotation of 1 radian. What I'd like is to assign weights to the distance metric so that I can define the "aspect ratio" of the C-space to be much more sane - but I can't find a method to do this.

I see in OMPL that for CompoundStateSpace a method exists (setSubSpaceWeight) that accomplishes this. I'm looking for similar functionality through some configuration of the MoveIt state space. Possible?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-04-22 20:05:59 -0500

You can modify the distance metric, but not without modifying MoveIt itself.

You should be able to call ModelBasedStateSpace::setDistanceFunction() with your preferred distance function. OMPL delegates it's distance calls there, so that will change the distance metric for the planner you're using. You'll probably want to call setDistanceFunction somewhere in the presolve function.

We're working on making this simpler by allowing you to write your own planning plugin for OMPL, I'll update this answer when that progresses.

edit flag offensive delete link more


Why would writing my own planning plugin for OMPL make this easier? I don't really want to change the planning algorithm, I just want to set the distance function (as you note). Wouldn't exposing an interface to MoveIt's setDistanceFunction be the preferred solution?

philip.freeman gravatar image philip.freeman  ( 2019-04-23 06:22:58 -0500 )edit

The plugin would make things easier because you'd be able to write a very light wrapper around the OMPL planner plugin without modifying the MoveIt source itself.

It might be possible to expose an interface to setDistanceFunction, but all of those OMPL planner classes are hidden behind the Planner Manager interface, which is relatively fixed. You also wouldn't be able to the specific OMPL state structure, which you'd need to do your "aspect ratio" approach.

Feel free to open an issue if this is something you want exposed though.

BryceWilley gravatar image BryceWilley  ( 2019-04-23 12:58:02 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-04-22 18:51:27 -0500

Seen: 211 times

Last updated: Apr 23 '19