Skip to content

Handle compound state space for AORRTC#1345

Open
Jaeyoung-Lim wants to merge 1 commit intoompl:mainfrom
Jaeyoung-Lim:pr-aorrtc
Open

Handle compound state space for AORRTC#1345
Jaeyoung-Lim wants to merge 1 commit intoompl:mainfrom
Jaeyoung-Lim:pr-aorrtc

Conversation

@Jaeyoung-Lim
Copy link
Copy Markdown
Contributor

@Jaeyoung-Lim Jaeyoung-Lim commented Dec 17, 2025

Problem Description
When using compound statespace(e.g. Dubins) with AORRTC #1282 the euclideanDistanceFunction was using the distance metric of the state space rather than the euclidean distance function. (Probably assuming all spaces are metric and euclidean?)

This PR checks whether the statespace is a compound statespace, and tries to extract the realvector statespace to compute the euclideandistance.

FYI @twill777

@twill777
Copy link
Copy Markdown

twill777 commented Dec 17, 2025

Hi Jaeyoung,

The AOX distance function should be using the same spatial distance function as euclidean, with the added cost distance. Please update the aoxDistanceFunction so that spaceDiff is calculated using your changed euclideanDistanceFunction (as opposed to si_->distance(...))

if (stateSpace->isCompound())
{
auto *compoundSpace = stateSpace->as<base::CompoundStateSpace>();
// Get the first subspace which should be the position component (RealVectorStateSpace)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not guaranteed. Rephrase as:

Suggested change
// Get the first subspace which should be the position component (RealVectorStateSpace)
// Get the first subspace which should be the position component (RealVectorStateSpace) for state spaces like SE(2) and SE(3).

auto *subspace = compoundSpace->getSubspace(0).get();
if (subspace->getType() == base::STATE_SPACE_REAL_VECTOR)
{
auto *rvSpace = subspace->as<base::RealVectorStateSpace>();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to reimplement RealVectorStateSpace::distance. I think you can just call rvspace->distance(aCompound->as<base::RealVectorStateSpace::StateType>(0), bCompound->as<base::RealVectorStateSpace::StateType>(0))

@mamoll
Copy link
Copy Markdown
Member

mamoll commented Mar 9, 2026

It seems like this change should probably also print out a warning (once) when AORRTC is used with compound state spaces, since it's unclear (to me) what kind of optimality is guaranteed. If orientation distance doesn't matter, what would happen if SE(3)/SE(2) is set up with a weight of 0 for the orientation component (so that the distance is Euclidean distance).

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.

3 participants