-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpush_env.py
77 lines (64 loc) · 3.72 KB
/
push_env.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import safety_gym
from safety_gym.envs.engine import Engine
from safety_gym.random_agent import run_random
import numpy as np
import gym
from gym.envs.registration import register
# Obs_space: Dict(accelerometer:Box(-inf, inf, (3,), float32), velocimeter:Box(-inf, inf, (3,), float32), gyro:Box(-inf, inf, (3,), float32), magnetometer:Box(-inf, inf, (3,), float32), box_lidar:Box(0.0, 1.0, (16,), float32), goal_lidar:Box(0.0, 1.0, (16,), float32))
config_point = {
'robot_base': 'xmls/point.xml',
'task': 'push',
'observation_flatten': False,
'observe_goal_lidar': True,
'observe_box_lidar': True,
'continue_goal': False,
'lidar_max_dist': 3,
'lidar_num_bins': 16
}
# Obs_space: Dict(accelerometer:Box(-inf, inf, (3,), float32), velocimeter:Box(-inf, inf, (3,), float32), gyro:Box(-inf, inf, (3,), float32), magnetometer:Box(-inf, inf, (3,), float32), ballangvel_rear:Box(-inf, inf, (3,), float32), ballquat_rear:Box(-inf, inf, (3, 3), float32), box_lidar:Box(0.0, 1.0, (16,), float32), goal_lidar:Box(0.0, 1.0, (16,), float32))
config_car = {
'robot_base': 'xmls/car.xml',
'task': 'push',
'observation_flatten': False,
'observe_goal_lidar': True,
'observe_box_lidar': True,
'continue_goal': False,
'lidar_max_dist': 3,
'lidar_num_bins': 16
}
# Obs_space: Dict(accelerometer:Box(-inf, inf, (3,), float32), velocimeter:Box(-inf, inf, (3,), float32), gyro:Box(-inf, inf, (3,), float32), magnetometer:Box(-inf, inf, (3,), float32), jointvel_hip_1_z:Box(-inf, inf, (1,), float32), jointvel_hip_2_z:Box(-inf, inf, (1,), float32), jointvel_hip_3_z:Box(-inf, inf, (1,), float32), jointvel_hip_4_z:Box(-inf, inf, (1,), float32), jointvel_hip_1_y:Box(-inf, inf, (1,), float32), jointvel_hip_2_y:Box(-inf, inf, (1,), float32), jointvel_hip_3_y:Box(-inf, inf, (1,), float32), jointvel_hip_4_y:Box(-inf, inf, (1,), float32), jointvel_ankle_1:Box(-inf, inf, (1,), float32), jointvel_ankle_2:Box(-inf, inf, (1,), float32), jointvel_ankle_3:Box(-inf, inf, (1,), float32), jointvel_ankle_4:Box(-inf, inf, (1,), float32), jointpos_hip_1_z:Box(-inf, inf, (2,), float32), jointpos_hip_2_z:Box(-inf, inf, (2,), float32), jointpos_hip_3_z:Box(-inf, inf, (2,), float32), jointpos_hip_4_z:Box(-inf, inf, (2,), float32), jointpos_hip_1_y:Box(-inf, inf, (2,), float32), jointpos_hip_2_y:Box(-inf, inf, (2,), float32), jointpos_hip_3_y:Box(-inf, inf, (2,), float32), jointpos_hip_4_y:Box(-inf, inf, (2,), float32), jointpos_ankle_1:Box(-inf, inf, (2,), float32), jointpos_ankle_2:Box(-inf, inf, (2,), float32), jointpos_ankle_3:Box(-inf, inf, (2,), float32), jointpos_ankle_4:Box(-inf, inf, (2,), float32), box_lidar:Box(0.0, 1.0, (16,), float32), goal_lidar:Box(0.0, 1.0, (16,), float32))
config_doggo = {
'robot_base': 'xmls/doggo.xml',
'task': 'push',
'observation_flatten': False,
'observe_goal_lidar': True,
'observe_box_lidar': True,
'continue_goal': False,
'lidar_max_dist': 3,
'lidar_num_bins': 16
}
config_car_flattened = {
'robot_base': 'xmls/car.xml',
'task': 'push',
'observation_flatten': True,
'observe_goal_lidar': True,
'observe_box_lidar': True,
'continue_goal': False,
'lidar_max_dist': 3,
'lidar_num_bins': 16
}
# Push envs
# Unflattened observations
register(id='PointPush-v0',
entry_point='safety_gym.envs.mujoco:Engine',
kwargs={'config': config_point})
register(id='CarPush-v0',
entry_point='safety_gym.envs.mujoco:Engine',
kwargs={'config': config_car})
register(id='DoggoPush-v0',
entry_point='safety_gym.envs.mujoco:Engine',
kwargs={'config': config_doggo})
# Flattened observations
register(id='CarPush-v1',
entry_point='safety_gym.envs.mujoco:Engine',
kwargs={'config': config_car_flattened})