Skip to content

Commit 9a378dc

Browse files
committed
Initialize last_update_ in SimRobot
1 parent d7adff9 commit 9a378dc

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/mower_simulation/src/SimRobot.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ void SimRobot::GetIsCharging(bool& charging, double& seconds_since_start, std::s
127127
void SimRobot::SimulationStep(const ros::TimerEvent& te) {
128128
std::lock_guard<std::mutex> lk{state_mutex_};
129129
const auto now = ros::Time::now();
130+
if (last_update_.isZero()) {
131+
last_update_ = now;
132+
PublishPosition();
133+
return;
134+
}
130135
// Update Position if not in emergency mode
131136
if (!emergency_latch_) {
132137
double time_diff_s = (now - last_update_).toSec();

0 commit comments

Comments
 (0)