diff --git a/src/robot_upstart/install_script.py b/src/robot_upstart/install_script.py index facecb4..56433e4 100644 --- a/src/robot_upstart/install_script.py +++ b/src/robot_upstart/install_script.py @@ -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 diff --git a/src/robot_upstart/job.py b/src/robot_upstart/job.py index 28200a5..25d6749 100644 --- a/src/robot_upstart/job.py +++ b/src/robot_upstart/job.py @@ -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 @@ -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. diff --git a/templates/job-start.em b/templates/job-start.em index 4b38679..8808d8d 100644 --- a/templates/job-start.em +++ b/templates/job-start.em @@ -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