Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add robot name and type args in app_manager #54

Open
wants to merge 4 commits into
base: kinetic-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions launch/app_manager.launch
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,21 @@
<arg name="sigint_timeout" default="15.0" doc="Time between sending sigint and sending sigterm to ROSLaunchParent"/>
<arg name="sigterm_timeout" default="2.0" doc="Time between sending sigterm and sending sigkill to ROSLaunchParent"/>

<!-- node name -->
<arg name="master_node_name" default="appmaster" />
<arg name="manager_node_name" default="app_manager" />
<!-- app list -->
<arg name="use_applist" default="false" doc="load apps from applist argument"/>
<arg name="applist" default="" doc="app dirs (space separated)"/>

<!-- robot_name -->
<arg name="use_robot_name" default="false" doc="load robot_name from argument"/>
<arg name="robot_name" default="" doc="robot name"/>

<!-- robot_type -->
<arg name="use_robot_type" default="false" doc="load robot_type from argument"/>
<arg name="robot_type" default="" doc="robot type"/>

<!-- respawn -->
<arg name="respawn" default="false" doc="respawn app_manager"/>

Expand All @@ -20,13 +31,21 @@
doc="Enable name remapping of topic written in interface to app_manager namespace , or not" />

<!-- internal use -->
<arg name="app_manager_args" default="--applist $(arg applist)" if="$(arg use_applist)"/>
<arg name="app_manager_args" default="" unless="$(arg use_applist)"/>
<arg name="applist_args" default="--applist $(arg applist)" if="$(arg use_applist)"/>
<arg name="applist_args" default="" unless="$(arg use_applist)"/>
<arg name="robot_name_args" default="--robot-name $(arg robot_name)"
if="$(arg use_robot_name)"/>
<arg name="robot_name_args" default=""
unless="$(arg use_robot_name)"/>
<arg name="robot_type_args" default="--robot-type $(arg robot_type)"
if="$(arg use_robot_type)"/>
<arg name="robot_type_args" default=""
unless="$(arg use_robot_type)"/>

<node pkg="app_manager" type="appmaster" name="appmaster"
<node pkg="app_manager" type="appmaster" name="$(arg master_node_name)"
args="-p $(arg master_port)" if="$(arg master)" respawn="$(arg respawn)"/>
<node pkg="app_manager" type="app_manager" name="app_manager"
args="$(arg app_manager_args)"
<node pkg="app_manager" type="app_manager" name="$(arg manager_node_name)"
args="$(arg applist_args) $(arg robot_name_args) $(arg robot_type_args)"
output="screen" respawn="$(arg respawn)">
<rosparam subst_value="true">
interface_master: http://$(arg master_address):$(arg master_port)
Expand Down
18 changes: 14 additions & 4 deletions scripts/app_manager
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def main():

parser.add_argument("--applist", default=None, nargs="*",
help="path to applist directories", metavar="PATH")
parser.add_argument("--robot-name", default=None, help="robot name")
parser.add_argument("--robot-type", default=None, help="robot type")
args = parser.parse_args(argv[1:])

applist = []
Expand Down Expand Up @@ -62,15 +64,23 @@ def main():
plugin = yaml.safe_load(f)
plugins += plugin

robot_name = rospy.get_param('/robot/name', 'robot')
robot_type = rospy.get_param("/robot/type", None)
sigint_timeout = rospy.get_param("~sigint_timeout", 15.0)
sigterm_timeout = rospy.get_param("~sigterm_timeout", 2.0)
if args.robot_name is None:
robot_name = rospy.get_param('/robot/name', 'robot')
else:
robot_name = args.robot_name

if args.robot_type is None:
robot_type = rospy.get_param("/robot/type", None)
else:
robot_type = args.robot_type

if robot_type is None:
rospy.loginfo("The param '/robot/type' is undefined. Using apps for any platforms")
else:
rospy.loginfo("Using apps for platform '%s'" % robot_type)

sigint_timeout = rospy.get_param("~sigint_timeout", 15.0)
sigterm_timeout = rospy.get_param("~sigterm_timeout", 2.0)
interface_master = rospy.get_param('~interface_master', 'http://localhost:11312')

try:
Expand Down