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

[WIP] add ROS Plugin #168

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

brucecui97
Copy link

@brucecui97 brucecui97 commented Jul 20, 2019

Motivation and Context

The ROS Plugin helps to accomplish the following:

  1. Connect Habitat simulator environment with ROS so that traditional ROS packages such as SLAM and navigation can be used in Habitat environment ​
  2. Test discrete action space trained agents in a kinematic physics enabled Habitat environment
  3. Test other agents (e.g. traditional mobile robots controlled through ROS) in the Habitat environment

Purpose of WIP Pull request

Would like to please receive feed back on current implementation of the ROS plugin. Some main limtations of the current implementation are the following:

  1. program requires python2 to run ROS
  2. program is multithreaded
  3. program might be using Habitat's API incorrectly

Links to Habitat-ROS Integration Video Demos

Navigating Habitat environment with ROS navigation package: https://youtu.be/VYfZ4wghpRA

Navigating Gazebo (ROS' simulator) environment with Habitat trained agent: https://youtu.be/EaU_a6MIeIE

Navigating Habitat environment with Habitat trained agent with ROS in the loop: https://youtu.be/eYywGkWd_0E

Link to Slides used to Explain High Level Implementation of ROS Plugin

https://1drv.ms/p/s!AhI7FLXI6kP7hfA3lsetrnm2y0Uq9g

How Has This Been Tested

Ran locally

Types of changes

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

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Jul 20, 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.

Hi @brucecui97, thank you for all work done towards ROS integration with Habitat.

  • Habitat simulator doesn't support multithreading and each instance should be initiated in separate process.
  • Maybe you don't need habitat.Env here and can use habitat_sim only as you're interested in simulation part, not task definition, baselines training, visualizations.
  • You use a lot of Habitat Sim internal members and methods. Maybe worth to create wrapper class to keep all that internal calls with one class. @erikwijmans maybe you can comment here on orientations and transformation calls.

def __init__(self, env_config_file):
threading.Thread.__init__(self)
self.env = habitat.Env(config=habitat.get_config(env_config_file))
self.env._sim._sim.agents[0].move_filter_fn = self.env._sim._sim._step_filter
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is not needed.

vz = -state.velocity[0]
vx = state.velocity[1]
dt = self._dt

Copy link
Contributor

Choose a reason for hiding this comment

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

scene_node = self.env._sim._sim.agents[0].scene_node

Then all the self.env._sim._sim.agents[0].scene_node bellow can be replaced with scene_node.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actions with state (like these) is something we should support. Then we'd just be able to add a new action for the agent to take (for both variants).

)
self.env._sim._sim.agents[0].scene_node.rotation = self.env._sim._sim.agents[
0
].scene_node.rotation.normalized()
Copy link
Contributor

Choose a reason for hiding this comment

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

from habitat_sim.agent.controls.default_controls import LookLeft
from habitat_sim.agent.controls import ActuationSpec

...

LookLeft()(self.env._sim._sim.agents[0].scene_node, ActuationSpec(yaw * dt))

self._pub_depth.publish(np.float32(self.observations["depth"].ravel()) * 10)

depth_np = np.float32(self.observations["depth"].ravel())
pointgoal_np = np.float32(self.observations["pointgoal"].ravel())
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pointgoal_np = np.float32(self.observations["pointgoal"].ravel())
pointgoal_np = np.float32(self.observations["pointgoal_with_compass_gps"].ravel())

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.

4 participants