Skip to content

Commit

Permalink
Merge branch 'main' into temp/build_and_test_diff_exp_2
Browse files Browse the repository at this point in the history
  • Loading branch information
Autumn60 authored Jul 28, 2024
2 parents 8227afe + acc6521 commit c2727e0
Show file tree
Hide file tree
Showing 23 changed files with 52 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
src/common/wheel_stuck_utils/** @Autumn60 @Bey9434
src/common/wheel_stuck_common_utils/** @Autumn60 @Bey9434
src/control/joy2twist/** @Bey9434
src/perception/velodyne_cloud_separator/** @Autumn60
src/planning/dwa_planner/** @Autumn60
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ repos:
exclude: .cu

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.0
rev: 0.29.1
hooks:
- id: check-metaschema
files: ^.+/schema/.*schema\.json$
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.5)
project(wheel_stuck_utils)
project(wheel_stuck_common_utils)

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
Expand All @@ -18,9 +18,9 @@ if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()

ament_auto_add_gtest(test_wheel_stuck_utils test/test_wheel_stuck_utils.cpp)
ament_auto_add_gtest(test_wheel_stuck_common_utils test/test_wheel_stuck_common_utils.cpp)
file(GLOB TEST_SOURCES "test/**/*.cpp")
target_sources(test_wheel_stuck_utils PRIVATE ${TEST_SOURCES})
target_sources(test_wheel_stuck_common_utils PRIVATE ${TEST_SOURCES})
endif()

ament_auto_package()
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef WHEEL_STUCK_UTILS__MATH__MATH_HPP_
#define WHEEL_STUCK_UTILS__MATH__MATH_HPP_
#ifndef WHEEL_STUCK_COMMON_UTILS__MATH__MATH_HPP_
#define WHEEL_STUCK_COMMON_UTILS__MATH__MATH_HPP_

#include <algorithm>

namespace wheel_stuck_utils::math
namespace wheel_stuck_common_utils::math
{
inline double clamp01(const double value)
{
Expand Down Expand Up @@ -79,6 +79,6 @@ inline T max(T b, Args... args)
return std::max(b, max(args...));
}

} // namespace wheel_stuck_utils::math
} // namespace wheel_stuck_common_utils::math

#endif // WHEEL_STUCK_UTILS__MATH__MATH_HPP_
#endif // WHEEL_STUCK_COMMON_UTILS__MATH__MATH_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef WHEEL_STUCK_UTILS__ROS__FUNCTION_TIMER_HPP_
#define WHEEL_STUCK_UTILS__ROS__FUNCTION_TIMER_HPP_
#ifndef WHEEL_STUCK_COMMON_UTILS__ROS__FUNCTION_TIMER_HPP_
#define WHEEL_STUCK_COMMON_UTILS__ROS__FUNCTION_TIMER_HPP_

#include <rclcpp/rclcpp.hpp>

#include <memory>
#include <utility>

namespace wheel_stuck_utils::ros
namespace wheel_stuck_common_utils::ros
{

class FunctionTimer
Expand Down Expand Up @@ -51,6 +51,6 @@ class FunctionTimer
}
};

} // namespace wheel_stuck_utils::ros
} // namespace wheel_stuck_common_utils::ros

#endif // WHEEL_STUCK_UTILS__ROS__FUNCTION_TIMER_HPP_
#endif // WHEEL_STUCK_COMMON_UTILS__ROS__FUNCTION_TIMER_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef WHEEL_STUCK_UTILS__ROS__NO_CALLBACK_SUBSCRIPTION_HPP_
#define WHEEL_STUCK_UTILS__ROS__NO_CALLBACK_SUBSCRIPTION_HPP_
#ifndef WHEEL_STUCK_COMMON_UTILS__ROS__NO_CALLBACK_SUBSCRIPTION_HPP_
#define WHEEL_STUCK_COMMON_UTILS__ROS__NO_CALLBACK_SUBSCRIPTION_HPP_

#include <rclcpp/rclcpp.hpp>

#include <memory>
#include <string>

namespace wheel_stuck_utils::ros
namespace wheel_stuck_common_utils::ros
{

template <typename TMessage>
Expand Down Expand Up @@ -60,6 +60,6 @@ class NoCallbackSubscription
}
};

} // namespace wheel_stuck_utils::ros
} // namespace wheel_stuck_common_utils::ros

