Skip to content

Commit 549f25e

Browse files
authored
Merge pull request #227 from compas-dev/minor_fixes
Minor fixes
2 parents f61a3f3 + 53a0e1e commit 549f25e

File tree

7 files changed

+3220
-529
lines changed

7 files changed

+3220
-529
lines changed

CHANGELOG.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Unreleased
1919
* Added ``attributes`` dictionary to ``Robot`` class
2020
* Added ``compas_fab.robots.Tool.from_t0cf_to_tcf``
2121
* Added ``compas_fab.robots.Tool.from_tcf_to_t0cf``
22-
* Added ```joint_names`` as optional parameter for all ``compas_fab.robots.Configuration`` constructors
22+
* Added ``joint_names`` as optional parameter for all ``compas_fab.robots.Configuration`` constructors
2323
* Added ``compas_fab.robots.Configuration.iter_differences``
2424
* Added ``compas_fab.robots.Configuration.max_difference``
2525
* Added ``compas_fab.robots.Configuration.close_to``
@@ -30,7 +30,7 @@ Unreleased
3030

3131
**Changed**
3232

33-
* Updated to ``COMPAS 0.16.1``
33+
* Updated to ``COMPAS 0.16.9``
3434
* Renamed ``compas_fab.robots.Robot.to_local_coords`` to ``compas_fab.robots.Robot.to_local_coordinates``
3535
* Renamed ``compas_fab.robots.Robot.to_world_coords`` to ``compas_fab.robots.Robot.to_world_coordinates``
3636
* Backend clients have been restructured according to the new interfaces

docs/examples/02_description_models/02_robot.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ ROS and render it in Rhino:
8080
<div class="card-title">Downloads</div>
8181

8282
* :download:`Robot artist from ROS (Rhino) (.PY) <files/02_robot_artist_rhino_from_ros.py>`
83+
* :download:`Robot artist from ROS (Grasshopper) (.GHX) <files/02_robot_artist_grasshopper_panda.ghx>`
8384
* :download:`Robot artist from Github (Rhino) (.PY) <files/02_robot_artist_rhino.py>`
8485
* :download:`Robot artist from Github (Blender) (.PY) <files/02_robot_artist_blender.py>`
8586
* :download:`Robot artist from Github (Grasshopper) (.GHX) <files/02_robot_artist_grasshopper.ghx>`

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

Lines changed: 250 additions & 522 deletions
Large diffs are not rendered by default.

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

Lines changed: 2955 additions & 0 deletions
Large diffs are not rendered by default.

docs/examples/03_backends_ros/files/gh_robot_visualisation.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
from __future__ import print_function
2626

2727
if robot and full_configuration:
28-
robot.update(full_configuration, visual=show_visual, collision=show_collision)
28+
group = group or None
29+
robot.update(full_configuration, group, visual=show_visual, collision=show_collision)
2930

3031
print(full_configuration)
3132

@@ -36,8 +37,8 @@
3637
collision = robot.draw_collision()
3738

3839
if show_frames:
39-
axes = robot.transformed_axes(full_configuration)
40-
frames = robot.transformed_frames(full_configuration)
40+
axes = robot.transformed_axes(full_configuration, group)
41+
frames = robot.transformed_frames(full_configuration, group)
4142

4243
if show_base_frame:
4344
base_frame_WCF = robot.get_base_frame(group, full_configuration)

src/compas_fab/robots/configuration.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,10 @@ def has_joint_names(self):
358358
def check_joint_names(self):
359359
"""Raises an error if there is not a joint name for every value."""
360360
if not self.has_joint_names:
361-
raise ValueError('Joint names are required for this operation.')
361+
if not len(self.joint_names):
362+
raise ValueError('Joint names are required for this operation.')
363+
else:
364+
raise ValueError('Joint names do not match the number of joint values. Joint names={}, Joint values={}'.format(len(self.values), len(self.joint_names)))
362365

363366
@property
364367
def joint_dict(self):

src/compas_fab/robots/robot.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,7 @@ def transformed_axes(self, configuration, group=None):
15991599
# drawing
16001600
# ==========================================================================
16011601

1602-
def update(self, configuration, group, visual=True, collision=True):
1602+
def update(self, configuration, group=None, visual=True, collision=True):
16031603
"""Update the robot's geometry.
16041604
16051605
Parameters
@@ -1616,9 +1616,12 @@ def update(self, configuration, group, visual=True, collision=True):
16161616
``True`` if the collision geometry should be also updated, otherwise ``False``.
16171617
Defaults to ``True``.
16181618
"""
1619+
group = group or self.main_group_name if self.semantics else None
1620+
16191621
if not len(configuration.joint_names):
16201622
configuration.joint_names = self.get_configurable_joint_names(group)
16211623
joint_state = dict(zip(configuration.joint_names, configuration.values))
1624+
16221625
self.artist.update(joint_state, visual, collision)
16231626

16241627
def draw_visual(self):

0 commit comments

Comments
 (0)