Skip to content

Commit e609a45

Browse files
authored
Merge pull request #4 from OSUrobotics/refactor/robot
Refactor/robot
2 parents efc889e + ee16c9d commit e609a45

21 files changed

+676
-654
lines changed

README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ urdf generic launch CLI test:
22
`xacro robot.urdf.xacro > test.urdf end_effector_type:=mock_pruner eef_parent:=ur5e__tool0 arm_type:=ur5 ur_type:=ur5e tf_prefix:=ur5e__ base_attachment_type:=linear_slider`
33

44
## TODO
5+
1. Figure out better sensor -> camera -> ToF inheritance (ask Cindy)
6+
1. Tree/robot/env interaction
57
1. For Claire:
6-
1. Generic URDF to Generic Robot class
8+
1. Figure out best way to manage tree/robot/environment interaction. I removed robot from penv, but self.trees still exists.
79
1. Fill out the `object_loader.py` class. Activate/deactivate trees, supports, robots.
10+
1. Find the `TODO`s in all the code. Ask Luke what they mean and discuss solutions.
811
1. Format the final approach controller as a python subpackage?
912
1. https://packaging.python.org/en/latest/guides/packaging-namespace-packages/#packaging-namespace-packages
1013
1. Add basic cylinder to world. Dynamically create URDF.
11-
1. Separate camera class
12-
1. ToF class inherits camera classs
1314
1. Dynamically populate UR URDF. Allow for various end-effectors and robot configurations.
1415
1. Make sure to include camera and other sensors. (Source manifold mesh -- utils -> camera class (C++))
1516
1. Dynamic parent joint for Panda to slider/farm-ng (like UR5)
@@ -19,7 +20,7 @@ urdf generic launch CLI test:
1920
1. Make mini orchard from a set of URDFs
2021
1. Space out like normal orchard
2122
1. Be aware of memory issues in PyB
22-
1. Change pkl files to hdf5. (lower priority)
23+
1. Change pkl files to hdf5. (lower priority) -- Ask Abhinav for code
2324
1. Test
2425
1. Various tof configurations
2526

main.py

+16-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#!/usr/bin/env python3
2-
from pybullet_tree_sim.camera import Camera
3-
from pybullet_tree_sim.time_of_flight import TimeOfFlight
42
from pybullet_tree_sim.pruning_environment import PruningEnv
53
from pybullet_tree_sim.robot import Robot
64
from pybullet_tree_sim.tree import Tree
@@ -50,24 +48,29 @@ def main():
5048
try:
5149
# log.debug(f"{robot.sensors['tof0']}")
5250
tof0_view_matrix = robot.get_view_mat_at_curr_pose(camera=robot.sensors["tof0"])
53-
tof0_rgbd = penv.pbutils.get_rgbd_at_cur_pose(
54-
camera=robot.sensors["tof0"], type="robot", view_matrix=tof0_view_matrix
51+
tof0_rgbd = robot.get_rgbd_at_cur_pose(
52+
camera=robot.sensors["tof0"], type="sensor", view_matrix=tof0_view_matrix
5553
)
5654
tof1_view_matrix = robot.get_view_mat_at_curr_pose(camera=robot.sensors["tof1"])
57-
tof1_rgbd = penv.pbutils.get_rgbd_at_cur_pose(
58-
camera=robot.sensors["tof1"], type="robot", view_matrix=tof1_view_matrix
55+
tof1_rgbd = robot.get_rgbd_at_cur_pose(
56+
camera=robot.sensors["tof1"], type="sensor", view_matrix=tof1_view_matrix
5957
)
6058
# tof0_view_matrix = np.asarray(tof0_view_matrix).reshape((4, 4), order="F")
6159
# log.debug(f"{tof0_view_matrix[:3, 3]}")
6260

61+
# Get user keyboard input, map to robot movement, camera capture, controller action
6362
keys_pressed = penv.get_key_pressed()
64-
action = penv.get_key_action(robot=robot, keys_pressed=keys_pressed)
65-
action = action.reshape((6, 1))
66-
joint_vel, jacobian = robot.calculate_joint_velocities_from_ee_velocity_dls(end_effector_velocity=action)
67-
robot.action = joint_vel
68-
singularity = robot.set_joint_velocities(robot.action)
69-
penv.pbutils.pbclient.stepSimulation()
70-
time.sleep(0.01)
63+
move_action = robot.get_key_move_action(keys_pressed=keys_pressed)
64+
sensor_data = robot.get_key_sensor_action(keys_pressed=keys_pressed)
65+
66+
joint_vels, jacobian = robot.calculate_joint_velocities_from_ee_velocity_dls(
67+
end_effector_velocity=move_action
68+
)
69+
singularity = robot.set_joint_velocities(joint_velocities=joint_vels)
70+
71+
# Step simulation
72+
pbutils.pbclient.stepSimulation()
73+
time.sleep(0.001)
7174
except KeyboardInterrupt:
7275
break
7376

pybullet_tree_sim/camera.py

-68
This file was deleted.

0 commit comments

Comments
 (0)