Skip to content

Commit e066a87

Browse files
authored
Merge pull request #5 from OSUrobotics/refactor/robot
Refactor/robot -- Merging to run BFG without HEAD pointing at protected files.
2 parents 31651a0 + c038990 commit e066a87

35 files changed

+1293
-834
lines changed

.github/workflows/black.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/run_tests.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: pybullet-tree-sim-workflow
2+
3+
on:
4+
pull_request:
5+
branches: ['main', 'develop']
6+
7+
jobs:
8+
build:
9+
strategy:
10+
fail-fast: true
11+
matrix:
12+
os: [ubuntu-latest, macos-latest, windows-latest]
13+
python-version: ['3.9', '3.10', '3.11', '3.12']
14+
15+
runs-on: ${{ matrix.os }}
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install .
28+
pip install flake8 black pytest
29+
30+
- name: Format with black
31+
uses: psf/black@stable
32+
with:
33+
options: "--check --verbose --diff --line-length=120 ./"
34+
35+
- name: Lint with flake8
36+
uses: py-actions/flake8@v2
37+
# run: |
38+
# # stop the build if there are Python syntax errors or undefined names
39+
# $ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
40+
with:
41+
args: "--count --select=E9,F63,F7,F82 --show-source --statistics"
42+
43+
# - name: Run tests
44+
# run: |
45+
# pytest

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,10 @@ cython_debug/
164164
#
165165

166166
# don't upload tree generations
167-
**/trees/*/generated/*
167+
**/trees/*/generated/*
168+
169+
# Don't upload pkl files
170+
*.pkl
171+
pkl/
172+
173+
meshes/

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
2+
## Using this package
3+
4+
### Adding trees
5+
All trees should be defined by their origin namespace, the tree type, and the tree id. Tree ids should be zero-padded by 5 spaces.
6+
7+
```
8+
# Pattern:
9+
{tree_namespace}_{tree_type}_{tree_id}
10+
11+
# Examples:
12+
LPy_envy_00027
13+
prosser_ufo_00762
14+
```
15+
16+
Trees should include a generic mesh and and a labeled mesh. LPy trees can be generated `TODO: TALK TO ABHINAV`
17+
18+
19+
## TODO:
20+
Look up Cantera
21+
122
urdf generic launch CLI test:
223
`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`
324

@@ -7,7 +28,7 @@ urdf generic launch CLI test:
728
1. For Claire:
829
1. Figure out best way to manage tree/robot/environment interaction. I removed robot from penv, but self.trees still exists.
930
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.
31+
1. Find the `TODO`s in all the code. Ask Luke what they meana and discuss solutions.
1132
1. Format the final approach controller as a python subpackage?
1233
1. https://packaging.python.org/en/latest/guides/packaging-namespace-packages/#packaging-namespace-packages
1334
1. Add basic cylinder to world. Dynamically create URDF.

main.py

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,39 @@
1010
import time
1111
from zenlog import log
1212

13+
from scipy.spatial.transform import Rotation
14+
1315

1416
def 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]}")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
amiga_prefix: amiga__
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
eef_type: mock_pruner
22
mock_pruner_prefix: mock_pruner__
3-
tof0_offset_x: "0.1"
4-
tof1_offset_x: "-0.1"
3+
tof0_offset: "0.10 -0.025 0.2"
4+
tof1_offset: "-0.10 -0.025 0.2"

pybullet_tree_sim/config/description/robot/robot.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
robot_stack:
2-
# - farm-ng
3-
- cart
2+
- amiga
3+
# - cart
44
# - linear_slider
55
- ur5e
66
- mock_pruner
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: "VL53L4CD"
2+
data_type: "d"
3+
depth:
4+
dfov: 18.0
5+
near_plane: 0.02
6+
far_plane: 1.20
7+
width: 1
8+
height: 1

pybullet_tree_sim/config/description/tof/vl6180.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ data_type: "d"
33
depth:
44
dfov: 25.0
55
near_plane: 0.002
6-
# far_plane: 0.150
7-
far_plane: 0.40
6+
far_plane: 0.150
87
width: 1
98
height: 1

0 commit comments

Comments
 (0)