Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4210b2d
Adding the MOTION mouse mode
JuanTheEngineer Nov 1, 2021
4315fe7
First Attempt to 'Select" character, still broken
JuanTheEngineer Nov 1, 2021
d980785
Add create and remove functions for selector icon
JuanTheEngineer Nov 1, 2021
4fc4d67
Writing the MOTION selection logic
JuanTheEngineer Nov 1, 2021
730d03d
Add rotate and translate feature in motion mode
JuanTheEngineer Nov 1, 2021
45309cf
Update magnum bindings
JuanTheEngineer Nov 1, 2021
a80ac45
Refactor and Bug fixes
JuanTheEngineer Nov 1, 2021
d58c4ad
Initial commit to build navmesh generating
JuanTheEngineer Nov 1, 2021
dc3be6a
Resolving Review Changes
JuanTheEngineer Nov 2, 2021
07330b0
Add command-line args to accept filename, model data, and motion data
JuanTheEngineer Nov 2, 2021
69a5364
First draft of Save/Fetch methods and saving logic
JuanTheEngineer Nov 2, 2021
b15584c
Add Save file Key Press 'P' with several functionalities
JuanTheEngineer Nov 3, 2021
8adc7fa
Add Load/Fetch data from file Key Press 'L'
JuanTheEngineer Nov 3, 2021
677f9f0
Debugging reconfigure
JuanTheEngineer Nov 3, 2021
a6f70ad
Remove name key from data, and save and fetch including position data
JuanTheEngineer Nov 4, 2021
607c10a
Final Draft of Save\Load Functions
JuanTheEngineer Nov 4, 2021
77bc7af
Fixing bug in python-viewer with draw event callable argument (#1558)
JuanTheEngineer Nov 3, 2021
8a2c654
[BugFix]--bypass test_sensor tests if no torch is found. (#1559)
jturner65 Nov 3, 2021
c772968
Fairmotion Character Positioning via MOTION MouseMode (#1552)
JuanTheEngineer Nov 3, 2021
b2b3039
Build OSX Conda Nightly (#1430)
Skylion007 Nov 4, 2021
9ea6fc4
Navmesh Recompute and Toggle
JuanTheEngineer Nov 4, 2021
503d594
Making recompute NavMesh occur on application start
JuanTheEngineer Nov 4, 2021
619ba10
Remove unwanted printing self.dump
JuanTheEngineer Nov 4, 2021
fef8343
Load from last keypress
JuanTheEngineer Nov 4, 2021
ec909ea
Merge branch 'main' into fairmotion-save-load
JuanTheEngineer Nov 4, 2021
bb190d9
Print error message on exception FileNotFound
JuanTheEngineer Nov 4, 2021
a16b120
Merge branch 'main' into python-viewer
JuanTheEngineer Nov 5, 2021
eb9713b
Make recompute a separate function for inheritance
JuanTheEngineer Nov 5, 2021
cc79091
Remove necessary try except in fetch_metadata()
JuanTheEngineer Nov 5, 2021
98978c8
Refactoring via Change Requests
JuanTheEngineer Nov 8, 2021
89de4a8
Merge branch 'fairmotion-save-load' into python-viewer
JuanTheEngineer Nov 8, 2021
b6687d0
Revision via Change Requests
JuanTheEngineer Nov 8, 2021
bc24dee
Merge branch 'main' into python-viewer
JuanTheEngineer Nov 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/motion_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ def print_help_text(self) -> None:
SPACE: Toggle physics simulation on/off.
'.': Take a single simulation step if not simulating continuously.
'v': (physics) Invert gravity.
'n': Show/hide NavMesh wireframe.
(+SHIFT) Recompute NavMesh with default settings.

Fairmotion Interface:
'f': Load model with current motion data.
Expand Down
34 changes: 34 additions & 0 deletions examples/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def __init__(self, sim_settings: Dict[str, Any]) -> None:
self.sim_settings["width"] = self.viewport_size[0]
self.sim_settings["height"] = self.viewport_size[1]

# navmesh
self.navmesh_success = False

# set up our movement map
key = Application.KeyEvent.Key
self.pressed = {
Expand Down Expand Up @@ -80,6 +83,9 @@ def __init__(self, sim_settings: Dict[str, Any]) -> None:
self.sim: habitat_sim.simulator.Simulator = None
self.reconfigure_sim()

# compute NavMesh
self.navmesh_config_and_recompute()
Comment thread
JuanTheEngineer marked this conversation as resolved.
Outdated

self.time_since_last_simulation = 0.0
LoggingContext.reinitialize_from_env()
logger.setLevel("INFO")
Expand Down Expand Up @@ -193,6 +199,7 @@ def reconfigure_sim(self) -> None:
self.active_scene_graph = self.sim.get_active_scene_graph()
self.default_agent = self.sim.get_agent(self.agent_id)
self.agent_body_node = self.default_agent.scene_node
self.agent_body_node.translation = [2.65, 0.5, 4.5]
Comment thread
JuanTheEngineer marked this conversation as resolved.
Outdated
self.render_camera = self.agent_body_node.node_sensor_suite.get("color_sensor")

Timer.start()
Expand Down Expand Up @@ -239,6 +246,7 @@ def key_press_event(self, event: Application.KeyEvent) -> None:
"""
key = event.key
pressed = Application.KeyEvent.Key
mod = Application.InputEvent.Modifier

if key == pressed.ESC:
event.accepted = True
Expand Down Expand Up @@ -274,6 +282,17 @@ def key_press_event(self, event: Application.KeyEvent) -> None:
self.invert_gravity()
logger.info("Command: gravity inverted")

elif key == pressed.N:
if event.modifiers == mod.SHIFT:
logger.info("Command: recompute navmesh")
self.navmesh_config_and_recompute()
else:
if self.navmesh_success:
self.sim.navmesh_visualization = not self.sim.navmesh_visualization
logger.info("Command: toggle navmesh")
else:
logger.warn("Warning: recompute navmesh first")

# update map of moving/looking keys which are currently pressed
if key in self.pressed:
self.pressed[key] = True
Expand Down Expand Up @@ -504,6 +523,19 @@ def cycle_mouse_mode(self) -> None:
elif self.mouse_interaction == MouseMode.GRAB:
self.mouse_interaction = MouseMode.LOOK

def navmesh_config_and_recompute(self) -> habitat_sim.NavMeshSettings:
"""
This method is setup to be overridden in for setting config accessibility
in inherited classes.
"""
self.navmesh_settings = habitat_sim.NavMeshSettings()
self.navmesh_settings.set_defaults()
self.navmesh_success = self.sim.recompute_navmesh(
self.sim.pathfinder,
self.navmesh_settings,
include_static_objects=False,
)

def exit_event(self, event: Application.ExitEvent):
"""
Overrides exit_event to properly close the Simulator before exiting the
Expand Down Expand Up @@ -551,6 +583,8 @@ def print_help_text(self) -> None:

Utilities:
'r': Reset the simulator with the most recently loaded scene.
'n': Show/hide NavMesh wireframe.
(+SHIFT) Recompute NavMesh with default settings.

Object Interactions:
SPACE: Toggle physics simulation on/off.
Expand Down