Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Normalizing Each Objective Class's motionCost() #66

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

akash-venkateshwaran
Copy link

Description

  • Added two functions in the parent class: (i) Creates random sample states; (ii) Compares every pair in that sample and picks the maximum motionCost()
  • Inherited these functions in each Objective class to find the max_motionCost for each objective function
  • Modified the motionCost() function of each Objective class to normalise its cost using max_motionCost

Verification

  • Verified using a simple setup example problem
  • Haven't included unit tests

Resources

Copy link
Member

@patrick-5546 patrick-5546 left a comment

Choose a reason for hiding this comment

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

I added some tests in test_distance_objective that we should use for the other objectives:

  • sample_states(): commented out checking that all states are valid, which I think is what we want right?
  • find_maximum_motion_cost()
    • Implicitly test by comparing max_motion_cost to a hardcoded value
    • Tried to test find_maximum_motion_cost() directly but was not able to get the type of states correct so I commented it out for now
      • Update: fixed and uncommented

If you want to merge this PR today and aren't able to finish the tests, I'm ok with merging this PR and working on the tests in another PR. Just leave some # TODO: <message> comments

local_pathfinding/objectives.py Outdated Show resolved Hide resolved
@akash-venkateshwaran
Copy link
Author

I added some tests in test_distance_objective that we should use for the other objectives:

  • sample_states(): commented out checking that all states are valid, which I think is what we want right?

  • find_maximum_motion_cost()

    • Implicitly test by comparing max_motion_cost to a hardcoded value

    • Tried to test find_maximum_motion_cost() directly but was not able to get the type of states correct so I commented it out for now

      • Update: fixed and uncommented
        If you want to merge this PR today and aren't able to finish the tests, I'm ok with merging this PR and working on the tests in another PR. Just leave some # TODO: <message> comments

Thanks for adding the unit tests.
Yes we want to make sure all the sampled states are valid which means they are not in the collision area
Great! So now I have to repeat these tests for other objective functions right?

@patrick-5546
Copy link
Member

patrick-5546 commented Dec 9, 2023

Great! So now I have to repeat these tests for other objective functions right?

Yes and ensure that they are the sampled states are valid. The validity checker currently is just a placeholder but it will be good to set this up now anyways.

Copy link
Member

@patrick-5546 patrick-5546 left a comment

Choose a reason for hiding this comment

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

It seems like sometimes the normalized cost is greater than 1: https://github.com/UBCSailbot/local_pathfinding/actions/runs/7688802043/job/20950435771

test/test_objectives.py Outdated Show resolved Hide resolved
test/test_objectives.py Outdated Show resolved Hide resolved
@patrick-5546
Copy link
Member

As discussed, just need to resolve merge conflicts:

  • git merge origin main
  • Add speed objective
  • Normalize speed objective
  • Update weights

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom Weights for Different Optimization Objective
3 participants