Downloads · 30 days
34
7% of all-time downloads
zhijieq/directional-navigation
directional-navigation is a robotics model from zhijieq. Use it for the robotics task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as mit.
Directional Navigation is a MuJoCo task for moving a robot to a goal while avoiding walls and other moving robots. This repository provides both the Gymnasium environment and a policy trained for the task.
Downloads · 30 days
34
7% of all-time downloads
All-time downloads
459
Public
Parameters
395K
11.1 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.6 MB · 96%
From the Hugging Face model README
Directional Navigation is a MuJoCo task for moving a robot to a goal while avoiding walls and other moving robots. This repository provides both the Gymnasium environment and a policy trained for the task.
The package supports Python 3.10 and newer.
python -m pip install "https://huggingface.co/zhijieq/directional-navigation/resolve/main/directional_navigation-1.0-py3-none-any.whl"
import gymnasium as gym
from transformers import AutoModel
env = gym.make(
"directional_navigation:DirectionalNavigation-v0",
render_mode="human",
real_time_factor=1.0,
num_robots=None,
seed=None,
)
policy = AutoModel.from_pretrained(
"zhijieq/directional-navigation",
trust_remote_code=True,
)
try:
observation, _ = env.reset()
while True:
action = policy.act(observation)
observation, _, terminated, _, info = env.step(action)
if info["reason"] == "goal_reached":
print("goal_reached", flush=True)
elif terminated:
print(info["reason"], flush=True)
observation, _ = env.reset()
except KeyboardInterrupt:
pass
finally:
env.close()
Each scene takes place in a square arena with a randomly placed goal and up to 40 moving robots.
Pass num_robots to gym.make to use a fixed number of moving robots from 0
to 40. If it is omitted or set to None, the environment chooses a new random
number from 0 to 40 for each scene.
Pass seed to gym.make to reproduce a simulation. With seed=None, the
environment starts with a nondeterministic random sequence.
observation.lidar: 256 distance readings covering 360 degrees around the
robot, with a maximum range of 10 m.observation.state: a 2D unit vector pointing from the robot to the goal.reset() to start a new one.Enter in the MuJoCo viewer to start a new scene.The environment also works with gym.make_vec for parallel rollouts.
The policy combines the 256 LiDAR readings with the direction to the goal. The goal direction is projected to 256 features, joined with the LiDAR input, and passed through layers of 512 and 256 units with GELU activations. A final two-unit layer produces the movement direction.