Skip to content

Commit

Permalink
[ros_bridge][py] Add back CollisionDetector as an option.
Browse files Browse the repository at this point in the history
Now that RTCs to activate is selectable from the end client (e.g. hironx.py), we need to expose all RTCs available.

[ros_bridge][test][py] Refactoring.
  • Loading branch information
130s committed Apr 29, 2017
1 parent 94196e7 commit c1b90d7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
19 changes: 17 additions & 2 deletions hironx_ros_bridge/src/hironx_ros_bridge/hironx_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,25 @@ class via the link above; nicely formatted api doc web page
# This shouldn't be accessed once turned to True during `init` method.
is_rtc_activated = False

# Default set of RTCs to be activated.
_RTC_list = [
['seq', "SequencePlayer"],
['sh', "StateHolder"],
['fk', "ForwardKinematics"],
['ic', "ImpedanceController"],
['el', "SoftErrorLimiter"],
# ['co', "CollisionDetector"],
['sc', "ServoController"],
['log', "DataLogger"],
]

# All available RTCs. This list is meant to be immutable.
RTCs_all_available = [
['seq', "SequencePlayer"],
['sh', "StateHolder"],
['fk', "ForwardKinematics"],
['ic', "ImpedanceController"],
['el', "SoftErrorLimiter"],
['co', "CollisionDetector"],
['sc', "ServoController"],
['log', "DataLogger"],
]
Expand Down Expand Up @@ -491,8 +503,11 @@ def getRTCList(self, rtcs_str=None):
if not all(x in rtcs_req_list for x in self._RTC_NAME_MINREQ):
raise ValueError('{} are required at minimum'.format(
self._RTC_NAME_MINREQ))

# Create a new list of requested RTC with the name of
# implementations.
for rtc_requested in rtcs_req_list:
for elem in self._RTC_list:
for elem in self.RTCs_all_available:
if elem[0] == rtc_requested:
new_rtcs.append(elem)
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,6 @@

class TestHiroClient(TestHiro):

_RTC_LIST = [
['seq', "SequencePlayer"],
['sh', "StateHolder"],
['fk', "ForwardKinematics"],
['ic', "ImpedanceController"],
['el', "SoftErrorLimiter"],
['sc', "ServoController"],
['log', "DataLogger"],
# rmfo will be automatically added in getRTCList.
['rmfo', 'RemoveForceSensorLinkOffset']
]

_RTC_LIST_CUSTOM = [
['seq', "SequencePlayer"],
['sh', "StateHolder"],
Expand Down Expand Up @@ -80,7 +68,9 @@ def test_getRTCList(self):
'''
self.assertTrue(
self._compare_2dlist(
self.robot.getRTCList(), self._RTC_LIST))
self.robot.getRTCList(),
# Accessing a private member var only for testing purpose.
self.robot._RTC_list))

def test_getRTCList_customrtcs_args_correct(self):
'''
Expand Down

0 comments on commit c1b90d7

Please sign in to comment.