Skip to content

Commit

Permalink
Renamed passthrough dataclass to TopicMapping in passthrough
Browse files Browse the repository at this point in the history
  • Loading branch information
vinzenzm authored Nov 21, 2024
1 parent 4fb8afb commit 9cb4c9e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions code/acting/src/acting/passthrough.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


@dataclass
class passthrough:
class TopicMapping:
pub_name: str
sub_name: str
topic_type: Type
Expand All @@ -28,34 +28,34 @@ class Passthrough(CompatibleNode):
role_name = "hero" # Legacy will change soon

# Topics for velocity controller.
target_velocity = passthrough(
target_velocity = TopicMapping(
pub_name="/paf/acting/target_velocity",
sub_name=f"/paf/{role_name}/target_velocity",
topic_type=Float32,
)
# Topics for steering controllers
trajectory = passthrough(
trajectory = TopicMapping(
pub_name="/paf/acting/trajectory",
sub_name=f"/paf/{role_name}/trajectory",
topic_type=Path,
)
position = passthrough(
position = TopicMapping(
pub_name="/paf/acting/current_pos",
sub_name=f"/paf/{role_name}/current_pos",
topic_type=PoseStamped,
)
heading = passthrough(
heading = TopicMapping(
pub_name="/paf/acting/current_heading",
sub_name=f"/paf/{role_name}/current_heading",
topic_type=Float32,
)

passthrough_topics = [target_velocity, trajectory, position, heading]
mapped_topics = [target_velocity, trajectory, position, heading]

def __init__(self):
self.publishers: Dict[str, Publisher] = {}
self.subscribers: Dict[str, Subscriber] = {}
for topic in self.passthrough_topics:
for topic in self.mapped_topics:
self.publishers[topic.pub_name] = self.new_publisher(
topic.topic_type, topic.pub_name, qos_profile=1
)
Expand Down

0 comments on commit 9cb4c9e

Please sign in to comment.