Skip to content

Commit 2480555

Browse files
authored
Merge pull request #113 from ichumuh/rip_connection_factories
Rip connection factories
2 parents 68461da + 651156e commit 2480555

32 files changed

Lines changed: 728 additions & 811 deletions

.github/workflows/build_and_deploy_doc.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88
push:
99
branches:
1010
- main
11-
- student_exercises
1211

1312
# If your git repository has the Jupyter Book within some-subfolder next to
1413
# unrelated files, you can make this run only if a file within that specific

.github/workflows/exercise-test-ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99
push:
1010
branches:
1111
- main
12-
- student_exercises
1312
pull_request:
1413
branches:
1514
- main

examples/regions.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ table_top.collision = table_top_shapes
6262
table_top.visual = table_top_shapes
6363
6464
with world.modify_world():
65-
root_to_leg = Connection6DoF(parent=root, child=table_leg, _world=world)
65+
root_to_leg = Connection6DoF.create_with_dofs(parent=root, child=table_leg, world=world)
6666
world.add_connection(root_to_leg)
6767
6868
leg_to_top = FixedConnection(
@@ -71,7 +71,6 @@ with world.modify_world():
7171
parent_T_connection_expression=TransformationMatrix.from_xyz_rpy(
7272
z=0.3, reference_frame=table_leg
7373
),
74-
_world=world,
7574
)
7675
world.add_connection(leg_to_top)
7776
```
@@ -97,7 +96,7 @@ We will now say the the region moves exactly as the table top moves.
9796
```{code-cell} ipython3
9897
with world.modify_world():
9998
world.add_kinematic_structure_entity(table_surface)
100-
connection = FixedConnection(table_top, table_surface, _world=world)
99+
connection = FixedConnection(table_top, table_surface)
101100
world.add_connection(connection)
102101
print(world.regions)
103102
```

examples/semantic_annotations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ with world.modify_world():
6565
apple_body.collision = [sphere]
6666
apple_body.visual = [sphere]
6767
68-
world.add_connection(Connection6DoF(parent=root, child=apple_body, _world=world))
68+
world.add_connection(Connection6DoF.create_with_dofs(parent=root, child=apple_body, world=world))
6969
world.add_semantic_annotation(Apple(body=apple_body, name=PrefixedName("apple1")))
7070
7171
# Our second apple
7272
apple_body_2 = Body(name=PrefixedName("apple_body_2"))
7373
sphere2 = Sphere(radius=0.15, origin=TransformationMatrix(reference_frame=apple_body_2))
7474
apple_body_2.collision = [sphere2]
7575
apple_body_2.visual = [sphere2]
76-
c2 = Connection6DoF(parent=root, child=apple_body_2, _world=world)
76+
c2 = Connection6DoF.create_with_dofs(parent=root, child=apple_body_2, world=world)
7777
world.add_connection(c2)
7878
# Move it a bit so we can see both
7979
world.state[c2.x.name].position = 0.3

examples/using_transformations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ camera_body = Body(
6464
)
6565
6666
# Connect base to the world root, and camera to the base.
67-
world_C_base = Connection6DoF(parent=root, child=base_body, _world=world)
68-
base_C_camera = Connection6DoF(parent=base_body, child=camera_body, _world=world)
67+
world_C_base = Connection6DoF.create_with_dofs(parent=root, child=base_body, world=world)
68+
base_C_camera = Connection6DoF.create_with_dofs(parent=base_body, child=camera_body, world=world)
6969
7070
# Place the base: put it slightly above the ground so the top sits at z≈0.05
7171
world_T_base = TransformationMatrix.from_xyz_rpy(z=0.025, reference_frame=root)

examples/world_state_manipulation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ with world.modify_world():
120120
new_root.collision = [box]
121121
122122
world.add_body(new_root)
123-
root_T_dresser = Connection6DoF(new_root, old_root, _world=world)
123+
root_T_dresser = Connection6DoF.create_with_dofs(parent=new_root, child=old_root, world=world)
124124
world.add_connection(root_T_dresser)
125125
rt = RayTracer(world)
126126
rt.update_scene()

examples/world_structure_manipulation.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ with world.modify_world():
5454
# 1) Add a passive 6DoF connection from root -> base.
5555
# This will automatically create 7 passive DoFs (x, y, z, qx, qy, qz, qw)
5656
# and register them in the world's state.
57-
c_root_base = Connection6DoF(parent=root, child=base, _world=world)
57+
c_root_base = Connection6DoF.create_with_dofs(parent=root, child=base, world=world)
5858
world.add_connection(c_root_base)
5959
6060
# 2) Create a custom DoF and use it in an active RevoluteConnection
@@ -68,7 +68,6 @@ with world.modify_world():
6868
child=link,
6969
dof_name=joint.name,
7070
axis=Vector3.Z(reference_frame=base),
71-
_world=world,
7271
)
7372
world.add_connection(c_base_link)
7473

self_assessment/exercises/0_using_transformations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ box_body = Body(
6868
collision=ShapeCollection([cube]),
6969
visual=ShapeCollection([cube]),
7070
)
71-
table_world_C_box = Connection6DoF(table_world.root, box_body)
7271
with table_world.modify_world():
72+
table_world_C_box = Connection6DoF.create_with_dofs(parent=table_world.root, child=box_body, world=table_world)
7373
table_world.add_connection(table_world_C_box)
7474
7575
rt = RayTracer(table_world); rt.update_scene(); rt.scene.show("jupyter")

self_assessment/exercises/4_world_structure_manipulation.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,15 @@ world = World()
6161
root = Body(name=PrefixedName(name="root", prefix="world"))
6262
base = Body(name=PrefixedName("base"))
6363
body = Body(name=PrefixedName("body"))
64-
root_C_base = Connection6DoF(parent=root, child=base)
65-
base_C_body_dof = DegreeOfFreedom(name=PrefixedName("joint_z"))
66-
base_C_body = RevoluteConnection(
67-
parent=base,
68-
child=body,
69-
dof_name=base_C_body_dof.name,
70-
axis=Vector3.Z(reference_frame=base),
71-
)
7264
7365
with world.modify_world():
66+
root_C_base = Connection6DoF.create_with_dofs(parent=root, child=base, world=world)
67+
base_C_body = RevoluteConnection.create_with_dofs(
68+
parent=base,
69+
child=body,
70+
axis=Vector3.Z(reference_frame=base),
71+
world=world
72+
)
7473
world.add_connection(root_C_base)
7574
world.add_connection(base_C_body)
7675
```

self_assessment/exercises/5_semantic_annotations.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ with world.modify_world():
160160
world.add_semantic_annotation(bottle_large)
161161
world.add_semantic_annotation(bottle_medium)
162162
163-
root_C_bottle_large = Connection6DoF(parent=virtual_root, child=bottle_large_body)
164-
bottle_large_C_cap = Connection6DoF(parent=bottle_large_body, child=cap_body)
165-
root_C_bottle_medium = Connection6DoF(parent=virtual_root, child=bottle_medium_body)
163+
root_C_bottle_large = Connection6DoF.create_with_dofs(parent=virtual_root, child=bottle_large_body, world=world)
164+
bottle_large_C_cap = Connection6DoF.create_with_dofs(parent=bottle_large_body, child=cap_body, world=world)
165+
root_C_bottle_medium = Connection6DoF.create_with_dofs(parent=virtual_root, child=bottle_medium_body, world=world)
166166
167167
world.add_connection(root_C_bottle_large)
168168
world.add_connection(bottle_large_C_cap)

0 commit comments

Comments
 (0)