Skip to content

Commit 9609539

Browse files
committed
working base robot class for final approach controller
1 parent 3252a8d commit 9609539

File tree

6 files changed

+13
-14
lines changed

6 files changed

+13
-14
lines changed

pybullet_tree_sim/robot.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,9 @@ def _get_links(self) -> dict:
192192
links = {}
193193
for i in range(self.num_joints):
194194
info = self.pbclient.getJointInfo(self.robot, i)
195+
# log.debug(info)
195196
child_link_name = info[12].decode("utf-8")
196-
links.update({child_link_name: {'id': i, "tf_to_parent": info[14]}})
197+
links.update({child_link_name: {'id': i, "tf_from_parent": info[14]}})
197198
return links
198199

199200
def _assign_collision_links(self) -> list:
@@ -251,7 +252,7 @@ def _get_sensors(self) -> dict:
251252
) # TODO: find a better way to get the prefix. If
252253
# from robot_conf, need standard for all robots TODO: log an error if robot_part doesn't have all the right frames. Xacro utils?
253254
sensors[sensor_name].tf_id = self.links[sensors[sensor_name].tf_frame]['id']
254-
sensors[sensor_name].tf_to_parent = self.links[sensors[sensor_name].tf_frame]['tf_to_parent']
255+
sensors[sensor_name].tf_from_parent = self.links[sensors[sensor_name].tf_frame]['tf_from_parent']
255256
sensors[sensor_name].pan = metadata["pan"] # TODO: Are these only for cameras/toFs? If so, needs reorg
256257
sensors[sensor_name].tilt = metadata["tilt"]
257258
# for key, value in yamlcontent.items():

pybullet_tree_sim/urdf/end_effectors/dovetail_mount/macro/dovetail_mount_macro.urdf.xacro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
<xacro:property name="dovetail_male_tool0_height" value="0.008"/>
55
<xacro:property name="dovetail_female_tool0_height" value="0.023"/>
6+
<xacro:property name="dovetail_male_rot_offset" value="0.0 0.0 0.0"/>
67

78

89
<xacro:macro name="dovetail_male_mount_macro" params="parent_link dovetail_male_mount_prefix mesh_base_path">
@@ -39,7 +40,7 @@
3940
<link name="${dovetail_male_mount_prefix}tool0"/>
4041
<!-- joints -->
4142
<joint name="${parent_link}--${dovetail_male_mount_prefix}base" type="fixed">
42-
<origin xyz="0 0 0" rpy="0 0 0"/>
43+
<origin xyz="0 0 0" rpy="${dovetail_male_rot_offset}"/>
4344
<parent link="${parent_link}"/>
4445
<child link="${dovetail_male_mount_prefix}base"/>
4546
</joint>

pybullet_tree_sim/urdf/robot/generic/robot.urdf.xacro

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<xacro:if value="${ str(resolved_parent_part) == 'world'}">
3030
<xacro:property name='resolved_parent_link' value='world'/>
3131
</xacro:if>
32-
<xacro:unless value="${ str(resolved_parent_part) == 'world'}">
32+
<xacro:unless value="${ str(resolved_parent_part) == 'world' }">
3333
<xacro:property name='resolved_parent_link' value="${resolved_parent_part}__tool0"/>
3434
</xacro:unless>
3535

@@ -160,9 +160,10 @@
160160

161161
<!-- call macro recursively -->
162162
<xacro:main_loop stack_qty="${stack_qty - 1}"/>
163-
</xacro:if>
163+
</xacro:if>
164164
</xacro:macro>
165165

166+
<!-- call main loop -->
166167
<xacro:main_loop stack_qty="$(arg robot_stack_qty)"/>
167168

168169

pybullet_tree_sim/urdf/shapes/cylinder/cylinder.urdf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@
88
<link name="cylinder">
99
<visual>
1010
<geometry>
11-
<cylinder length="2.82" radius="0.0254"/>
11+
<cylinder length="2.81" radius="0.0127"/>
1212
</geometry>
1313
<material name="LightGrey">
1414
<color rgba="0.7 0.7 0.7 1.0"/>
1515
</material>
1616
</visual>
1717
<collision concave="true">
1818
<geometry>
19-
<cylinder length="2.82" radius="0.0254"/>
19+
<cylinder length="2.81" radius="0.0127"/>
2020
</geometry>
2121
</collision>
2222
<inertial>
2323
<mass value="1.0"/>
2424
<origin rpy="0.0 0.0 0.0" xyz="0.0 0.0 0.0"/>
25-
<inertia ixx="0.6628612899999998" ixy="0.0" ixz="0.0" iyy="0.6628612899999998" iyz="0.0" izz="0.00032258"/>
25+
<inertia ixx="0.6580486558333333" ixy="0.0" ixz="0.0" iyy="0.6580486558333333" iyz="0.0" izz="8.0645e-05"/>
2626
</inertial>
2727
</link>
2828
<link name="world"/>

pybullet_tree_sim/urdf/tmp/robot.urdf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<link name="dovetail_male_mount__tool0"/>
4343
<!-- joints -->
4444
<joint name="ur5e__tool0--dovetail_male_mount__base" type="fixed">
45-
<origin rpy="0 0 0" xyz="0 0 0"/>
45+
<origin rpy="0.0 0.0 0.0" xyz="0 0 0"/>
4646
<parent link="ur5e__tool0"/>
4747
<child link="dovetail_male_mount__base"/>
4848
</joint>

pybullet_tree_sim/utils/pyb_utils.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,6 @@ def add_sphere(self, radius: float, pos: List, rgba: List) -> int:
141141
# )
142142
# return
143143

144-
145-
146144
@staticmethod
147145
def linearize_depth(depth: NDArray, far_val: float, near_val: float):
148146
"""OpenGL returns contracted depth, linearize it"""
@@ -151,9 +149,7 @@ def linearize_depth(depth: NDArray, far_val: float, near_val: float):
151149
except ZeroDivisionError:
152150
log.warning("Encountered division by 0 in depth linearization.")
153151
depth_linearized = None
154-
return depth_linearized
155-
156-
152+
return depth_linearized
157153

158154
def visualize_points(self, points: List, type: str) -> None:
159155
dx = 0.1

0 commit comments

Comments
 (0)