1010import time
1111from zenlog import log
1212
13+ from scipy .spatial .transform import Rotation
14+
1315
1416def main ():
1517 pbutils = PyBUtils (renders = True )
16-
17- robot = Robot (pbclient = pbutils .pbclient , position = [0 , 1 , 0 ], orientation = [ 0 , 0 , 0 , 1 ] )
18+ robot_start_orientation = Rotation . from_euler ( 'xyz' , [ 0 , 0 , 180 ], degrees = True ). as_quat ()
19+ robot = Robot (pbclient = pbutils .pbclient , position = [0 , 1 , 0 ], orientation = robot_start_orientation )
1820
1921 penv = PruningEnv (
2022 pbutils = pbutils ,
2123 verbose = True ,
2224 )
2325
24- _1_inch = 0.0254
25- penv .activate_shape (shape = "cylinder" , radius = _1_inch * 2 , height = 2.85 , orientation = [0 , np .pi / 2 , 0 ])
26+ # _1_inch = 0.0254
27+ # penv.activate_shape(
28+ # shape="cylinder",
29+ # radius=_1_inch * 2,
30+ # height=2.85,
31+ # orientation=[0, np.pi / 2, 0],
32+ # )
2633 # penv.activate_shape(shape="cylinder", radius=0.01, height=2.85, orientation=[0, np.pi / 2, 0])
2734
28- # penv.load_tree(
29- # pbutils=pbutils,
30- # scale=1.0,
31- # tree_id=1 ,
32- # tree_type="envy",
33- # tree_namespace="LPy_ ",
34- # # tree_urdf_path=os.path.join(URDF_PATH, "trees", "envy", "generated", "LPy_envy_tree0.urdf"),
35- # save_tree_urdf=False,
36- # # randomize_pose=True
37- # )
38- # penv.activate_tree(tree_id_str="LPy_envy_tree1" )
35+ tree_name = penv .load_tree (
36+ pbutils = pbutils ,
37+ scale = 1.0 ,
38+ tree_id = 2 ,
39+ tree_type = "envy" ,
40+ tree_namespace = "LPy " ,
41+ # tree_urdf_path=os.path.join(URDF_PATH, "trees", "envy", "generated", "LPy_envy_tree0.urdf"),
42+ save_tree_urdf = False ,
43+ # randomize_pose=True
44+ )
45+ penv .activate_tree (tree_id_str = tree_name )
3946
4047 # # Run the sim a little just to get the environment properly loaded.
4148 for i in range (100 ):
@@ -49,11 +56,15 @@ def main():
4956 # log.debug(f"{robot.sensors['tof0']}")
5057 tof0_view_matrix = robot .get_view_mat_at_curr_pose (camera = robot .sensors ["tof0" ])
5158 tof0_rgbd = robot .get_rgbd_at_cur_pose (
52- camera = robot .sensors ["tof0" ], type = "sensor" , view_matrix = tof0_view_matrix
59+ camera = robot .sensors ["tof0" ],
60+ type = "sensor" ,
61+ view_matrix = tof0_view_matrix ,
5362 )
5463 tof1_view_matrix = robot .get_view_mat_at_curr_pose (camera = robot .sensors ["tof1" ])
5564 tof1_rgbd = robot .get_rgbd_at_cur_pose (
56- camera = robot .sensors ["tof1" ], type = "sensor" , view_matrix = tof1_view_matrix
65+ camera = robot .sensors ["tof1" ],
66+ type = "sensor" ,
67+ view_matrix = tof1_view_matrix ,
5768 )
5869 # tof0_view_matrix = np.asarray(tof0_view_matrix).reshape((4, 4), order="F")
5970 # log.debug(f"{tof0_view_matrix[:3, 3]}")
0 commit comments