#endif // WHEEL_STUCK_UTILS__ROS__NO_CALLBACK_SUBSCRIPTION_HPP_
#endif // WHEEL_STUCK_COMMON_UTILS__ROS__NO_CALLBACK_SUBSCRIPTION_HPP_
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>wheel_stuck_utils</name>
<name>wheel_stuck_common_utils</name>
<version>0.1.0</version>
<description>The wheel_stuck_utils package</description>
<description>The wheel_stuck_common_utils package</description>
<maintainer email="[email protected]">Akiro Harada</maintainer>

<license>Apache 2</license>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "wheel_stuck_utils/math/math.hpp"
#include "wheel_stuck_common_utils/math/math.hpp"

#include <gtest/gtest.h>

TEST(clamp01, clamp01)
{
using wheel_stuck_utils::math::clamp01;
using wheel_stuck_common_utils::math::clamp01;

EXPECT_DOUBLE_EQ(clamp01(0.5), 0.5);
EXPECT_DOUBLE_EQ(clamp01(1.5), 1.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "wheel_stuck_utils/math/math.hpp"
#include "wheel_stuck_common_utils/math/math.hpp"

#include <gtest/gtest.h>

TEST(inverse_lerp, inverse_lerp)
{
using wheel_stuck_utils::math::inverse_lerp;
using wheel_stuck_common_utils::math::inverse_lerp;

EXPECT_DOUBLE_EQ(inverse_lerp(0.0, 10.0, 5), 0.5);
EXPECT_DOUBLE_EQ(inverse_lerp(0.0, 10.0, 15.0), 1.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "wheel_stuck_utils/math/math.hpp"
#include "wheel_stuck_common_utils/math/math.hpp"

#include <gtest/gtest.h>

TEST(lerp, lerp)
{
using wheel_stuck_utils::math::lerp;
using wheel_stuck_common_utils::math::lerp;

EXPECT_DOUBLE_EQ(lerp(0.0, 10.0, 0.5), 5.0);
EXPECT_DOUBLE_EQ(lerp(0.0, 10.0, 1.5), 10.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "wheel_stuck_utils/math/math.hpp"
#include "wheel_stuck_common_utils/math/math.hpp"

#include <gtest/gtest.h>

TEST(max, max)
{
using wheel_stuck_utils::math::max;
using wheel_stuck_common_utils::math::max;

EXPECT_EQ(max(5), 5);
EXPECT_EQ(max(5, 2, 8, -1), 8);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "wheel_stuck_utils/math/math.hpp"
#include "wheel_stuck_common_utils/math/math.hpp"

#include <gtest/gtest.h>

TEST(min, min)
{
using wheel_stuck_utils::math::min;
using wheel_stuck_common_utils::math::min;

EXPECT_EQ(min(5), 5);
EXPECT_EQ(min(5, 2, 8, -1), -1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "wheel_stuck_utils/math/math.hpp"
#include "wheel_stuck_common_utils/math/math.hpp"

#include <gtest/gtest.h>

TEST(sign, sign)
{
using wheel_stuck_utils::math::sign;
using wheel_stuck_common_utils::math::sign;

EXPECT_EQ(sign(0), 0);
EXPECT_EQ(sign(1), 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "pcl/point_types.hpp"

#include <rclcpp/rclcpp.hpp>
#include <wheel_stuck_utils/ros/no_callback_subscription.hpp>
#include <wheel_stuck_common_utils/ros/no_callback_subscription.hpp>

#include <sensor_msgs/msg/point_cloud2.hpp>

Expand All @@ -34,7 +34,7 @@ namespace velodyne_cloud_separator
using PointXYZIR = pcl::PointXYZIR;
using PointCloud2 = sensor_msgs::msg::PointCloud2;

using PointCloud2Subscription = wheel_stuck_utils::ros::NoCallbackSubscription<PointCloud2>;
using PointCloud2Subscription = wheel_stuck_common_utils::ros::NoCallbackSubscription<PointCloud2>;
using PointCloud2Publisher = rclcpp::Publisher<PointCloud2>;

class VelodyneCloudSeparator : public rclcpp::Node
Expand Down
2 changes: 1 addition & 1 deletion src/perception/velodyne_cloud_separator/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>sensor_msgs</depend>
<depend>wheel_stuck_utils</depend>
<depend>wheel_stuck_common_utils</depend>
<test_depend>ament_lint_auto</test_depend>

<export>
Expand Down
9 changes: 5 additions & 4 deletions src/planning/dwa_planner/include/dwa_planner/dwa_planner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#define DWA_PLANNER__DWA_PLANNER_HPP_

#include <rclcpp/rclcpp.hpp>
#include <wheel_stuck_utils/ros/no_callback_subscription.hpp>
#include <wheel_stuck_common_utils/ros/no_callback_subscription.hpp>

#include <geometry_msgs/msg/pose_stamped.hpp>
#include <geometry_msgs/msg/twist_stamped.hpp>
Expand All @@ -34,9 +34,10 @@ using PoseStamped = geometry_msgs::msg::PoseStamped;
using Twist = geometry_msgs::msg::Twist;
using TwistStamped = geometry_msgs::msg::TwistStamped;

using OccupancyGridSubscription = wheel_stuck_utils::ros::NoCallbackSubscription<OccupancyGrid>;
using OdometrySubscription = wheel_stuck_utils::ros::NoCallbackSubscription<Odometry>;
using PoseStampedSubscription = wheel_stuck_utils::ros::NoCallbackSubscription<PoseStamped>;
using OccupancyGridSubscription =
wheel_stuck_common_utils::ros::NoCallbackSubscription<OccupancyGrid>;
using OdometrySubscription = wheel_stuck_common_utils::ros::NoCallbackSubscription<Odometry>;
using PoseStampedSubscription = wheel_stuck_common_utils::ros::NoCallbackSubscription<PoseStamped>;
using TwistStampedPublisher = rclcpp::Publisher<TwistStamped>;

class DWAPlanner : public rclcpp::Node
Expand Down
2 changes: 1 addition & 1 deletion src/planning/dwa_planner/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<depend>nav_msgs</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>wheel_stuck_utils</depend>
<depend>wheel_stuck_common_utils</depend>
<test_depend>ament_lint_auto</test_depend>

<export>
Expand Down
6 changes: 3 additions & 3 deletions src/planning/dwa_planner/src/dwa_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "dwa_planner/dwa_planner.hpp"

#include <wheel_stuck_utils/math/math.hpp>
#include <wheel_stuck_common_utils/math/math.hpp>

#include <limits>

Expand Down Expand Up @@ -199,10 +199,10 @@ DWAPlanner::Trajectory DWAPlanner::planning()
Trajectory best_trajectory;

for (int v = 0; v < velocity_resolution_; v++) {
double velocity = wheel_stuck_utils::math::lerp(
double velocity = wheel_stuck_common_utils::math::lerp(
window.min_velocity, window.max_velocity, v * velocity_resolution_inv_);
for (int a = 0; a < angular_velocity_resolution_; a++) {
double angular_velocity = wheel_stuck_utils::math::lerp(
double angular_velocity = wheel_stuck_common_utils::math::lerp(
window.min_angular_velocity, window.max_angular_velocity,
a * angular_velocity_resolution_inv_);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#define SIMPLE_INT_PUBLISHER__SIMPLE_INT_PUBLISHER_HPP_

#include <rclcpp/rclcpp.hpp>
#include <wheel_stuck_utils/ros/function_timer.hpp>
#include <wheel_stuck_common_utils/ros/function_timer.hpp>

#include <std_msgs/msg/int32.hpp>

Expand All @@ -25,7 +25,7 @@ namespace simple_int_publisher

using Int32 = std_msgs::msg::Int32;

using FunctionTimer = wheel_stuck_utils::ros::FunctionTimer;
using FunctionTimer = wheel_stuck_common_utils::ros::FunctionTimer;
using Int32Publisher = rclcpp::Publisher<Int32>;

class SimpleIntPublisher : public rclcpp::Node
Expand Down
2 changes: 1 addition & 1 deletion src/sample/simple_int_publisher/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>std_msgs</depend>
<depend>wheel_stuck_utils</depend>
<depend>wheel_stuck_common_utils</depend>
<test_depend>ament_lint_auto</test_depend>

<export>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#define SIMPLE_INT_SUBSCRIBER__POLLING_INT_SUBSCRIBER_HPP_

#include <rclcpp/rclcpp.hpp>
#include <wheel_stuck_utils/ros/no_callback_subscription.hpp>
#include <wheel_stuck_common_utils/ros/no_callback_subscription.hpp>

#include <std_msgs/msg/int32.hpp>

Expand All @@ -25,7 +25,7 @@ namespace simple_int_subscriber

using Int32 = std_msgs::msg::Int32;

using Int32Subscription = wheel_stuck_utils::ros::NoCallbackSubscription<Int32>;
using Int32Subscription = wheel_stuck_common_utils::ros::NoCallbackSubscription<Int32>;

class PollingIntSubscriber : public rclcpp::Node
{
Expand Down
2 changes: 1 addition & 1 deletion src/sample/simple_int_subscriber/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>std_msgs</depend>
<depend>wheel_stuck_utils</depend>
<depend>wheel_stuck_common_utils</depend>
<test_depend>ament_lint_auto</test_depend>

<export>
Expand Down

0 comments on commit c2727e0

Please sign in to comment.