support stand alone sch
This commit is contained in:
@@ -378,6 +378,7 @@ private:
|
||||
|
||||
/** Handle Trigger type rebuild request */
|
||||
void HandleTriggerRebuild(
|
||||
const std::shared_ptr<interfaces::srv::BtRebuild::Request> req,
|
||||
const std::shared_ptr<interfaces::srv::BtRebuild::Response> resp);
|
||||
|
||||
/** Handle Remote type rebuild request */
|
||||
|
||||
@@ -1026,7 +1026,7 @@ void CerebrumNode::CreateServices()
|
||||
}
|
||||
|
||||
if (req->type == "Trigger") {
|
||||
HandleTriggerRebuild(resp);
|
||||
HandleTriggerRebuild(req, resp);
|
||||
} else if (req->type == "Remote") {
|
||||
HandleRemoteRebuild(req, resp);
|
||||
} else if (req->type == "Local") {
|
||||
@@ -1054,11 +1054,18 @@ void CerebrumNode::CreateServices()
|
||||
* @param resp
|
||||
*/
|
||||
void CerebrumNode::HandleTriggerRebuild(
|
||||
const std::shared_ptr<interfaces::srv::BtRebuild::Request> req,
|
||||
const std::shared_ptr<interfaces::srv::BtRebuild::Response> resp)
|
||||
{
|
||||
for (const auto & path_param : bt_config_params_paths_) {
|
||||
// path_param is a pair {config, param}; compare the config path string against the current path
|
||||
if (path_param.config == current_bt_config_params_path_.config) {
|
||||
// if (path_param.config == current_bt_config_params_path_.config) {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
std::string sch_filename = ExtractFilenameWithoutExtension(path_param.config);
|
||||
if (sch_filename != req->config) {
|
||||
RCLCPP_WARN(this->get_logger(), "cerebrum/rebuild_now Service INVALID config: %s, local: %s", req->config.c_str(), sch_filename.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1066,9 +1073,9 @@ void CerebrumNode::HandleTriggerRebuild(
|
||||
current_bt_config_params_path_ = path_param;
|
||||
|
||||
// Update working info
|
||||
std::string scheduled = ExtractFilenameWithoutExtension(path_param.config);
|
||||
// std::string scheduled = ExtractFilenameWithoutExtension(path_param.config);
|
||||
if (robot_work_info_.task.size() > 2) {
|
||||
robot_work_info_.task[2] = scheduled; // current
|
||||
robot_work_info_.task[2] = sch_filename; // current
|
||||
}
|
||||
|
||||
RCLCPP_WARN(this->get_logger(), "cerebrum/rebuild_now Service Switching to BT config file path: %s", path_param.config.c_str());
|
||||
|
||||
Reference in New Issue
Block a user