Skip to content

Commit

Permalink
[ros_bridge][py] Accept a list of custom RTCs to activate (fix tork-a…
Browse files Browse the repository at this point in the history
…#308).

This requires the upstream change start-jsk/rtmros_hironx#497
  • Loading branch information
130s committed Apr 29, 2017
1 parent e4c384f commit 7111bcd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion nextage_ros_bridge/script/nextage.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
' this script, but can use RTM. To use ROS, do not forget' \
' to run rosbridge. How to do so? --> http://wiki.ros.org/rtmros_nextage/Tutorials/Operating%20Hiro%2C%20NEXTAGE%20OPEN'

# The default RTCs for Hironx
RTC_LIST = 'seq, sh, fk, el, log'

if __name__ == '__main__':
parser = argparse.ArgumentParser(description='hiro command line interpreters')
parser.add_argument('--host', help='corba name server hostname')
Expand All @@ -59,6 +62,8 @@
parser.add_argument('--dio_ver', help="Version of digital I/O. Only users "
"whose robot was shipped before Aug 2014 need to "
"define this, and the value should be '0.4.2'.")
parser.add_argument('--rtcs', help="RT components to activate. If nothing passed then default value will be used. Example: '{}'".format(RTC_LIST))

args, unknown = parser.parse_known_args()

if args.host:
Expand All @@ -69,6 +74,8 @@
args.robot = "RobotHardware0" if args.host else "HiroNX(Robot)0"
if not args.modelfile:
args.modelfile = "/opt/jsk/etc/NEXTAGE/model/main.wrl" if args.host else ""
if not args.rtcs:
args.rtcs = RTC_LIST

# support old style format
if len(unknown) >= 2:
Expand All @@ -80,7 +87,7 @@
# them to specifically tell what robot they're using (eg. hiro, nxc).
# This is backward compatible so that users can still keep using `nxc`.
# See http://code.google.com/p/rtm-ros-robotics/source/detail?r=6926
robot.init(robotname=args.robot, url=args.modelfile)
robot.init(robotname=args.robot, url=args.modelfile, rtcs=args.rtcs)

if args.dio_ver:
robot.set_hand_version(args.dio_ver)
Expand Down
4 changes: 2 additions & 2 deletions nextage_ros_bridge/src/nextage_ros_bridge/nextage_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def __init__(self):
self.configurator_name = "gazebo(Nextage)"
self.set_hand_version(self.HAND_VER_0_5_1)

def init(self, robotname="HiroNX(Robot)0", url=""):
def init(self, robotname="HiroNX(Robot)0", url="", rtcs=None):
'''
Calls init from its superclass, which tries to connect RTCManager,
looks for ModelLoader, and starts necessary RTC components. Also runs
Expand All @@ -106,7 +106,7 @@ def init(self, robotname="HiroNX(Robot)0", url=""):
@type url: str
'''
if not self.use_gazebo:
HIRONX.init(self, robotname=robotname, url=url)
HIRONX.init(self, robotname=robotname, url=url, rtcs=rtcs)

def get_hand_version(self):
'''
Expand Down

0 comments on commit 7111bcd

Please sign in to comment.