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

Add the noise model from PyRobot #89

Merged
merged 21 commits into from
Jul 22, 2019
Merged

Add the noise model from PyRobot #89

merged 21 commits into from
Jul 22, 2019

Conversation

erikwijmans
Copy link
Contributor

@erikwijmans erikwijmans commented Jun 27, 2019

Motivation and Context

Our friends at https://github.com/facebookresearch/pyrobot have "benchmarked" the noise of two real robots, LoCoBot and LoCoBot-Lite. So now we can add that noise model to habitat!

How Has This Been Tested

Via unit tests and with a little cv2 based viewer so I can step around :)

Types of changes

  • New feature (non-breaking change which adds functionality)

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Jun 27, 2019
@dhruvbatra
Copy link
Contributor

dhruvbatra commented Jun 27, 2019

Copy link
Contributor

@mathfac mathfac left a comment

Choose a reason for hiding this comment

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

That's amazing how implementation of Python specified actions for the agents makes easier to add functionality as noise models. Code looks clean to me, in your tests do you want to check that the actual actions have noise specified with performing same action.

return getattr(self, key)


noise_models = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add link to PyRobot paper to reference source of noise parameters.

@dhruvbatra
Copy link
Contributor

Can we add a gif to demonstrate the noisy actuation?

@erikwijmans
Copy link
Contributor Author

erikwijmans commented Jun 29, 2019

example

@dhruvbatra

@erikwijmans
Copy link
Contributor Author

@dhruvbatra @mathfac @s-gupta @kalyanvasudev Thoughts on the current way we are pointing people to PyRobot so they can include the proper citation if they use the noise model?

* PyRobot Noise Model -- [PyRobot](https://github.com/facebookresearch/pyrobot#citation)

Contributes the noise model used for the noisy control functions named `pyrobot_*` and defined in `habitat_sim/agent/pyrobot_noisy_controls.py`

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we restructure this bit?

"If you use the PyRobot noise models, please cite:
blah

Noisy control function named pyrobot_* defined in blah.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@kalyanvasudev
Copy link

Hi Everyone, this all looks great! I have a quick suggestion, would it be possible to incorporate a noise model for state-estimation as well? Because there is some error in it as well on the real robot.

@erikwijmans
Copy link
Contributor Author

Hi Everyone, this all looks great! I have a quick suggestion, would it be possible to incorporate a noise model for state-estimation as well? Because there is some error in it as well on the real robot.

I'm not entirely certain what you are referring to, but I assume this is the robot estimating it's pose relative to some initial pose? We currently have a noise-free GPS/Compass sensor, and we'd add noise to that? Can you point me to the noise models/parameters I should use for that?

@mathfac
Copy link
Contributor

mathfac commented Jul 1, 2019

@erikwijmans, thank you for the gif of noisy navigation, looks great. Maybe, worth to add top down map with sampling same action from the same position and show distribution of final positions with opacity.

@dhruvbatra
Copy link
Contributor

Maybe, worth to add top down map with sampling same action from the same position and show distribution of final positions with opacity.

Yes! Like Fig 4 here:
http://saurabhg.web.illinois.edu/pdfs/kumar2018visual.pdf

@erikwijmans
Copy link
Contributor Author

noisy_paths

@mathfac @dhruvbatra

@dhruvbatra
Copy link
Contributor

dhruvbatra commented Jul 1, 2019

Woah, so pretty!

How many trajectories is this showing? 100? 500?

@erikwijmans
Copy link
Contributor Author

100

Copy link
Collaborator

@msavva msavva left a comment

Choose a reason for hiding this comment

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

This is awesome! The flexibility of the actuation specification API is clearly demonstrated here!

Did a quick pass and all LGTM! 👍

@erikwijmans
Copy link
Contributor Author

Merged this with master. I also put the control definitions in their own folder, habitat_sim/agent/controls as the agent folder was starting to feel too big. I also fixed one issue with the imports and now habitat_sim.register_move_fn works.

np.sign(rotate_amount + 1e-8) * model.rotation.mean, model.rotation.cov
)

scene_node.rotate_local(mn.Deg(rotate_amount) + mn.Rad(rot_noise[0]), hsim.geo.UP)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mosra -- Strongly typed angles are great! I can now add degrees and radians without fear :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hah, didn't even know this was possible (it isn't in C++, there it can't decide on what the result type should be). Nice to see it "just works" in Python.

@@ -15,7 +15,7 @@
import habitat_sim.bindings as hsim
from habitat_sim import utils

__all__ = ["ActuationSpec", "SceneNodeControl", "ObjectControls"]
__all__ = ["ActuationSpec", "SceneNodeControl", "ObjectControls", "register_move_fn"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally we should move the definition of __all__ to __init__.py


from .controls import ActuationSpec, SceneNodeControl, register_move_fn

__all__ = ["PyRobotNoisyActuationSpec"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above.

import habitat_sim.bindings as hsim
from habitat_sim import utils

from .controls import ActuationSpec, SceneNodeControl, register_move_fn
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: if possible we should move to absolute imports instead of relative imports.



@attr.s(auto_attribs=True)
class MotionNoiseModel:
Copy link
Contributor

Choose a reason for hiding this comment

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

A base NoiseModel class could be useful here.

"LoCoBot": RobotNoiseModel(
ILQR=ControllerNoiseModel(
linear_motion=MotionNoiseModel(
_MultivariateGaussian([0.014, 0.009], [0.006, 0.005]),
Copy link
Contributor

Choose a reason for hiding this comment

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

Abstracting out the constants into a different class would make this code more readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe stick this in a different file? Any class that has all these constants will be as unreadable as this class by definition (all these classes are doing is holding these constants).

noise_multiplier: float = 1.0


_x_axis = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Make these constants X_AXIS etc.

@erikwijmans erikwijmans requested a review from abhiskk July 17, 2019 00:12
@erikwijmans erikwijmans merged commit 15994e4 into master Jul 22, 2019
@erikwijmans erikwijmans deleted the pyrobot-noisy-actions branch July 22, 2019 20:59
@mathfac mathfac added this to the Realistic noise models milestone Sep 5, 2019
eundersander pushed a commit to eundersander/habitat-sim that referenced this pull request Aug 6, 2020
facebookresearch#89)

* Modify partitioning logic to handle left-over scenes due to integer division
Ram81 pushed a commit to Ram81/habitat-web-sim that referenced this pull request Dec 10, 2020
* Adds noisy actuations based on the noise model from PyRobot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants