Skip to content

Commit

Permalink
map parameter added
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Shalnov committed Jun 30, 2021
1 parent 875f75e commit 0d90749
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/robot_upstart/install_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def get_argument_parser():
"of the generated Systemd service file")
p.add_argument("--model", type=str, metavar="MODEL",
help="Specify the model of your robot if not specified under ROBOT_MODEL")
p.add_argument("--map_name", type=str, metavar="MODEL",
help="Specify the map name for your robot")

return p

Expand Down
10 changes: 9 additions & 1 deletion src/robot_upstart/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Job(object):
""" Represents a ROS configuration to launch on machine startup. """

def __init__(self, name="ros", interface=None, user=None, workspace_setup=None,
rosdistro=None, master_uri=None, log_path=None, model=None, systemd_after=None):
rosdistro=None, master_uri=None, log_path=None, model=None, map_name=None, systemd_after=None):
"""Construct a new Job definition.
:param name: Name of job to create. Defaults to "ros", but you might
Expand Down Expand Up @@ -121,6 +121,14 @@ def __init__(self, name="ros", interface=None, user=None, workspace_setup=None,
except KeyError:
self.model = name.upper() + '_MODEL=ROBOT'

if map_name:
self.map_name = name.upper() + '_MAP=' + map_name
else:
try:
self.map_name = name.upper() + '_MAP=' + os.environ[name.upper() + '_MAP']
except KeyError:
self.map_name = name.upper() + '_MAP=ROBOT'

def add(self, package=None, filename=None, glob=None):
""" Add launch or other configuration files to Job.
Expand Down
3 changes: 3 additions & 0 deletions templates/job-start.em
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ export ROS_MASTER_URI=http://127.0.0.1:11311
@[if model]@
export @(model)
@[end if]@
@[if map_name]@
export @(map_name)
@[end if]@
export ROS_HOME=${ROS_HOME:=$(echo ~@(user))/.ros}
export ROS_LOG_DIR=$log_path

Expand Down

0 comments on commit 0d90749

Please sign in to comment.