Skip to content

Commit cf9d55c

Browse files
committed
beginning of major URDF refactor
1 parent a948891 commit cf9d55c

File tree

22 files changed

+102536
-1814
lines changed

22 files changed

+102536
-1814
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ urdf generic launch CLI test:
2525

2626
## Installation
2727

28+
#### Requirements
29+
ur, linear_slider, franka-emika
30+
2831
#### General use
2932
```
3033
python -m pip install .

main.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
2-
2+
from pybullet_tree_sim.camera import Camera
3+
from pybullet_tree_sim.time_of_flight import TimeOfFlight
34
from pybullet_tree_sim.pruning_environment import PruningEnv
45
from pybullet_tree_sim.tree import Tree
56
from pybullet_tree_sim.utils.pyb_utils import PyBUtils
@@ -11,16 +12,23 @@
1112
from zenlog import log
1213

1314

14-
def main():
15-
# TODO: CLI args?
16-
cam_dfov = 65
17-
cam_height = 8
18-
cam_width = 8
15+
def main():
16+
pbutils = PyBUtils(renders=False)
17+
18+
# Init sensors
19+
sensor_config = {
20+
"camera0": {
21+
'sensor': Camera(pbutils, sensor_name="realsense_d435i"),
22+
'tf_frame': "mock_pruner__camera0",
23+
}
24+
}
25+
1926

20-
pbutils = PyBUtils(renders=True, cam_width=cam_width, cam_height=cam_height, dfov=cam_dfov)
27+
2128
penv = PruningEnv(
22-
pbutils=pbutils, load_robot=True, robot_pos=[0, 1, 0], verbose=True, cam_width=cam_width, cam_height=cam_height
29+
pbutils=pbutils, load_robot=True, sensor_config=sensor_config, robot_pos=[0, 2, 0], verbose=True,
2330
)
31+
2432

2533
penv.activate_shape(shape="cylinder", radius=2 * 0.0254, height=2.0, orientation=[0, np.pi / 2, 0])
2634
# penv.load_tree(
@@ -43,14 +51,14 @@ def main():
4351
# Simulation loop
4452
while True:
4553
try:
46-
view_matrix = penv.ur5.get_view_mat_at_curr_pose(0, 0, [0, 0, 0])
54+
tof0_view_matrix = penv.robot.get_view_mat_at_curr_pose(camera=penv.robot.sensors['mock_pruner__camera0'])
4755
rgbd = penv.pbutils.get_rgbd_at_cur_pose(type="robot", view_matrix=view_matrix)
4856
keys_pressed = penv.get_key_pressed()
4957
action = penv.get_key_action(keys_pressed=keys_pressed)
5058
action = action.reshape((6, 1))
51-
jv, jacobian = penv.ur5.calculate_joint_velocities_from_ee_velocity_dls(end_effector_velocity=action)
52-
penv.ur5.action = jv
53-
singularity = penv.ur5.set_joint_velocities(penv.ur5.action)
59+
jv, jacobian = penv.robot.calculate_joint_velocities_from_ee_velocity_dls(end_effector_velocity=action)
60+
penv.robot.action = jv
61+
singularity = penv.robot.set_joint_velocities(penv.robot.action)
5462
penv.pbutils.pbclient.stepSimulation()
5563
time.sleep(0.01)
5664
except KeyboardInterrupt:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cart_prefix: cart__
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
base_type: linear_slider
2-
base_parent: world
32
base_prefix: linear_slider__
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
eef_type: mock_pruner
2-
eef_parent: ur5e__
2+
eef_parent: ur5e__ # TODO: take care of __ in urdf
33
eef_prefix: mock_pruner__
44
tof0_offset_x: "0.02"
55
tof1_offset_x: "-0.02"

pybullet_tree_sim/config/robot/robot.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
robot_stack:
2+
# - farm-ng
3+
- cart
24
# - linear_slider
35
- ur5e
46
- mock_pruner
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
arm_type: ur5e
2-
# arm_parent: tool0
3-
arm_prefix: ur5e__
4-
tf_prefix: ur5e__
1+
ur_prefix: ur5e__
52
ur_type: ur5e

0 commit comments

Comments
 (0)