Skip to content

Commit 0db431e

Browse files
authored
Merge pull request #112 from compas-dev/start_full_configuration
start FULL configuration for planning service calls
2 parents 9e09666 + 0463478 commit 0db431e

23 files changed

+22453
-16148
lines changed

CHANGELOG.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,20 @@ Unreleased
1313

1414
**Added**
1515

16-
* ..
16+
* Added optional ``joint_names`` to ``Configuration``
17+
* Added ``Configuration.scaled``
18+
* Added ``full_joint_state`` to ``Robot.inverse_kinematics``
19+
* Added ``Semantics.get_all_configurable_joints``
1720

1821
**Changed**
1922

23+
* Construct ``full_configuration`` with ``values``, ``types``, ``joint_names`` in ``Robot`` rather than in ``MoveItPlanner``
24+
* ``MoveItPlanner`` returns ``start_configuration`` with set ``joint_names``
25+
* Removed parameter ``names`` from ``RobotArtist.update``
26+
* Updated Grasshopper examples
27+
* ``Robot``: ``forward_kinematics`` returns now ``frame_WCF``
28+
* ``MoveItPlanner``: ``forward_kinematics`` takes now instance of ``Configuration`` and ``robot``
29+
* ``MoveItPlanner``: ``inverse_kinematics`` takes now instance of ``Configuration`` and ``robot``
2030
* Property :class:`compas_fab.robots.Robot.artist` does not try to scale robot
2131
geometry if links and/or joints are not defined.
2232
* In :class:``compas_fab.robots.constraints.JointConstraint``, added ``tolerance_above`` and

docs/examples/02_description_models/files/02_robot_artist_grasshopper.ghx

Lines changed: 715 additions & 607 deletions
Large diffs are not rendered by default.

docs/examples/03_backends_ros/files/02_forward_kinematics.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
robot = Robot()
55
configuration = Configuration.from_revolute_values([-2.238, -1.153, -2.174, 0.185, 0.667, 0.])
66

7-
frame_RCF = robot.forward_kinematics(configuration)
8-
frame_WCF = robot.to_world_coords(frame_RCF)
7+
frame_WCF = robot.forward_kinematics(configuration)
98

10-
print("Frame in the robot's coordinate system")
11-
print(frame_RCF)
129
print("Frame in the world coordinate system")
1310
print(frame_WCF)

docs/examples/03_backends_ros/files/02_forward_kinematics_ros.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
robot = Robot(client)
77
configuration = Configuration.from_revolute_values([-2.238, -1.153, -2.174, 0.185, 0.667, 0.])
88

9-
frame_RCF = robot.forward_kinematics(configuration)
10-
frame_WCF = robot.to_world_coords(frame_RCF)
9+
frame_WCF = robot.forward_kinematics(configuration)
1110

12-
print("Frame in the robot's coordinate system")
13-
print(frame_RCF)
1411
print("Frame in the world coordinate system")
1512
print(frame_WCF)

docs/examples/03_backends_ros/files/02_forward_kinematics_ros_loader.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66

77
configuration = Configuration.from_prismatic_and_revolute_values([0.], [-2.238, -1.153, -2.174, 0.185, 0.667, 0.])
88

9-
frame_RCF = robot.forward_kinematics(configuration)
10-
frame_WCF = robot.to_world_coords(frame_RCF)
9+
frame_WCF = robot.forward_kinematics(configuration)
1110

12-
print("Frame in the robot's coordinate system")
13-
print(frame_RCF)
1411
print("Frame in the world coordinate system")
1512
print(frame_WCF)

docs/examples/03_backends_ros/files/02_inverse_kinematics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
robot = Robot(client)
77

88
frame_WCF = Frame([0.3, 0.1, 0.5], [1, 0, 0], [0, 1, 0])
9-
start_configuration = robot.init_configuration()
9+
start_configuration = robot.zero_configuration()
1010

1111
configuration = robot.inverse_kinematics(frame_WCF, start_configuration)
1212

docs/examples/03_backends_ros/files/02_inverse_kinematics_ros_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
robot = client.load_robot()
66

77
frame_WCF = Frame([0.3, 0.1, 0.5], [1, 0, 0], [0, 1, 0])
8-
start_configuration = robot.init_configuration()
8+
start_configuration = robot.zero_configuration()
99

1010
configuration = robot.inverse_kinematics(frame_WCF, start_configuration)
1111

docs/examples/03_backends_ros/files/0x_load_robot_6.ghx

Lines changed: 2695 additions & 1300 deletions
Large diffs are not rendered by default.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""Calculate the robot's forward kinematic.
2+
Inputs:
3+
robot: :class:`compas_fab.robots.Robot`
4+
The robot.
5+
group: str, optional
6+
The planning group used for calculation. Defaults to the robot's
7+
main planning group.
8+
full_configuration : :class:`compas_fab.robots.Configuration`
9+
The full configuration to calculate the forward kinematic for. If no
10+
full configuration is passed, the zero-joint state for the other
11+
configurable joints is assumed.
12+
Output:
13+
:class:`Frame`
14+
The frame in the world coordinate frame (WCF).
15+
"""
16+
from __future__ import print_function
17+
18+
if robot and robot.client and full_configuration:
19+
if robot.client.is_connected:
20+
frame_WCF = robot.forward_kinematics(full_configuration, group, backend='model')
21+
print(frame_WCF)
22+
else:
23+
print("Robot is not connected")
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""Calculate the robot's inverse kinematic for a given plane.
2+
Inputs:
3+
robot: The robot
4+
group: str, optional
5+
The planning group used for calculation. Defaults to the robot's
6+
main planning group.
7+
plane: The plane in world coordinate frame to calculate the inverse for.
8+
start_configuration: :class:`compas_fab.robots.Configuration`, optional
9+
If passed, the inverse will be calculated such that the calculated
10+
joint positions differ the least from the start_configuration.
11+
Defaults to the init configuration.
12+
avoid_collisions: bool, optional
13+
Whether or not to avoid collisions. Defaults to True.
14+
Output:
15+
group_configuration: The group configuration
16+
full_configuration: The full configuration
17+
"""
18+
from __future__ import print_function
19+
20+
from compas.geometry import Frame
21+
22+
23+
frame = Frame(plane.Origin, plane.XAxis, plane.YAxis)
24+
25+
if robot and robot.client:
26+
if robot.client.is_connected:
27+
full_configuration = robot.inverse_kinematics(frame,
28+
start_configuration,
29+
group=group,
30+
avoid_collisions=avoid_collisions,
31+
return_full_configuration=True)
32+
group_configuration = robot.get_group_configuration(group, full_configuration)
33+
print(group_configuration)
34+
else:
35+
print("Robot client is not connected")

0 commit comments

Comments
 (0)