Skip to content

Commit

Permalink
Merge pull request #48 from clearpathrobotics/sensor-get-topic
Browse files Browse the repository at this point in the history
Give option to get topic without namespace
  • Loading branch information
tonybaltovski authored Jan 10, 2024
2 parents 195b7ae + 43ef0fe commit 1efa7dc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions clearpath_config/sensors/types/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,15 @@ def set_idx(self, idx: int) -> None:
super().set_idx(idx)
self.topic = self.get_topic_from_idx(idx)

def get_topic(self, topic: str) -> str:
def get_topic(self, topic: str, local=False) -> str:
assert topic in self.TOPICS.NAME, (
"Topic must be one of %s" % [i for i in self.TOPICS.NAME]
)
ns = BaseConfig.get_namespace()
return os.path.join(ns, "sensors", self.name, self.TOPICS.NAME[topic])
if local:
return os.path.join("sensors", self.name, self.TOPICS.NAME[topic])
else:
ns = BaseConfig.get_namespace()
return os.path.join(ns, "sensors", self.name, self.TOPICS.NAME[topic])

def get_topic_rate(self, topic: str) -> float:
assert topic in self.TOPICS.RATE, (
Expand Down

0 comments on commit 1efa7dc

Please sign in to comment.