-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate lerp function from dwa_planner to wheel_stuck_utils
Signed-off-by: Autumn60 <[email protected]>
- Loading branch information
Showing
3 changed files
with
20 additions
and
9 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
src/common/wheel_stuck_utils/include/wheel_stuck_utils/math/math.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,15 @@ | ||
#ifndef WHEEL_STUCK_UTILS__MATH__MATH_HPP_ | ||
#define WHEEL_STUCK_UTILS__MATH__MATH_HPP_ | ||
|
||
#include <algorithm> | ||
|
||
namespace wheel_stuck_utils::math | ||
{ | ||
inline double lerp(const double a, const double b, double t) | ||
{ | ||
t = std::max(0.0, std::min(1.0, t)); | ||
return a + t * (b - a); | ||
} | ||
} // namespace wheel_stuck_utils::math | ||
|
||
#endif // WHEEL_STUCK_UTILS__MATH__MATH_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
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