forked from naokiyokoyama/bd_spot_wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_executables.py
36 lines (32 loc) · 1.28 KB
/
generate_executables.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
import os
import os.path as osp
import sys
this_dir = osp.dirname(osp.abspath(__file__))
base_dir = osp.join(this_dir, "spot_wrapper")
bin_dir = osp.join(os.environ["CONDA_PREFIX"], "bin")
orig_to_alias = {
"estop": "spot_estop",
"headless_estop": "spot_headless_estop",
"home_robot": "spot_reset_home",
"keyboard_teleop": "spot_keyboard_teleop",
"monitor_nav_pose": "spot_monitor_nav_pose",
"roll_over": "spot_roll_over",
"selfright": "spot_selfright",
"sit": "spot_sit",
"stand": "spot_stand",
"view_arm_proprioception": "spot_view_arm_proprioception",
"view_camera": "spot_view_camera",
}
print("Generating executables...")
for orig, alias in orig_to_alias.items():
exe_path = osp.join(bin_dir, alias)
data = f"#!/usr/bin/env bash \n{sys.executable} -m spot_wrapper.{orig} $@\n"
with open(exe_path, "w") as f:
f.write(data)
os.chmod(exe_path, 33277)
print("Added:", alias)
print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
print("THESE EXECUTABLES ARE ONLY VISIBLE TO THE CURRENT CONDA ENV!!")
print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")