File tree 4 files changed +28
-1
lines changed
behavior_velocity_planner_common
include/behavior_velocity_planner_common
4 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,7 @@ class SceneModuleInterface
87
87
boost::optional<int > getFirstStopPathPointIndex () { return first_stop_path_point_index_; }
88
88
89
89
void setActivation (const bool activated) { activated_ = activated; }
90
+ void setRTCEnabled (const bool enable_rtc) { rtc_enabled_ = enable_rtc; }
90
91
bool isActivated () const { return activated_; }
91
92
bool isSafe () const { return safe_; }
92
93
double getDistance () const { return distance_; }
@@ -98,6 +99,7 @@ class SceneModuleInterface
98
99
const int64_t module_id_;
99
100
bool activated_;
100
101
bool safe_;
102
+ bool rtc_enabled_;
101
103
double distance_;
102
104
rclcpp::Logger logger_;
103
105
rclcpp::Clock::SharedPtr clock_;
@@ -106,8 +108,15 @@ class SceneModuleInterface
106
108
boost::optional<int > first_stop_path_point_index_;
107
109
VelocityFactorInterface velocity_factor_;
108
110
109
- void setSafe (const bool safe) { safe_ = safe; }
111
+ void setSafe (const bool safe)
112
+ {
113
+ safe_ = safe;
114
+ if (!rtc_enabled_) {
115
+ syncActivation ();
116
+ }
117
+ }
110
118
void setDistance (const double distance) { distance_ = distance; }
119
+ void syncActivation () { setActivation (isSafe ()); }
111
120
112
121
size_t findEgoSegmentIndex (
113
122
const std::vector<autoware_auto_planning_msgs::msg::PathPointWithLaneId> & points) const ;
Original file line number Diff line number Diff line change @@ -218,6 +218,7 @@ void SceneModuleManagerInterfaceWithRTC::setActivation()
218
218
for (const auto & scene_module : scene_modules_) {
219
219
const UUID uuid = getUUID (scene_module->getModuleId ());
220
220
scene_module->setActivation (rtc_interface_.isActivated (uuid));
221
+ scene_module->setRTCEnabled (rtc_interface_.isRTCEnabled (uuid));
221
222
}
222
223
}
223
224
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ class RTCInterface
55
55
void clearCooperateStatus ();
56
56
bool isActivated (const UUID & uuid) const ;
57
57
bool isRegistered (const UUID & uuid) const ;
58
+ bool isRTCEnabled (const UUID & uuid) const ;
58
59
void lockCommandUpdate ();
59
60
void unlockCommandUpdate ();
60
61
Original file line number Diff line number Diff line change @@ -280,6 +280,22 @@ bool RTCInterface::isRegistered(const UUID & uuid) const
280
280
return itr != registered_status_.statuses .end ();
281
281
}
282
282
283
+ bool RTCInterface::isRTCEnabled (const UUID & uuid) const
284
+ {
285
+ std::lock_guard<std::mutex> lock (mutex_);
286
+ const auto itr = std::find_if (
287
+ registered_status_.statuses .begin (), registered_status_.statuses .end (),
288
+ [uuid](auto & s) { return s.uuid == uuid; });
289
+
290
+ if (itr != registered_status_.statuses .end ()) {
291
+ return !itr->auto_mode ;
292
+ }
293
+
294
+ RCLCPP_WARN_STREAM (
295
+ getLogger (), " [isRTCEnabled] uuid : " << to_string (uuid) << " is not found." << std::endl);
296
+ return is_auto_mode_init_;
297
+ }
298
+
283
299
void RTCInterface::lockCommandUpdate ()
284
300
{
285
301
is_locked_ = true ;
You can’t perform that action at this time.
0 commit comments