Skip to content

Commit

Permalink
Fix mowing path on ros disconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
cedbossneo committed Jun 21, 2024
1 parent cc448fd commit 8ba824a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/providers/ros.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ func NewRosProvider(dbProvider types2.IDBProvider) types2.IRosProvider {
if err != nil {
logrus.Error(xerrors.Errorf("failed to init subscribers: %w", err))
}
err = r.initMowingPathSubscriber()
if err != nil {
logrus.Error(xerrors.Errorf("failed to init mowing path subscriber: %w", err))
}
}
}
}()
Expand Down Expand Up @@ -182,6 +186,15 @@ func (p *RosProvider) resetSubscribers() {
p.statusSubscriber = nil
p.ticksSubscriber = nil
p.poseSubscriber = nil
p.mowingPaths = []*nav_msgs.Path{}
p.mowingPath = nil
p.mowingPathOrigin = nil
xbPose := p.subscribers["/xbot_positioning/xb_pose"]
if xbPose != nil {
for _, sub := range xbPose {
sub.Close()
}
}
}

func (p *RosProvider) initMowingPathSubscriber() error {
Expand Down

0 comments on commit 8ba824a

Please sign in to comment.