Skip to content

Commit 9471113

Browse files
authored
Merge pull request #26 from benmaidel/feature/instance_id
set instance_id default to -1 and set ENV INSTANCE_ID if instance_id >=0
2 parents 6b54a91 + 85030e5 commit 9471113

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

robmuxinator/robmuxinator.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ def main():
806806
"--instance_id",
807807
type=int,
808808
help="an unique id used to prepend to each session name within the config file. used for multi-robot emulation. the instance_id is also exported to the env used within the sessions as well as to guarantee a unique ROS_DOMAIN_ID",
809-
default=0,
809+
default=-1,
810810
)
811811

812812
argcomplete.autocomplete(parser)
@@ -897,9 +897,8 @@ def main():
897897
# Check if 'instance_id' was given by the user.
898898
# This indicates the a multi-instance setup, e.g. for multi-robot emulation.
899899
# Therefore we export the INSTANCE_ID and use it for to guarantee a unique ROS_DOMAIN_ID
900-
if instance_id != 0:
900+
if instance_id >= 0:
901901
envs.append(("INSTANCE_ID", instance_id))
902-
envs.append(("ROS_DOMAIN_ID", instance_id))
903902

904903
# get sessions from yaml
905904
yaml_sessions = None
@@ -932,7 +931,7 @@ def main():
932931
sessions.append(
933932
Session(
934933
SSHClient(user=user, hostname=hosts[host].get_hostname(), port=hosts[host].get_ssh_port()),
935-
str(instance_id) + "_" + key if instance_id != 0 else key,
934+
str(instance_id) + "_" + key if instance_id > 0 else key,
936935
yaml_sessions[key],
937936
envs
938937
)
@@ -941,7 +940,7 @@ def main():
941940
sessions.append(
942941
Session(
943942
SSHClient(user=user, hostname=hosts[host].get_hostname(), port=hosts[host].get_ssh_port()),
944-
str(instance_id) + "_" + key if instance_id != 0 else key,
943+
str(instance_id) + "_" + key if instance_id > 0 else key,
945944
yaml_sessions[key],
946945
envs
947946
)

0 commit comments

Comments
 (0)