Skip to content

Commit 5de48d4

Browse files
committed
Improve mechanism of saving waypoints
1 parent 8ee2b7f commit 5de48d4

File tree

9 files changed

+292
-298
lines changed

9 files changed

+292
-298
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ git checkout main
5252
```
5353

5454
## :video_game: Instructions to record waypoints (use joystick to move robot around)
55-
- Before running scripts on the robot, waypoints should be recording. These waypoints exist inside file `spot-sim2real/spot_rl_experiments/configs/waypoints.yaml`
55+
- Before running scripts on the robot, waypoints should be recorded. These waypoints exist inside file `spot-sim2real/spot_rl_experiments/configs/waypoints.yaml`
5656

5757
- Before recording receptacles, make the robot sit at home position then run following command
5858
```bash
@@ -155,7 +155,7 @@ git checkout main
155155
156156
- The waypoints that were recorded are w.r.t the home location. Since the odometry drifts while robot is moving, **it is necessary to reset home before start of every new run**
157157
158-
### Step4. Emergency stop
158+
#### Step4. Emergency stop
159159
- Follow the steps described in [e-stop section](/README.md#running-emergency-stop)
160160
161161

installation/SETUP_INSTRUCTIONS.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,20 @@ source ~/.bash_profile
193193
194194
For assistance with finding the right ip of your computer, [please follow these steps](/installation/ISSUES.md#how-to-find-ip-address-of-local-computer).
195195
196-
196+
### Testing the setup by running simple navigation policy on robot
197+
1. Create waypoints.yaml file using the following command
198+
```bash
199+
spot_rl_waypoint_recorder -x
200+
```
201+
2. Follow Steps 1,2,3,4 from [README.md](/README.md#running-the-demo-asclscseq-experts)
202+
3. Go to root of repo, and run simple command to move robot to a new waypoint using the navigation policy. This command will move robot 2.5m in front after undocking. **Ensure there is 2.5m space in front of dock**
203+
```bash
204+
python spot_rl_experiments/spot_rl/envs/nav_env.py -w "test_receptacle"
205+
```
206+
4. Once the robot has moved, you can dock back the robot with the following command
207+
```bash
208+
spot_rl_autodock
209+
```
197210
### For Meta internal users (with Meta account), please check the following link for the ip and the password
198211
199212
[Link](https://docs.google.com/document/d/1u4x4ZMjHDQi33PB5V2aTZ3snUIV9UdkSOV1zFhRq1Do/edit)

spot_rl_experiments/configs/waypoints_apartment.yaml

-150
This file was deleted.

spot_rl_experiments/configs/waypoints_microkitchen.yaml

-74
This file was deleted.

spot_rl_experiments/spot_rl/envs/lang_env.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
from spot_rl.real_policy import GazePolicy, MixerPolicy, NavPolicy, PlacePolicy
2121
from spot_rl.utils.remote_spot import RemoteSpot
2222
from spot_rl.utils.utils import (
23-
WAYPOINTS,
2423
closest_clutter,
2524
construct_config,
2625
get_clutter_amounts,
2726
get_default_parser,
27+
get_waypoint_yaml,
2828
nav_target_from_waypoints,
2929
object_id_to_nav_waypoint,
3030
place_target_from_waypoints,
@@ -65,6 +65,9 @@ def main(spot, use_mixer, config, out_path=None):
6565
# Check if robot should return to base
6666
return_to_base = config.RETURN_TO_BASE
6767

68+
# Get the waypoints from waypoints.yaml
69+
waypoints = get_waypoint_yaml()
70+
6871
audio_to_text = WhisperTranslator()
6972
sentence_similarity = SentenceSimilarity()
7073
with initialize(config_path="../llm/src/conf"):
@@ -87,10 +90,10 @@ def main(spot, use_mixer, config, out_path=None):
8790

8891
# Find closest nav_targets to the ones robot knows locations of
8992
nav_1 = sentence_similarity.get_most_similar_in_list(
90-
nav_1, list(WAYPOINTS["nav_targets"].keys())
93+
nav_1, list(waypoints["nav_targets"].keys())
9194
)
9295
nav_2 = sentence_similarity.get_most_similar_in_list(
93-
nav_2, list(WAYPOINTS["nav_targets"].keys())
96+
nav_2, list(waypoints["nav_targets"].keys())
9497
)
9598
print("MOST SIMILAR: ", nav_1, pick, nav_2)
9699

spot_rl_experiments/spot_rl/envs/mobile_manipulation_env.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
from spot_rl.real_policy import GazePolicy, MixerPolicy, NavPolicy, PlacePolicy
1717
from spot_rl.utils.remote_spot import RemoteSpot
1818
from spot_rl.utils.utils import (
19-
WAYPOINTS,
2019
closest_clutter,
2120
construct_config,
2221
get_clutter_amounts,
2322
get_default_parser,
23+
get_waypoint_yaml,
2424
nav_target_from_waypoints,
2525
object_id_to_nav_waypoint,
2626
place_target_from_waypoints,
@@ -64,9 +64,12 @@ def main(spot, use_mixer, config, out_path=None):
6464
# Check if robot should return to base
6565
return_to_base = config.RETURN_TO_BASE
6666

67+
# Get the waypoints from waypoints.yaml
68+
waypoints = get_waypoint_yaml()
69+
6770
objects_to_look = []
68-
for waypoint in WAYPOINTS["object_targets"]:
69-
objects_to_look.append(WAYPOINTS["object_targets"][waypoint][0])
71+
for waypoint in waypoints["object_targets"]:
72+
objects_to_look.append(waypoints["object_targets"][waypoint][0])
7073
rospy.set_param("object_target", ",".join(objects_to_look))
7174

7275
env.power_robot()
@@ -78,7 +81,7 @@ def main(spot, use_mixer, config, out_path=None):
7881
if trip_idx < NUM_OBJECTS:
7982
# 2 objects per receptacle
8083
clutter_blacklist = [
81-
i for i in WAYPOINTS["clutter"] if count[i] >= CLUTTER_AMOUNTS[i]
84+
i for i in waypoints["clutter"] if count[i] >= CLUTTER_AMOUNTS[i]
8285
]
8386
waypoint_name, waypoint = closest_clutter(
8487
env.x, env.y, clutter_blacklist=clutter_blacklist

spot_rl_experiments/spot_rl/utils/generate_place_goal.py

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ def get_global_place_target(spot: Spot):
1616
position, rotation = spot.get_base_transform_to("link_wr1")
1717
position = [position.x, position.y, position.z]
1818
rotation = [rotation.x, rotation.y, rotation.z, rotation.w]
19+
20+
# Spot2Habitat transform SHOULD NOT BE A PART OF SpotBaseEnv Class. It is an unnecessary dependency.
1921
wrist_T_base = SpotBaseEnv.spot2habitat_transform(position, rotation)
2022
gripper_T_base = wrist_T_base @ mn.Matrix4.translation(
2123
mn.Vector3(EE_GRIPPER_OFFSET)

0 commit comments

Comments
 (0)