Skip to content

Commit

Permalink
rearranged subscribers/publishers
Browse files Browse the repository at this point in the history
  • Loading branch information
TiaSinghania committed Dec 24, 2024
1 parent 2959138 commit a537b88
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions rb_ws/src/buggy/buggy/simulator/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,7 @@ def __init__(self):
"RACELINE_PASS": (589468.02, 4476993.07, -160),
}

# for X11 matplotlib (direction included)
self.plot_publisher = self.create_publisher(Pose, "sim_2d/utm", 1)

# simulate the INS's outputs (noise included)
self.pose_publisher = self.create_publisher(Odometry, "nav/odom", 1)

self.steering_subscriber = self.create_subscription(
Float64, "buggy/input/steering", self.update_steering_angle, 1
)

self.navsatfix_noisy_publisher = self.create_publisher(
NavSatFix, "state/pose_navsat_noisy", 1
)

# To read from velocity
self.velocity_subscriber = self.create_subscription(
Float64, "velocity", self.update_velocity, 1
)


self.declare_parameter('velocity', 12)

if (self.get_namespace() == "/SC"):
self.buggy_name = "SC"
self.declare_parameter('pose', "Hill1_SC")
Expand All @@ -83,6 +62,25 @@ def __init__(self):
timer_period = 1/self.rate # seconds
self.timer = self.create_timer(timer_period, self.loop)

self.steering_subscriber = self.create_subscription(
Float64, "buggy/input/steering", self.update_steering_angle, 1
)

# To read from velocity
self.velocity_subscriber = self.create_subscription(
Float64, "velocity", self.update_velocity, 1
)

# for X11 matplotlib (direction included)
self.plot_publisher = self.create_publisher(Pose, "sim_2d/utm", 1)

# simulate the INS's outputs (noise included)
self.pose_publisher = self.create_publisher(Odometry, "nav/odom", 1)

self.navsatfix_noisy_publisher = self.create_publisher(
NavSatFix, "state/pose_navsat_noisy", 1
)

def update_steering_angle(self, data: Float64):
with self.lock:
self.steering_angle = data.data
Expand Down

0 comments on commit a537b88

Please sign in to comment.