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

Can the agent move along the Y-axis? #2440

Open
hjy5311 opened this issue Aug 6, 2024 · 4 comments
Open

Can the agent move along the Y-axis? #2440

hjy5311 opened this issue Aug 6, 2024 · 4 comments
Labels
FAQ Frequently asked questions. support User support requested (e.g. specific issue or API usage question)

Comments

@hjy5311
Copy link

hjy5311 commented Aug 6, 2024

To make the agent function like a drone, I need it to move along the Y-axis (UP-DOWN direction). I attempted to achieve this using the MoveUp control function registered in default_controls.py, originally designed to raise a sensor with body_action set to False. Now, I've set body_action=True to move the entire agent (including the sensor) along the Y-axis, but the execution doesn't meet expectations—the agent's position remains unchanged. I'm wondering if there are specific mechanisms restricting the agent's movement along the Y-axis and if there are methods to enable movement in this direction.

@registry.register_move_fn(body_action=False)
class MoveUp(SceneNodeControl):
    def __call__(self, scene_node: SceneNode, actuation_spec: ActuationSpec) -> None:
        _move_along(scene_node, actuation_spec.amount, _Y_AXIS)

I simply changed body_action to True, but it didn't work.

Thank you for your answer!

@aclegg3
Copy link
Contributor

aclegg3 commented Aug 6, 2024

Hey @hjy5311
When using the default movement actions provided with the pointnav task, the Agent's SceneNode (3D transform) is locked to the navmesh. There is a "step_filter" which snaps the Agent to the navmesh after any translation.

You could write custom logic and use a custom action set which does not use the step filter, but you will need to handle the collision detection yourself since the navmesh abstraction doesn't really extend well to flying robots (as they are not restricted to navigable floor regions).

My suggestion is to implement your action set using the collision detection functionality, providing a 3D mesh to represent the robot's body and checking that this body is not intersecting with the environment after each requested discrete motion.

Check out this tutorial (https://github.com/facebookresearch/habitat-sim/blob/main/examples/tutorials/notebooks/ECCV_2020_Interactivity.ipynb) for an example of loading a body, collision detection, velocity control and other useful mechanisms.

@aclegg3 aclegg3 added FAQ Frequently asked questions. support User support requested (e.g. specific issue or API usage question) labels Aug 6, 2024
@aclegg3
Copy link
Contributor

aclegg3 commented Aug 6, 2024

Also, I did write a quick and dirty example of a quad-rotor several years ago. Likely the API has shifted significantly, but maybe the reference is still useful: c4a4c53

@hjy5311
Copy link
Author

hjy5311 commented Aug 11, 2024

Thank you very much for your answer. It has been very helpful. I am now considering using an agent to detect if it intersects with the environment. I would like to know if Habitat-sim provides a direct interface at the simulator level for obtaining the bounding boxes or other attributes that reflect the volume size of objects and the scene. This will impact the difficulty of adding collision detection.

By reading the code, I found that there are interfaces available for obtaining the volume information of objects. However, for the scene, I have not yet discovered code that provides access to the volume attributes related to walls, scene boundaries, etc.

Thank you for your answer.

@aclegg3
Copy link
Contributor

aclegg3 commented Aug 12, 2024

Hey @hjy5311

You should check out the rigid object tutorial from our tutorial series. It covers topics related to use of physics and collision detection.

To quickly answer your question: yes, Habitat provides bounding box and collision detection routines which you can use to determine if your agent object is in collision with the scene or other objects.

AABB: https://aihabitat.org/docs/habitat-sim/habitat_sim.physics.ManagedRigidObject.html#aabb
Object centric binary contact test: https://aihabitat.org/docs/habitat-sim/habitat_sim.physics.ManagedRigidObject.html#contact_test
Full scene collision detection: https://aihabitat.org/docs/habitat-sim/habitat_sim.simulator.Simulator.html#perform_discrete_collision_detection
Contact point data available after collision detection: https://aihabitat.org/docs/habitat-sim/habitat_sim.simulator.Simulator.html#get_physics_contact_points

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FAQ Frequently asked questions. support User support requested (e.g. specific issue or API usage question)
Projects
None yet
Development

No branches or pull requests

2 participants