44import numpy as np
55import rcsss
66from rcsss import sim
7+ from rcsss ._core .common import RobotPlatform
78from rcsss ._core .hw import FR3Config , IKSolver
89from rcsss ._core .sim import CameraType
910from rcsss .camera .sim import SimCameraConfig , SimCameraSet , SimCameraSetConfig
1011from rcsss .control .fr3_desk import FCI , ContextManager , Desk , load_creds_fr3_desk
11- from rcsss .envs .base import RobotInstance
1212from rcsss .envs .creators import get_urdf_path
1313
1414ROBOT_IP = "192.168.101.1"
15- ROBOT_INSTANCE = RobotInstance .SIMULATION
15+ ROBOT_INSTANCE = RobotPlatform .SIMULATION
1616# replace this with a path to a robot urdf file if you dont have the utn models
1717URDF_PATH = None
1818
@@ -55,7 +55,7 @@ def main():
5555 logger .error ("This pip package was not built with the UTN lab models, aborting." )
5656 sys .exit ()
5757 context_manger : FCI | ContextManager
58- if ROBOT_INSTANCE == RobotInstance .HARDWARE :
58+ if ROBOT_INSTANCE == RobotPlatform .HARDWARE :
5959 user , pw = load_creds_fr3_desk ()
6060 context_manger = FCI (Desk (ROBOT_IP , user , pw ), unlock = False , lock_when_done = False )
6161 else :
@@ -64,7 +64,7 @@ def main():
6464 with context_manger :
6565 robot : rcsss .common .Robot
6666 gripper : rcsss .common .Gripper
67- if ROBOT_INSTANCE == RobotInstance .SIMULATION :
67+ if ROBOT_INSTANCE == RobotPlatform .SIMULATION :
6868 simulation = sim .Sim (rcsss .scenes ["fr3_empty_world" ])
6969 urdf_path = get_urdf_path (URDF_PATH , allow_none_if_not_found = False )
7070 assert urdf_path is not None
@@ -107,15 +107,15 @@ def main():
107107 # move to home position and open gripper
108108 robot .move_home ()
109109 gripper .open ()
110- if ROBOT_INSTANCE == RobotInstance .SIMULATION :
110+ if ROBOT_INSTANCE == RobotPlatform .SIMULATION :
111111 simulation .step_until_convergence ()
112112 logger .info ("Robot is in home position, gripper is open" )
113113
114114 # 5cm in x direction
115115 robot .set_cartesian_position (
116116 robot .get_cartesian_position () * rcsss .common .Pose (translation = np .array ([0.05 , 0 , 0 ]))
117117 )
118- if ROBOT_INSTANCE == RobotInstance .SIMULATION :
118+ if ROBOT_INSTANCE == RobotPlatform .SIMULATION :
119119 simulation .step_until_convergence ()
120120 logger .debug (f"IK success: { robot .get_state ().ik_success } " ) # type: ignore
121121 logger .debug (f"sim converged: { simulation .is_converged ()} " )
@@ -124,7 +124,7 @@ def main():
124124 robot .set_cartesian_position (
125125 robot .get_cartesian_position () * rcsss .common .Pose (translation = np .array ([0 , 0.05 , 0 ]))
126126 )
127- if ROBOT_INSTANCE == RobotInstance .SIMULATION :
127+ if ROBOT_INSTANCE == RobotPlatform .SIMULATION :
128128 simulation .step_until_convergence ()
129129 logger .debug (f"IK success: { robot .get_state ().ik_success } " ) # type: ignore
130130 logger .debug (f"sim converged: { simulation .is_converged ()} " )
@@ -133,7 +133,7 @@ def main():
133133 robot .set_cartesian_position (
134134 robot .get_cartesian_position () * rcsss .common .Pose (translation = np .array ([0 , 0 , 0.05 ]))
135135 )
136- if ROBOT_INSTANCE == RobotInstance .SIMULATION :
136+ if ROBOT_INSTANCE == RobotPlatform .SIMULATION :
137137 simulation .step_until_convergence ()
138138 logger .debug (f"IK success: { robot .get_state ().ik_success } " ) # type: ignore
139139 logger .debug (f"sim converged: { simulation .is_converged ()} " )
@@ -143,12 +143,12 @@ def main():
143143 translation = np .array ([0 , 0 , 0 ]), rpy = rcsss .common .RPY (roll = 0 , pitch = - np .deg2rad (90 ), yaw = - np .deg2rad (90 ))
144144 )
145145 robot .set_cartesian_position (new_pose )
146- if ROBOT_INSTANCE == RobotInstance .SIMULATION :
146+ if ROBOT_INSTANCE == RobotPlatform .SIMULATION :
147147 simulation .step_until_convergence ()
148148 logger .debug (f"IK success: { robot .get_state ().ik_success } " ) # type: ignore
149149 logger .debug (f"sim converged: { simulation .is_converged ()} " )
150150
151- if ROBOT_INSTANCE == RobotInstance .HARDWARE :
151+ if ROBOT_INSTANCE == RobotPlatform .HARDWARE :
152152 input (
153153 "hold an object 25cm in front of the gripper, the robot is going to grasp it, press enter when you are ready"
154154 )
@@ -157,37 +157,37 @@ def main():
157157 robot .set_cartesian_position (
158158 robot .get_cartesian_position () * rcsss .common .Pose (translation = np .array ([0 , 0 , 0.25 ]))
159159 )
160- if ROBOT_INSTANCE == RobotInstance .SIMULATION :
160+ if ROBOT_INSTANCE == RobotPlatform .SIMULATION :
161161 simulation .step_until_convergence ()
162162 logger .debug (f"IK success: { robot .get_state ().ik_success } " ) # type: ignore
163163 logger .debug (f"sim converged: { simulation .is_converged ()} " )
164164
165165 # grasp the object
166166 gripper .grasp ()
167- if ROBOT_INSTANCE == RobotInstance .SIMULATION :
167+ if ROBOT_INSTANCE == RobotPlatform .SIMULATION :
168168 simulation .step_until_convergence ()
169169 logger .debug (f"sim converged: { simulation .is_converged ()} " )
170170
171171 # move 25cm backward
172172 robot .set_cartesian_position (
173173 robot .get_cartesian_position () * rcsss .common .Pose (translation = np .array ([0 , 0 , - 0.25 ]))
174174 )
175- if ROBOT_INSTANCE == RobotInstance .SIMULATION :
175+ if ROBOT_INSTANCE == RobotPlatform .SIMULATION :
176176 simulation .step_until_convergence ()
177177 logger .debug (f"IK success: { robot .get_state ().ik_success } " ) # type: ignore
178178 logger .debug (f"sim converged: { simulation .is_converged ()} " )
179179
180- if ROBOT_INSTANCE == RobotInstance .HARDWARE :
180+ if ROBOT_INSTANCE == RobotPlatform .HARDWARE :
181181 input ("gripper is going to be open, press enter when you are ready" )
182182
183183 # open gripper
184184 gripper .open ()
185- if ROBOT_INSTANCE == RobotInstance .SIMULATION :
185+ if ROBOT_INSTANCE == RobotPlatform .SIMULATION :
186186 simulation .step_until_convergence ()
187187
188188 # move back to home position
189189 robot .move_home ()
190- if ROBOT_INSTANCE == RobotInstance .SIMULATION :
190+ if ROBOT_INSTANCE == RobotPlatform .SIMULATION :
191191 simulation .step_until_convergence ()
192192
193193
0 commit comments