From 280e488951e09d6dd0e13447f867df3bf0c22c83 Mon Sep 17 00:00:00 2001 From: ChipTheCincoze Date: Fri, 22 Sep 2023 05:36:13 -0400 Subject: [PATCH 1/4] what the fuck --- driverless_ws/src/eufs_msgs | 2 +- driverless_ws/src/planning/CMakeLists.txt | 8 +-- driverless_ws/src/planning/src/midpoint.cpp | 52 ++++++++++++------- .../src/planning/src/raceline/raceline.cpp | 14 ++--- 4 files changed, 45 insertions(+), 31 deletions(-) diff --git a/driverless_ws/src/eufs_msgs b/driverless_ws/src/eufs_msgs index d9f66a2d2..4f3b22961 160000 --- a/driverless_ws/src/eufs_msgs +++ b/driverless_ws/src/eufs_msgs @@ -1 +1 @@ -Subproject commit d9f66a2d24c2898561bbf5602421a3fbd0bc8463 +Subproject commit 4f3b22961e2ad657794ee74ff4137eecbb5f0f78 diff --git a/driverless_ws/src/planning/CMakeLists.txt b/driverless_ws/src/planning/CMakeLists.txt index f38c6e7b5..ea2e613b9 100644 --- a/driverless_ws/src/planning/CMakeLists.txt +++ b/driverless_ws/src/planning/CMakeLists.txt @@ -17,11 +17,11 @@ find_package(geometry_msgs REQUIRED) find_package(eufs_msgs REQUIRED) find_package(GSL REQUIRED) -add_executable(midpoint_test src/midpoint.cpp src/generator.cpp src/raceline/raceline.cpp) -ament_target_dependencies(midpoint_test rclcpp std_msgs eufs_msgs geometry_msgs GSL) +add_executable(midline src/midpoint.cpp src/generator.cpp src/raceline/raceline.cpp) +ament_target_dependencies(midline rclcpp std_msgs eufs_msgs geometry_msgs GSL) install(TARGETS - midpoint_test + midline DESTINATION lib/${PROJECT_NAME}) -ament_package() \ No newline at end of file +# ament_package() \ No newline at end of file diff --git a/driverless_ws/src/planning/src/midpoint.cpp b/driverless_ws/src/planning/src/midpoint.cpp index cb363554c..5e0628757 100644 --- a/driverless_ws/src/planning/src/midpoint.cpp +++ b/driverless_ws/src/planning/src/midpoint.cpp @@ -20,7 +20,32 @@ struct raceline_pt{ class MidpointNode : public rclcpp::Node { - private: + + public: + MidpointNode() + : Node("midpoint") + { + + RCLCPP_INFO(this->get_logger(), "Started Node"); + + + subscription_cones = this->create_subscription( + "/stereo_cones", 10, std::bind(&MidpointNode::cones_callback, this, _1)); + // subscription_cones.subscribe(this,"/stereo_cones"); //= this->create_subscription("/stereo_cones", 10, std::bind(&MidpointNode::cones_callback, this, _1)); + + // subscription_lap_num = this->create_subscription("/lap_num", 10, std::bind(&MidpointNode::lap_callback, this, _1)); + publisher_rcl_pt = this->create_publisher("/midpoint_points",10); + // rclcpp::TimerBase::SharedPtr timer_ = this->create_wall_timer( + // 500ms, std::bind(&MinimalPublisher::timer_callback, this)); + generator_mid = MidpointGenerator(10); + generator_left = MidpointGenerator(10); + generator_right = MidpointGenerator(10); + // VIS LOOKAHEADS + RCLCPP_INFO(this->get_logger(), "Created Node"); + + } + + private: perceptionsData perception_data; rclcpp::Subscription::SharedPtr subscription_cones; @@ -41,15 +66,20 @@ class MidpointNode : public rclcpp::Node lap=msg->data; } - void cones_callback (const eufs_msgs::msg::ConeArray::SharedPtr msg) + void cones_callback(const eufs_msgs::msg::ConeArray::SharedPtr msg) const { + RCLCPP_INFO(this->get_logger(), "Recieved cones from perceptions"); + } + + void cones_callback2(const eufs_msgs::msg::ConeArray::SharedPtr msg) + { + RCLCPP_INFO(this->get_logger(), "Recieved cones from perceptions"); if (lap>1) return; if((msg->blue_cones.size()==0 || msg->yellow_cones.size()==0) && (msg->orange_cones.size()<2)){ return; } - for (auto e : msg->blue_cones) { perception_data.bluecones.emplace_back(e.x, e.y); @@ -99,22 +129,6 @@ class MidpointNode : public rclcpp::Node } - - public: - MidpointNode() - : Node("midpoint") - { - subscription_cones = this->create_subscription("/stereo_cones", 10, std::bind(&MidpointNode::cones_callback, this, _1)); - // subscription_lap_num = this->create_subscription("/lap_num", 10, std::bind(&MidpointNode::lap_callback, this, _1)); - publisher_rcl_pt = this->create_publisher("/midpoint_points",10); - // publisher_rcl_pt = this->create_publisher("/midpoint_points",10); - // rclcpp::TimerBase::SharedPtr timer_ = this->create_wall_timer( - // 500ms, std::bind(&MinimalPublisher::timer_callback, this)); - generator_mid = MidpointGenerator(10); - generator_left = MidpointGenerator(10); - generator_right = MidpointGenerator(10); - // VIS LOOKAHEADS - } }; int main(int argc, char * argv[]) diff --git a/driverless_ws/src/planning/src/raceline/raceline.cpp b/driverless_ws/src/planning/src/raceline/raceline.cpp index bff0e4936..dd38dde52 100644 --- a/driverless_ws/src/planning/src/raceline/raceline.cpp +++ b/driverless_ws/src/planning/src/raceline/raceline.cpp @@ -281,7 +281,7 @@ gsl_vector *get_translation_vector(gsl_matrix *group){ gsl_matrix *transform_points(gsl_matrix *points, gsl_matrix *Q, gsl_vector *get_translation_vector){ gsl_matrix *temp = gsl_matrix_alloc(points->size1,points->size2); - for(int i=0;isize2;++i){ + for(u_int32_t i=0;isize2;++i){ gsl_matrix_set(temp,0,i,gsl_matrix_get(points,0,i)-gsl_vector_get(get_translation_vector,0)); gsl_matrix_set(temp,1,i,gsl_matrix_get(points,1,i)-gsl_vector_get(get_translation_vector,1)); } @@ -298,7 +298,7 @@ gsl_matrix *transform_points(gsl_matrix *points, gsl_matrix *Q, gsl_vector *get_ gsl_matrix *reverse_transform(gsl_matrix *points, gsl_matrix *Q, gsl_vector *get_translation_vector){ gsl_matrix *temp = gsl_matrix_alloc(points->size1,points->size2); - for(int i=0;isize2;++i){ + for(uint32_t i=0;isize2;++i){ gsl_matrix_set(temp,0,i,gsl_matrix_get(points,0,i)); gsl_matrix_set(temp,1,i,gsl_matrix_get(points,1,i)); } @@ -307,7 +307,7 @@ gsl_matrix *reverse_transform(gsl_matrix *points, gsl_matrix *Q, gsl_vector *get gsl_linalg_matmult(temp,Q,ret); gsl_matrix_free(temp); - for(int i=0;isize2;++i){ + for(uint32_t i=0;isize2;++i){ gsl_matrix_set(temp,0,i,gsl_matrix_get(points,0,i)+gsl_vector_get(get_translation_vector,0)); gsl_matrix_set(temp,1,i,gsl_matrix_get(points,1,i)+gsl_vector_get(get_translation_vector,1)); } @@ -318,21 +318,21 @@ gsl_matrix *reverse_transform(gsl_matrix *points, gsl_matrix *Q, gsl_vector *get polynomial lagrange_gen(gsl_matrix* points){ polynomial lagrange_poly = poly(3); - for(int col = 0;col size2;col++){ + for(uint32_t col = 0;col size2;col++){ } double x[points->size2]; double y[points->size2]; - for(int i=0;isize2;i++){ + for(uint32_t i=0;isize2;i++){ x[i] = gsl_matrix_get(points,i,0); y[i] = gsl_matrix_get(points,i,1); } - for(int i=0;isize2;i++){ + for(uint32_t i=0;isize2;i++){ polynomial p = poly_one(); - for(int j=0;jsize2;j++){ + for(uint32_t j=0;jsize2;j++){ if(j!=i){ polynomial pr =poly_root(x[j]); polynomial q =poly_mult(p,pr); From c4b0971350f8555727cf316e98ce85fbbdccb0fe Mon Sep 17 00:00:00 2001 From: ChipTheCincoze Date: Fri, 22 Sep 2023 07:04:45 -0400 Subject: [PATCH 2/4] pee poo --- driverless_ws/src/planning/CMakeLists.txt | 18 ++++++++- driverless_ws/src/planning/pub.cpp | 44 +++++++++++++++++++++ driverless_ws/src/planning/src/midpoint.cpp | 23 +++++++---- driverless_ws/src/planning/sub.cpp | 31 +++++++++++++++ 4 files changed, 108 insertions(+), 8 deletions(-) create mode 100644 driverless_ws/src/planning/pub.cpp create mode 100644 driverless_ws/src/planning/sub.cpp diff --git a/driverless_ws/src/planning/CMakeLists.txt b/driverless_ws/src/planning/CMakeLists.txt index ea2e613b9..b73b62504 100644 --- a/driverless_ws/src/planning/CMakeLists.txt +++ b/driverless_ws/src/planning/CMakeLists.txt @@ -20,8 +20,24 @@ find_package(GSL REQUIRED) add_executable(midline src/midpoint.cpp src/generator.cpp src/raceline/raceline.cpp) ament_target_dependencies(midline rclcpp std_msgs eufs_msgs geometry_msgs GSL) + + +add_executable(talker pub.cpp) +ament_target_dependencies(talker rclcpp std_msgs) + +install(TARGETS + talker + DESTINATION lib/${PROJECT_NAME}) + +add_executable(listener sub.cpp) +ament_target_dependencies(listener rclcpp std_msgs) + +install(TARGETS + talker + listener + DESTINATION lib/${PROJECT_NAME}) install(TARGETS midline DESTINATION lib/${PROJECT_NAME}) -# ament_package() \ No newline at end of file +ament_package() \ No newline at end of file diff --git a/driverless_ws/src/planning/pub.cpp b/driverless_ws/src/planning/pub.cpp new file mode 100644 index 000000000..2157f70c4 --- /dev/null +++ b/driverless_ws/src/planning/pub.cpp @@ -0,0 +1,44 @@ +#include +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "std_msgs/msg/string.hpp" + +using namespace std::chrono_literals; + +/* This example creates a subclass of Node and uses std::bind() to register a +* member function as a callback from the timer. */ + +class MinimalPublisher : public rclcpp::Node +{ + public: + MinimalPublisher() + : Node("minimal_publisher"), count_(0) + { + publisher_ = this->create_publisher("topic", 10); + timer_ = this->create_wall_timer( + 500ms, std::bind(&MinimalPublisher::timer_callback, this)); + } + + private: + void timer_callback() + { + auto message = std_msgs::msg::String(); + message.data = "Hello, world! " + std::to_string(count_++); + RCLCPP_INFO(this->get_logger(), "Publishing: '%s'", message.data.c_str()); + publisher_->publish(message); + } + rclcpp::TimerBase::SharedPtr timer_; + rclcpp::Publisher::SharedPtr publisher_; + size_t count_; +}; + +int main(int argc, char * argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file diff --git a/driverless_ws/src/planning/src/midpoint.cpp b/driverless_ws/src/planning/src/midpoint.cpp index 5e0628757..01ab0ad5e 100644 --- a/driverless_ws/src/planning/src/midpoint.cpp +++ b/driverless_ws/src/planning/src/midpoint.cpp @@ -28,6 +28,8 @@ class MidpointNode : public rclcpp::Node RCLCPP_INFO(this->get_logger(), "Started Node"); + subscription_ = this->create_subscription( + "topic", 10, std::bind(&MidpointNode::topic_callback, this, _1)); subscription_cones = this->create_subscription( "/stereo_cones", 10, std::bind(&MidpointNode::cones_callback, this, _1)); @@ -38,9 +40,9 @@ class MidpointNode : public rclcpp::Node // rclcpp::TimerBase::SharedPtr timer_ = this->create_wall_timer( // 500ms, std::bind(&MinimalPublisher::timer_callback, this)); generator_mid = MidpointGenerator(10); - generator_left = MidpointGenerator(10); - generator_right = MidpointGenerator(10); - // VIS LOOKAHEADS + // generator_left = MidpointGenerator(10); + // generator_right = MidpointGenerator(10); + // VIS LOOKAHEADS RCLCPP_INFO(this->get_logger(), "Created Node"); } @@ -48,6 +50,8 @@ class MidpointNode : public rclcpp::Node private: perceptionsData perception_data; + + rclcpp::Subscription::SharedPtr subscription_; rclcpp::Subscription::SharedPtr subscription_cones; // rclcpp::Subscription::SharedPtr subscription_lap_num; rclcpp::Publisher::SharedPtr publisher_rcl_pt; @@ -58,12 +62,17 @@ class MidpointNode : public rclcpp::Node int lap = 1; bool vis_spline = true; MidpointGenerator generator_mid; - MidpointGenerator generator_left; - MidpointGenerator generator_right; + // MidpointGenerator generator_left; + // MidpointGenerator generator_right; + + // void lap_callback(const std_msgs::msg::Int8::SharedPtr msg) + // { + // lap=msg->data; + // } - void lap_callback(const std_msgs::msg::Int8::SharedPtr msg) + void topic_callback(const std_msgs::msg::String::SharedPtr msg) const { - lap=msg->data; + RCLCPP_INFO(this->get_logger(), "I heard: '%s'", msg->data.c_str()); } void cones_callback(const eufs_msgs::msg::ConeArray::SharedPtr msg) const diff --git a/driverless_ws/src/planning/sub.cpp b/driverless_ws/src/planning/sub.cpp new file mode 100644 index 000000000..83345b48b --- /dev/null +++ b/driverless_ws/src/planning/sub.cpp @@ -0,0 +1,31 @@ +#include + +#include "rclcpp/rclcpp.hpp" +#include "std_msgs/msg/string.hpp" +using std::placeholders::_1; + +class MinimalSubscriber : public rclcpp::Node +{ + public: + MinimalSubscriber() + : Node("minimal_subscriber") + { + subscription_ = this->create_subscription( + "topic", 10, std::bind(&MinimalSubscriber::topic_callback, this, _1)); + } + + private: + void topic_callback(const std_msgs::msg::String::SharedPtr msg) const + { + RCLCPP_INFO(this->get_logger(), "I heard: '%s'", msg->data.c_str()); + } + rclcpp::Subscription::SharedPtr subscription_; +}; + +int main(int argc, char * argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file From c3a05e86cd9965710848cdc6c7dbe0901968d7cf Mon Sep 17 00:00:00 2001 From: gracetangg Date: Sat, 23 Sep 2023 11:24:53 -0400 Subject: [PATCH 3/4] transfer issue templates --- .github/ISSUE_TEMPLATE/config.yaml | 1 + .github/ISSUE_TEMPLATE/dv-tasking-issue.md | 22 +++++++++++ .github/pull_request_template.md | 11 ++++++ .github/workflows/fsdv-integration.yml | 45 ++++++++++++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/config.yaml create mode 100644 .github/ISSUE_TEMPLATE/dv-tasking-issue.md create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/fsdv-integration.yml diff --git a/.github/ISSUE_TEMPLATE/config.yaml b/.github/ISSUE_TEMPLATE/config.yaml new file mode 100644 index 000000000..8da9b001f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yaml @@ -0,0 +1 @@ +blank_issues_enabled: true diff --git a/.github/ISSUE_TEMPLATE/dv-tasking-issue.md b/.github/ISSUE_TEMPLATE/dv-tasking-issue.md new file mode 100644 index 000000000..9b4f44aee --- /dev/null +++ b/.github/ISSUE_TEMPLATE/dv-tasking-issue.md @@ -0,0 +1,22 @@ +--- +name: DV Tasking Issue +about: Issue template for subteam tasking +title: "[SUBTEAM]-[Project name]" +labels: '' +assignees: '' + +--- + +## Task Description: +... + +## Task Check-list: +- [ ] ... +- [ ] Write integration tests +- [ ] Add Documentation (to Confluence too) +- [ ] Open Pull Request + +## Task Timeline: +- [ ] Update [Smartsheet](https://app.smartsheet.com/sheets/phJjhWq5VvpqHHw8WW5rCRh8Xgccpv8Q96WCMr41?view=grid) with Task Timeline + +Comment any questions and tag reviewers. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..5778f3fa8 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,11 @@ +# Pull Request +Addresses Issue #__ ([issue name]) + +### Description +Explain any proposed changes here. + +### Check-list +- [ ] Integration tests pass +- [ ] Code Documented (and Confluence documentation updated) +- [ ] Reviewer 1 approved + diff --git a/.github/workflows/fsdv-integration.yml b/.github/workflows/fsdv-integration.yml new file mode 100644 index 000000000..9683d12cf --- /dev/null +++ b/.github/workflows/fsdv-integration.yml @@ -0,0 +1,45 @@ +name: cmr-fsdv + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + python-version: ["3.9"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + + - uses: actions/cache@v2 + with: + path: ${{ env.pythonLocation }} + key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements.txt') }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 pytest + pip install --upgrade --upgrade-strategy eager -r requirements.txt + # if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + + # - name: Lint with flake8 + # run: | + # # stop the build if there are Python syntax errors or undefined names + # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest From 2cc023487b946a46d54d554fc856f878bad9682f Mon Sep 17 00:00:00 2001 From: Ankit Khandelwal Date: Sat, 23 Sep 2023 11:41:31 -0400 Subject: [PATCH 4/4] Update dv-tasking-issue.md --- .github/ISSUE_TEMPLATE/dv-tasking-issue.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/dv-tasking-issue.md b/.github/ISSUE_TEMPLATE/dv-tasking-issue.md index 9b4f44aee..74d7f58df 100644 --- a/.github/ISSUE_TEMPLATE/dv-tasking-issue.md +++ b/.github/ISSUE_TEMPLATE/dv-tasking-issue.md @@ -17,6 +17,6 @@ assignees: '' - [ ] Open Pull Request ## Task Timeline: -- [ ] Update [Smartsheet](https://app.smartsheet.com/sheets/phJjhWq5VvpqHHw8WW5rCRh8Xgccpv8Q96WCMr41?view=grid) with Task Timeline +- [ ] Update [Jira](cmr.red/jira) with Task Timeline Comment any questions and tag reviewers.