-
Notifications
You must be signed in to change notification settings - Fork 683
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(obstacle_cruies_planner): improve pid_based cruise planner (#2507)
* feat(obstacle_cruies_planner): improve pid_based cruise planner Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * fix Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * update param in tier4_planning_launch Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
- Loading branch information
1 parent
fc1d820
commit 9ecc3a2
Showing
12 changed files
with
939 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
..._planner/include/obstacle_cruise_planner/pid_based_planner/cruise_planning_debug_info.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// Copyright 2022 TIER IV, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef OBSTACLE_CRUISE_PLANNER__PID_BASED_PLANNER__CRUISE_PLANNING_DEBUG_INFO_HPP_ | ||
#define OBSTACLE_CRUISE_PLANNER__PID_BASED_PLANNER__CRUISE_PLANNING_DEBUG_INFO_HPP_ | ||
|
||
#include <rclcpp/rclcpp.hpp> | ||
|
||
#include "tier4_debug_msgs/msg/float32_multi_array_stamped.hpp" | ||
|
||
#include <array> | ||
|
||
using tier4_debug_msgs::msg::Float32MultiArrayStamped; | ||
|
||
class CruisePlanningDebugInfo | ||
{ | ||
public: | ||
enum class TYPE { | ||
// ego | ||
EGO_VELOCITY = 0, // index: 0 | ||
EGO_ACCELERATION, | ||
EGO_JERK, // no data | ||
|
||
// cruise planning | ||
CRUISE_CURRENT_OBSTACLE_DISTANCE_RAW, // index: 3 | ||
CRUISE_CURRENT_OBSTACLE_DISTANCE_FILTERED, | ||
CRUISE_CURRENT_OBSTACLE_VELOCITY_RAW, | ||
CRUISE_CURRENT_OBSTACLE_VELOCITY_FILTERED, | ||
CRUISE_TARGET_OBSTACLE_DISTANCE, | ||
CRUISE_ERROR_DISTANCE_RAW, | ||
CRUISE_ERROR_DISTANCE_FILTERED, | ||
|
||
CRUISE_RELATIVE_EGO_VELOCITY, // index: 10 | ||
CRUISE_TIME_TO_COLLISION, | ||
|
||
CRUISE_TARGET_VELOCITY, // index: 12 | ||
CRUISE_TARGET_ACCELERATION, | ||
CRUISE_TARGET_JERK_RATIO, | ||
|
||
SIZE | ||
}; | ||
|
||
/** | ||
* @brief get the index corresponding to the given value TYPE | ||
* @param [in] type the TYPE enum for which to get the index | ||
* @return index of the type | ||
*/ | ||
int getIndex(const TYPE type) const { return static_cast<int>(type); } | ||
|
||
/** | ||
* @brief get all the debug values as an std::array | ||
* @return array of all debug values | ||
*/ | ||
std::array<double, static_cast<int>(TYPE::SIZE)> get() const { return info_; } | ||
|
||
/** | ||
* @brief set the given type to the given value | ||
* @param [in] type TYPE of the value | ||
* @param [in] value value to set | ||
*/ | ||
void set(const TYPE type, const double val) { info_.at(static_cast<int>(type)) = val; } | ||
|
||
/** | ||
* @brief set the given type to the given value | ||
* @param [in] type index of the type | ||
* @param [in] value value to set | ||
*/ | ||
void set(const int type, const double val) { info_.at(type) = val; } | ||
|
||
void reset() { info_.fill(0.0); } | ||
|
||
Float32MultiArrayStamped convertToMessage(const rclcpp::Time & current_time) const | ||
{ | ||
Float32MultiArrayStamped msg{}; | ||
msg.stamp = current_time; | ||
for (const auto & v : get()) { | ||
msg.data.push_back(v); | ||
} | ||
return msg; | ||
} | ||
|
||
private: | ||
std::array<double, static_cast<int>(TYPE::SIZE)> info_; | ||
}; | ||
|
||
#endif // OBSTACLE_CRUISE_PLANNER__PID_BASED_PLANNER__CRUISE_PLANNING_DEBUG_INFO_HPP_ |
Oops, something went wrong.