Skip to content

Commit 357f288

Browse files
committed
changed arguments of ik and fk to resamble arguments of plan_motion and plan_cartesian_motion
1 parent 897559c commit 357f288

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

src/compas_fab/backends/ros/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,13 @@ def load_robot(self, load_geometry=False, urdf_param_name='/robot_description',
169169

170170
return Robot(model, semantics=semantics, client=self)
171171

172-
def inverse_kinematics(self, frame, base_link, group,
172+
def inverse_kinematics(self, robot, frame, group,
173173
start_configuration, avoid_collisions=True,
174174
constraints=None, attempts=8,
175175
attached_collision_meshes=None):
176176
kwargs = {}
177+
kwargs['robot'] = robot
177178
kwargs['frame'] = frame
178-
kwargs['base_link'] = base_link
179179
kwargs['group'] = group
180180
kwargs['start_configuration'] = start_configuration
181181
kwargs['avoid_collisions'] = avoid_collisions
@@ -186,10 +186,10 @@ def inverse_kinematics(self, frame, base_link, group,
186186

187187
return await_callback(self.inverse_kinematics_async, **kwargs)
188188

189-
def forward_kinematics(self, configuration, base_link, group, ee_link):
189+
def forward_kinematics(self, robot, configuration, group, ee_link):
190190
kwargs = {}
191+
kwargs['robot'] = robot
191192
kwargs['configuration'] = configuration
192-
kwargs['base_link'] = base_link
193193
kwargs['group'] = group
194194
kwargs['ee_link'] = ee_link
195195

src/compas_fab/backends/ros/planner_backend_moveit.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,11 @@ def dispose_planner(self):
117117
# planning services
118118
# ==========================================================================
119119

120-
def inverse_kinematics_async(self, callback, errback, frame, base_link, group,
120+
def inverse_kinematics_async(self, callback, errback, robot, frame, group,
121121
start_configuration, avoid_collisions=True,
122122
constraints=None, attempts=8, attached_collision_meshes=None):
123123
"""Asynchronous handler of MoveIt IK service."""
124+
base_link = robot.model.root.name
124125
header = Header(frame_id=base_link)
125126
pose = Pose.from_frame(frame)
126127
pose_stamped = PoseStamped(header, pose)
@@ -145,9 +146,10 @@ def convert_to_positions(response):
145146

146147
self.GET_POSITION_IK(self, (ik_request, ), convert_to_positions, errback)
147148

148-
def forward_kinematics_async(self, callback, errback, configuration, base_link,
149+
def forward_kinematics_async(self, callback, errback, robot, configuration,
149150
group, ee_link):
150151
"""Asynchronous handler of MoveIt FK service."""
152+
base_link = robot.model.root.name
151153
header = Header(frame_id=base_link)
152154
fk_link_names = [ee_link]
153155
joint_state = JointState(

src/compas_fab/robots/robot.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,8 @@ def inverse_kinematics(self, frame_WCF, start_configuration=None,
962962
attached_collision_meshes = [self.attached_tool.attached_collision_mesh]
963963

964964
# The returned joint names might be more than the requested ones if there are passive joints present
965-
joint_positions, joint_names = self.client.inverse_kinematics(frame_WCF_scaled, self.model.root.name,
965+
joint_positions, joint_names = self.client.inverse_kinematics(self,
966+
frame_WCF_scaled,
966967
group, start_configuration_scaled,
967968
avoid_collisions, constraints, attempts,
968969
attached_collision_meshes)
@@ -1030,8 +1031,9 @@ def forward_kinematics(self, full_configuration, group=None, backend=None, link_
10301031

10311032
if not backend:
10321033
if self.client:
1033-
frame_WCF = self.client.forward_kinematics(full_configuration_scaled,
1034-
self.model.root.name, group,
1034+
frame_WCF = self.client.forward_kinematics(self,
1035+
full_configuration_scaled,
1036+
group,
10351037
link_name)
10361038
frame_WCF.point *= self.scale_factor
10371039
else:

0 commit comments

Comments
 (0)