diff --git a/.github/workflows/workflows.yml b/.github/workflows/workflows.yml index ac59dfc2..0db3e258 100644 --- a/.github/workflows/workflows.yml +++ b/.github/workflows/workflows.yml @@ -5,10 +5,12 @@ on: branches: - master - develop + - onboarding pull_request: branches: - master - develop + - onboarding workflow_dispatch: inputs: debug_enabled: diff --git a/.gitignore b/.gitignore index 5244084b..fbf84a03 100644 --- a/.gitignore +++ b/.gitignore @@ -18,5 +18,7 @@ log 02_V5/ghost_pros/src/ghost_control/** 02_V5/ghost_pros/src/ghost_util/** +09_External/*deb + # Auto-generated -02_V5/ghost_pros/include/robot_config.hpp \ No newline at end of file +02_V5/ghost_pros/include/robot_config.hpp diff --git a/03_ROS/ghost_motion_planner_core/CMakeLists.txt b/03_ROS/ghost_motion_planner_core/CMakeLists.txt index 82abc2ee..4481ac9c 100644 --- a/03_ROS/ghost_motion_planner_core/CMakeLists.txt +++ b/03_ROS/ghost_motion_planner_core/CMakeLists.txt @@ -91,16 +91,4 @@ install( DESTINATION include ) -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # comment the line when a copyright and license is added to all source files - set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # comment the line when this package is in a git repo and when - # a copyright and license is added to all source files - set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() - ament_package() diff --git a/03_ROS/rviz_animators/CMakeLists.txt b/03_ROS/rviz_animators/CMakeLists.txt new file mode 100644 index 00000000..1ce18827 --- /dev/null +++ b/03_ROS/rviz_animators/CMakeLists.txt @@ -0,0 +1,90 @@ + +cmake_minimum_required(VERSION 3.8) +project(rviz_animators) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(visualization_msgs REQUIRED) +find_package(rclcpp REQUIRED) +#find_package(ghost_msgs REQUIRED) + + +set(DEPENDENCIES + ament_cmake + rclcpp + visualization_msgs +) + +# uncomment the following section in order to fill in +# further dependencies manually. +# find_package( REQUIRED) + + +# if(BUILD_TESTING) +# find_package(ament_lint_auto REQUIRED) +# # the following line skips the linter which checks for copyrights +# # comment the line when a copyright and license is added to all source files +# set(ament_cmake_copyright_FOUND TRUE) +# # the following line skips cpplint (only works in a git repo) +# # comment the line when this package is in a git repo and when +# # a copyright and license is added to all source files +# set(ament_cmake_cpplint_FOUND TRUE) +# ament_lint_auto_find_test_dependencies() +# endif() + + +ament_export_dependencies(${DEPENDENCIES}) + +set(INCLUDE + include +) +include_directories(${INCLUDE}) +ament_export_include_directories(${INCLUDE}) + + +add_executable(publisher src/publisher.cpp) +ament_target_dependencies(publisher ${DEPENDENCIES}) +install(TARGETS + publisher + DESTINATION lib/${PROJECT_NAME}) + + add_library(subscriber SHARED src/subscriber.cpp) + ament_target_dependencies(subscriber + ${DEPENDENCIES} + ) + ament_export_targets(subscriber HAS_LIBRARY_TARGET) + install( + TARGETS subscriber + EXPORT subscriber + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + INCLUDES DESTINATION include + ) + + add_executable(subscriber_main src/subscriber_main.cpp) + ament_target_dependencies(subscriber_main + ${DEPENDENCIES} +) +target_link_libraries(subscriber_main + subscriber +) + +install(TARGETS + subscriber_main + DESTINATION lib/${PROJECT_NAME}) + +install( + DIRECTORY include/ + DESTINATION include +) + +install(DIRECTORY + launch config + DESTINATION share/${PROJECT_NAME}) + +ament_package() \ No newline at end of file diff --git a/03_ROS/rviz_animators/include/config/test.yaml b/03_ROS/rviz_animators/include/config/test.yaml new file mode 100644 index 00000000..49de4d98 --- /dev/null +++ b/03_ROS/rviz_animators/include/config/test.yaml @@ -0,0 +1,3 @@ +subscriber_node: + ros__parameters: + test_param: "test" \ No newline at end of file diff --git a/03_ROS/rviz_animators/include/rviz_animators/subscriber.hpp b/03_ROS/rviz_animators/include/rviz_animators/subscriber.hpp new file mode 100644 index 00000000..367fd992 --- /dev/null +++ b/03_ROS/rviz_animators/include/rviz_animators/subscriber.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include +#include "visualization_msgs/msg/marker_array.hpp" +// #include "ghost_msgs/msg/labeled_vector.hpp" +// #include "ghost_msgs/msg/labeled_vector_map.hpp" +#include "rclcpp/rclcpp.hpp" + + +namespace rviz{ + class ROSSubscriber : public rclcpp::Node { + public: + ROSSubscriber(); + void topic_callback(const visualization_msgs::msg::MarkerArray::SharedPtr msg); + // void vector_topic_callback(const ghost_msgs::msg::LabeledVectorMap::SharedPtr msg); + + private: + rclcpp::Subscription::SharedPtr subscription_; + // rclcpp::Subscription::SharedPtr vector_subscription_; + }; +} diff --git a/03_ROS/rviz_animators/launch/pub_sub.launch.py b/03_ROS/rviz_animators/launch/pub_sub.launch.py new file mode 100644 index 00000000..17d2e08f --- /dev/null +++ b/03_ROS/rviz_animators/launch/pub_sub.launch.py @@ -0,0 +1,32 @@ +import launch +import launch_ros + +import os + +def generate_launch_description(): + + home_dir = os.path.expanduser('~') + rviz_animators_dir = os.path.join(home_dir, "VEXU_GHOST", "03_ROS", "rviz_animators") + + # This contains all the parameters for our ROS nodes + ros_config_file = os.path.join(rviz_animators_dir, "config/test.yaml") + + publisher_node = launch_ros.actions.Node( + name = "publisher_node", + package = 'rviz_animators', + # This name is specified in the CmakeLists.txt file of this package + executable = 'publisher', + ) + + subscriber_node = launch_ros.actions.Node( + name='subscriber_node', + package= 'rviz_animators', + # This name is specified in the CmakeLists.txt file of this package + executable='subscriber_main', + parameters=[ros_config_file] + ) + + return launch.LaunchDescription([ + publisher_node, + subscriber_node + ]) \ No newline at end of file diff --git a/03_ROS/rviz_animators/package.xml b/03_ROS/rviz_animators/package.xml new file mode 100644 index 00000000..5160f73f --- /dev/null +++ b/03_ROS/rviz_animators/package.xml @@ -0,0 +1,19 @@ + + + + rviz_animators + 0.0.0 + TODO: Package description + root + TODO: License declaration + + ament_cmake + + ament_lint_auto + ament_lint_common + ghost_msgs + + + ament_cmake + + diff --git a/03_ROS/rviz_animators/src/publisher.cpp b/03_ROS/rviz_animators/src/publisher.cpp new file mode 100644 index 00000000..b2a2f736 --- /dev/null +++ b/03_ROS/rviz_animators/src/publisher.cpp @@ -0,0 +1,83 @@ +#include +#include +#include +#include +#include "visualization_msgs/msg/marker_array.hpp" +#include "visualization_msgs/msg/marker.hpp" +// #include +// #include +#include "rclcpp/rclcpp.hpp" +#include + +using namespace std::chrono_literals; + +class ROSPublisher : public rclcpp::Node +{ +public: + ROSPublisher() : Node("marker_publisher"), + count_(0) + { + publisher_ = this->create_publisher("visualization_marker", 10); + timer_ = this->create_wall_timer(500ms, std::bind(&ROSPublisher::timer_callback, this)); + } + +private: + void timer_callback() + { + auto marker_array_msg = std::make_shared(); + for (int i = 0; i < 10; i++) + { + visualization_msgs::msg::Marker marker; + createSphereMarker(i, marker); // Create and fill marker directly + marker_array_msg->markers.push_back(marker); + } + publisher_->publish(*marker_array_msg); + } + + void createSphereMarker(int id, visualization_msgs::msg::Marker &marker) + { + marker.header.frame_id = "map"; + marker.header.stamp = this->get_clock()->now(); + marker.ns = "basic_shapes"; + marker.id = id; + marker.type = visualization_msgs::msg::Marker::SPHERE; + marker.action = visualization_msgs::msg::Marker::ADD; + + // Define a function of time for position calculation + //auto t = this->get_clock()->now(); // Current time in seconds + // Current time in seconds + double x = 0; // Example function: x = t * cos(t + id) + double y = 0; // Example function: y = t * sin(t + id) + double z = 0; // Example function: z = t + + marker.pose.position.x = x; + marker.pose.position.y = y; + marker.pose.position.z = z; + + marker.pose.orientation.x = 0.0; + marker.pose.orientation.y = 0.0; + marker.pose.orientation.z = 0.0; + marker.pose.orientation.w = 1.0; + + marker.scale.x = 1.0; + marker.scale.y = 1.0; + marker.scale.z = 1.0; + + marker.color.a = 1.0; + marker.color.r = 1.0; + marker.color.g = 0.0; + marker.color.b = 0.0; + } + + rclcpp::TimerBase::SharedPtr timer_; + rclcpp::Publisher::SharedPtr publisher_; + int count_; +}; + +int main(int argc, char *argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} diff --git a/03_ROS/rviz_animators/src/subscriber.cpp b/03_ROS/rviz_animators/src/subscriber.cpp new file mode 100644 index 00000000..bb9a73d2 --- /dev/null +++ b/03_ROS/rviz_animators/src/subscriber.cpp @@ -0,0 +1,52 @@ +#include "rviz_animators/subscriber.hpp" + +namespace rviz +{ + + ROSSubscriber::ROSSubscriber() : Node("subscribers") + { + + this->declare_parameter("test_param", "/estimation/pose"); + std::string test_param = this->get_parameter("test_param").as_string(); + + std::cout << test_param << std::endl; + + // Create a subscription to the "marker_topic" topic with a queue size of 10 + subscription_ = this->create_subscription( + "marker_topic", 10, std::bind(&ROSSubscriber::topic_callback, this, std::placeholders::_1)); + + // vector_subscription_ = this->create_subscription( + // "vector_topic", 10, std::bind(&ROSSubscriber::vector_topic_callback, this, std::placeholders::_1)); + // Uncomment the following lines if you want to subscribe to a trajectory topic + // trajectory_subscription_ = this->create_subscription( + // "trajectory_topic", 10, std::bind(&ROSSubscriber::trajectory_topic_callback, this, std::placeholders::_1)); + } + + void ROSSubscriber::topic_callback(const visualization_msgs::msg::MarkerArray::SharedPtr msg) + { + auto now = this->get_clock()->now(); + auto diff = now - msg->markers[0].header.stamp; + // Log the X-coordinate of the first marker in the array + RCLCPP_INFO(this->get_logger(), "X-coord is: %f", msg->markers[0].pose.position.x); + } + + // void ROSSubscriber::vector_topic_callback(const ghost_msgs::msg::LabeledVectorMap::SharedPtr msg) + // { + // // plays message back in rviz + // // auto now = this->get_clock()->now(); + // // auto diff = now - msg->markers[0].header.stamp; + // // Log the X-coordinate of the first marker in the array + // RCLCPP_INFO(this->get_logger(), "X-coord is: %f", msg->markers[0].pose.position.x); + // } + rclcpp::Subscription::SharedPtr subscription_; + // rclcpp::Subscription::SharedPtr vector_subscription_; + + // Uncomment the following function if you want to handle messages of type trajectory_msgs::msg::JointTrajectoryPoint + // void ROSSubscriber::topic_callback(const trajectory_msgs::msg::JointTrajectoryPoint::SharedPtr msg) { + // auto now = this->get_clock()->now(); + // auto diff = now - msg->header.stamp; + // // Log the X-coordinate of the received trajectory point + // RCLCPP_INFO(this->get_logger(), "X-coord is: %f", msg->positions[0]); + // } + +} // namespace rviz diff --git a/03_ROS/rviz_animators/src/subscriber_main.cpp b/03_ROS/rviz_animators/src/subscriber_main.cpp new file mode 100644 index 00000000..cc26312d --- /dev/null +++ b/03_ROS/rviz_animators/src/subscriber_main.cpp @@ -0,0 +1,8 @@ +#include "rviz_animators/subscriber.hpp" + +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/10_Examples/corey-onboarding/CMakeLists.txt b/10_Examples/corey-onboarding/CMakeLists.txt new file mode 100755 index 00000000..b0c3781b --- /dev/null +++ b/10_Examples/corey-onboarding/CMakeLists.txt @@ -0,0 +1,92 @@ +cmake_minimum_required(VERSION 3.8) +project(corey-onboarding) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +set(Ghost_DIR "$ENV{VEXU_HOME}/cmake") +find_package(Ghost CONFIG REQUIRED) + +set(DEPENDENCIES + ament_cmake + ament_cmake_python + ament_cmake_gtest + rclcpp + rclpy + sensor_msgs + geometry_msgs + yaml-cpp + ) + +foreach(pkg ${DEPENDENCIES}) + find_package(${pkg} REQUIRED) +endforeach() + +ament_export_dependencies(${DEPENDENCIES}) + +set(INCLUDE + include +) + +include_directories(${INCLUDE}) + +ament_export_include_directories(${INCLUDE}) + +add_executable(publisher_node src/publisher.cpp) +ament_target_dependencies(publisher_node ${DEPENDENCIES}) + +add_executable(subscriber_node src/subscriber.cpp) +ament_target_dependencies(subscriber_node ${DEPENDENCIES}) + +add_executable(hello_world src/helloworld.cpp) +ament_target_dependencies(hello_world ${DEPENDENCIES}) + + +add_library(bankmain_lib SHARED src/bankmain.cpp) +ament_target_dependencies(bankmain_lib ${DEPENDENCIES}) +ament_export_targets(bankmain_lib HAS_LIBRARY_TARGET) +install( + TARGETS bankmain_lib + EXPORT bankmain_lib + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + INCLUDES DESTINATION include +) +add_executable(bankmain_exe src/bankmain.cpp) +ament_target_dependencies(bankmain_exe + ${DEPENDENCIES} +) +target_link_libraries(bankmain_exe + bankmain_lib +) +install(TARGETS + bankmain_exe + DESTINATION lib/${PROJECT_NAME}) + +ament_add_gtest(bankmain_test test/banktest.cpp) +target_link_libraries(bankmain_test + bankmain_lib + gtest +) +target_include_directories(bankmain_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) + +install(TARGETS + hello_world + publisher_node + subscriber_node + bankmain_exe + DESTINATION lib/${PROJECT_NAME}) + +install( + DIRECTORY include/ + DESTINATION include +) + +install(DIRECTORY + DESTINATION share/${PROJECT_NAME} +) +#i + +ament_package() diff --git a/10_Examples/corey-onboarding/include/bankheader.hpp b/10_Examples/corey-onboarding/include/bankheader.hpp new file mode 100644 index 00000000..ebc5c19a --- /dev/null +++ b/10_Examples/corey-onboarding/include/bankheader.hpp @@ -0,0 +1,35 @@ +#include +#include + +using namespace std; + +class BankAccount +{ + +private: + + string name; //Variable + + int balance; //Variable + +public: + + void setName(const string& newName); //setter for name member variable + + string getName() const; //getter for name member variable + + void setBalance(int newBalance); //setter for balance + + int getBalance() const; //getter for Balance + + + void withdraw(int amount); //my method + + void print(); //my method + + BankAccount(string AccountName, int AccountBalance); // declare constructor + + +}; + + diff --git a/10_Examples/corey-onboarding/package.xml b/10_Examples/corey-onboarding/package.xml new file mode 100755 index 00000000..3c5975bf --- /dev/null +++ b/10_Examples/corey-onboarding/package.xml @@ -0,0 +1,24 @@ + + + + corey-onboarding + 0.0.0 + Package corey onboarding review 4 + corey + MIT + + ament_cmake + ament_cmake_python + + ament_cmake_gtest + + ament_lint_auto + ament_lint_common + + rclcpp + std_msgs + + + ament_cmake + + diff --git a/10_Examples/corey-onboarding/src/bankmain.cpp b/10_Examples/corey-onboarding/src/bankmain.cpp new file mode 100644 index 00000000..14e05c2a --- /dev/null +++ b/10_Examples/corey-onboarding/src/bankmain.cpp @@ -0,0 +1,55 @@ +#include +#include +#include "bankheader.hpp" + +using namespace std; + +BankAccount::BankAccount(string AccountName, int AccountBalance) +{ + + setName(AccountName); + setBalance(AccountBalance); + +} + +string BankAccount::getName() const +{ + return name; +} + +void BankAccount::setName(const string& newName) +{ + name = newName; +} + +int BankAccount::getBalance() const +{ + return balance; +} + +void BankAccount::setBalance(int newBalance) +{ + balance = newBalance; +} + + +void BankAccount::withdraw(int amount) +{ + setBalance(getBalance() - amount); +} + +void BankAccount::print() +{ + cout << name << " has " << "a balance of " << getBalance() << endl; +} + + +int main () +{ + BankAccount account1("kelly", 50000); + account1.print(); + account1.withdraw(2356); + account1.print(); + + return 0; +} diff --git a/10_Examples/corey-onboarding/src/helloworld.cpp b/10_Examples/corey-onboarding/src/helloworld.cpp new file mode 100755 index 00000000..b1d18ab3 --- /dev/null +++ b/10_Examples/corey-onboarding/src/helloworld.cpp @@ -0,0 +1,8 @@ +#include + +int main(int argc, char ** argv) +{ + std::cout << "Hello World!" << std::endl; + return 0; +} +//w \ No newline at end of file diff --git a/10_Examples/corey-onboarding/src/publisher.cpp b/10_Examples/corey-onboarding/src/publisher.cpp new file mode 100644 index 00000000..5d7d57d5 --- /dev/null +++ b/10_Examples/corey-onboarding/src/publisher.cpp @@ -0,0 +1,49 @@ +#include +#include +#include +#include +#include "rclcpp/rclcpp.hpp" +#include "std_msgs/msg/string.hpp" + +using namespace std::chrono_literals; + +class SimplePublisher : public rclcpp::Node +{ +public: + SimplePublisher() + : Node("publisher_node") + { + CounterValue = 0; + + publisherObject = this->create_publisher("communication_topic", 20); + + timerObject = this->create_wall_timer( + 1000ms, std::bind( + &SimplePublisher::callbackFunction, + this)); + } + +private: + void callbackFunction() + { + CounterValue++; + auto message = std_msgs::msg::String(); + message.data = "Message Number: " + std::to_string(CounterValue); + + RCLCPP_INFO(this->get_logger(), "Publishing message: '%s'", message.data.c_str()); + publisherObject->publish(message); + } + + rclcpp::TimerBase::SharedPtr timerObject; + rclcpp::Publisher::SharedPtr publisherObject; + int CounterValue; +}; + +int main(int argc, char * argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} + diff --git a/10_Examples/corey-onboarding/src/subscriber.cpp b/10_Examples/corey-onboarding/src/subscriber.cpp new file mode 100644 index 00000000..21cb41a5 --- /dev/null +++ b/10_Examples/corey-onboarding/src/subscriber.cpp @@ -0,0 +1,37 @@ +#include +#include +#include +#include +#include "rclcpp/rclcpp.hpp" +#include "std_msgs/msg/string.hpp" + +using std::placeholders::_1; + +class SimpleSubscriber : public rclcpp::Node +{ +public: + SimpleSubscriber() + : Node("subscriber_node") + { + subscriberObject = this->create_subscription( + "communication_topic", 10, std::bind(&SimpleSubscriber::callbackFunction, this, _1)); + } + +private: + void callbackFunction(const std_msgs::msg::String & msg) const + { + RCLCPP_INFO(this->get_logger(), "I heard: '%s'", msg.data.c_str()); + } + + rclcpp::Subscription::SharedPtr subscriberObject; +}; + +int main(int argc, char * argv[]) +{ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared()); + rclcpp::shutdown(); + return 0; +} + + diff --git a/10_Examples/corey-onboarding/test/banktest.cpp b/10_Examples/corey-onboarding/test/banktest.cpp new file mode 100755 index 00000000..5456798e --- /dev/null +++ b/10_Examples/corey-onboarding/test/banktest.cpp @@ -0,0 +1,45 @@ +#include "bankheader.hpp" +#include "gtest/gtest.h" + +class BankAccountTest : public ::testing::Test + +{ +protected: + BankAccountTest() + { + bankmaincode = std::make_shared("kelly", 50000); + } + + void SetUp() override + { + } + + void TearDown() override + { + } + std::shared_ptr bankmaincode; + +}; + +TEST_F(BankAccountTest, testWithdrawMoney) +{ + bankmaincode->withdraw(20000); + EXPECT_EQ(bankmaincode->getBalance(), 30000); + EXPECT_TRUE(bankmaincode->getBalance() == 30000); + EXPECT_FALSE(bankmaincode->getBalance() == 35000); +} + +TEST_F(BankAccountTest, testPrint) +{ + testing::internal::CaptureStdout(); + bankmaincode->print(); + std::string output = testing::internal::GetCapturedStdout(); + EXPECT_STREQ(output.c_str(), "kelly has a balance of 50000\n"); +} + +int main(int argc, char ** argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + diff --git a/10_Examples/ghost_control_examples/CMakeLists.txt b/10_Examples/ghost_control_examples/CMakeLists.txt index e04d7499..649aa41f 100644 --- a/10_Examples/ghost_control_examples/CMakeLists.txt +++ b/10_Examples/ghost_control_examples/CMakeLists.txt @@ -63,4 +63,8 @@ casadi_trajectory_generation include_directories(${INCLUDE}) ament_export_include_directories(${INCLUDE}) +##################################### +### Trajectory Generation Example ### +##################################### + ament_package() diff --git a/10_Examples/ghost_examples/package.xml b/10_Examples/ghost_examples/package.xml index c841ab76..80f7467c 100644 --- a/10_Examples/ghost_examples/package.xml +++ b/10_Examples/ghost_examples/package.xml @@ -20,12 +20,13 @@ --> ament_cmake ament_cmake_python - rclpy ament_cmake_gtest rclcpp - sensor_msgs - geometry_msgs + std_msgs + + ament_cmake diff --git a/10_Examples/ghost_examples/src/ros_publisher_example.cpp b/10_Examples/ghost_examples/src/ros_publisher_example.cpp index f1a89c2d..436ab1a7 100644 --- a/10_Examples/ghost_examples/src/ros_publisher_example.cpp +++ b/10_Examples/ghost_examples/src/ros_publisher_example.cpp @@ -25,10 +25,8 @@ #include #include #include - -#include "geometry_msgs/msg/pose_with_covariance_stamped.hpp" +#include "std_msgs/msg/string.hpp" #include "rclcpp/rclcpp.hpp" -#include "sensor_msgs/msg/laser_scan.hpp" using namespace std::chrono_literals; diff --git a/10_Examples/linh-onboarding/CMakeLists.txt b/10_Examples/linh-onboarding/CMakeLists.txt new file mode 100644 index 00000000..7c14a64b --- /dev/null +++ b/10_Examples/linh-onboarding/CMakeLists.txt @@ -0,0 +1,104 @@ +cmake_minimum_required(VERSION 3.8) +project(linh-onboarding) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +#find_package( REQUIRED) +find_package(ament_cmake REQUIRED) +find_package(rclcpp REQUIRED) +find_package(std_msgs REQUIRED) +find_package(ament_cmake_gtest REQUIRED) + +set(DEPENDENCIES + ament_cmake + rclcpp + std_msgs + ament_cmake_gtest +) + + +#if(BUILD_TESTING) + #find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # comment the line when a copyright and license is added to all source files + #set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # comment the line when this package is in a git repo and when + # a copyright and license is added to all source files + #set(ament_cmake_cpplint_FOUND TRUE) + #ament_lint_auto_find_test_dependencies() +#endif() + +ament_export_dependencies(${DEPENDENCIES}) + +set(INCLUDE + include +) + +include_directories(${INCLUDE}) +ament_export_include_directories(${INCLUDE}) + + +add_executable(publisher src/publisher.cpp) +ament_target_dependencies(publisher ${DEPENDENCIES}) +install(TARGETS + publisher + DESTINATION lib/${PROJECT_NAME}) + + + + add_library(subscriber SHARED src/subscriber.cpp) + ament_target_dependencies(subscriber + ${DEPENDENCIES} + ) + ament_export_targets(subscriber HAS_LIBRARY_TARGET) + install( + TARGETS subscriber + EXPORT subscriber + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + INCLUDES DESTINATION include + ) + + add_executable(subscriber_main src/subscriber_main.cpp) + ament_target_dependencies(subscriber_main + ${DEPENDENCIES} +) +target_link_libraries(subscriber_main + subscriber +) +install(TARGETS + subscriber_main + DESTINATION lib/${PROJECT_NAME}) + + +ament_add_gtest(onboard_test test/test.cpp) +target_link_libraries(onboard_test + subscriber + gtest +) + +install( + DIRECTORY include/ + DESTINATION include +) + +ament_package() + + + + + + + + + + + + + + + diff --git a/10_Examples/linh-onboarding/include/linh-onboarding/subscriber.hpp b/10_Examples/linh-onboarding/include/linh-onboarding/subscriber.hpp new file mode 100644 index 00000000..3c39edf0 --- /dev/null +++ b/10_Examples/linh-onboarding/include/linh-onboarding/subscriber.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include +#include "std_msgs/msg/string.hpp" +#include "std_msgs/msg/float32.hpp" +#include "rclcpp/rclcpp.hpp" + +using std::placeholders::_1; + +namespace onboarding{ + class Subscriber : public rclcpp::Node { + public: + Subscriber(); + void topic_callback(const std_msgs::msg::Float32::SharedPtr msg); + int add(int a, int b); + int subtract(int a, int b); + void do_nothing(); + + + private: + rclcpp::Subscription::SharedPtr subscription_; + }; + + + +} \ No newline at end of file diff --git a/10_Examples/linh-onboarding/package.xml b/10_Examples/linh-onboarding/package.xml new file mode 100644 index 00000000..c7c05fc5 --- /dev/null +++ b/10_Examples/linh-onboarding/package.xml @@ -0,0 +1,18 @@ + + + + linh-onboarding + 0.0.0 + TODO: Package description + root + TODO: License declaration + + ament_cmake + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/10_Examples/linh-onboarding/src/publisher.cpp b/10_Examples/linh-onboarding/src/publisher.cpp new file mode 100644 index 00000000..d7f6657e --- /dev/null +++ b/10_Examples/linh-onboarding/src/publisher.cpp @@ -0,0 +1,45 @@ +#include +#include +#include +#include +#include "rclcpp/rclcpp.hpp" +#include "std_msgs/msg/string.hpp" +#include "std_msgs/msg/float32.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 Publisher : public rclcpp::Node +{ + public: + Publisher() + : Node("onboarding_publisher"), count_(0) + { + publisher_ = this->create_publisher("topic", 10); + timer_ = this->create_wall_timer( + 500ms, std::bind(&Publisher::timer_callback, this)); + } + + private: + void timer_callback() + { + auto message = std_msgs::msg::Float32(); + message.data = static_cast(count_++); + RCLCPP_INFO(this->get_logger(), "Publishing: '%f'", message.data); + 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/10_Examples/linh-onboarding/src/subscriber.cpp b/10_Examples/linh-onboarding/src/subscriber.cpp new file mode 100644 index 00000000..5fab326d --- /dev/null +++ b/10_Examples/linh-onboarding/src/subscriber.cpp @@ -0,0 +1,29 @@ +#include "linh-onboarding/subscriber.hpp" + +namespace onboarding { + +Subscriber::Subscriber() : + Node("onboarding_subsriber"){ + subscription_ = this->create_subscription( + "onboarding_topic", 10, std::bind(&Subscriber::topic_callback, this, _1)); + +} + +void Subscriber::topic_callback(const std_msgs::msg::Float32::SharedPtr msg){ + RCLCPP_INFO(this->get_logger(), "The message is: '%f'",msg->data); +} + + rclcpp::Subscription::SharedPtr subscription_; + +int Subscriber::add(int a, int b){ + return a + b; +} +int Subscriber::subtract(int a, int b){ + return a - b; +} + +void Subscriber::do_nothing(){ +} + + +} \ No newline at end of file diff --git a/10_Examples/linh-onboarding/src/subscriber_main.cpp b/10_Examples/linh-onboarding/src/subscriber_main.cpp new file mode 100644 index 00000000..d7e41eaf --- /dev/null +++ b/10_Examples/linh-onboarding/src/subscriber_main.cpp @@ -0,0 +1,8 @@ +#include "linh-onboarding/subscriber.hpp" + +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/10_Examples/linh-onboarding/test/test.cpp b/10_Examples/linh-onboarding/test/test.cpp new file mode 100644 index 00000000..3814d79e --- /dev/null +++ b/10_Examples/linh-onboarding/test/test.cpp @@ -0,0 +1,37 @@ +#include +#include "linh-onboarding/subscriber.hpp" +#include + + +class TestExample : public ::testing::Test { +protected: + + TestExample(){ + subscriber_node_ = std::make_shared(); + } + + void SetUp() override { + } + + void TearDown() override { + } + std::shared_ptr subscriber_node_; +}; + +TEST_F(TestExample, testAdd){ + EXPECT_EQ(subscriber_node_->add(2, 3), 5); + EXPECT_TRUE(subscriber_node_->add(2, 3) == 5); + EXPECT_FALSE(subscriber_node_->add(2, 3) == 4); +} + +TEST_F(TestExample, testSubtract){ + EXPECT_EQ(subscriber_node_->subtract(2, 3), -1); + EXPECT_TRUE(subscriber_node_->subtract(5, 3) == 2); + EXPECT_FALSE(subscriber_node_->subtract(2, 3) == 4); +} + +int main(int argc, char **argv) { + rclcpp::init(argc, argv); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/10_Examples/will_onboarding1/CMakeLists.txt b/10_Examples/will_onboarding1/CMakeLists.txt new file mode 100644 index 00000000..514d5bf8 --- /dev/null +++ b/10_Examples/will_onboarding1/CMakeLists.txt @@ -0,0 +1,92 @@ +cmake_minimum_required(VERSION 3.8) +project(will_onboarding1) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +set(DEPENDENCIES + ament_cmake + ament_cmake_gtest + rclcpp + std_msgs +) + +foreach(pkg ${DEPENDENCIES}) + find_package(${pkg} REQUIRED) +endforeach() + +find_package(std_msgs REQUIRED) + + +# Tell any packages that depend on us what dependencies we need. +ament_export_dependencies(${DEPENDENCIES}) + +set(INCLUDE + include +) + +# Tells the package where all our header files live +include_directories(${INCLUDE}) + +# Tells any packages that depend on us what include files we use. +ament_export_include_directories(${INCLUDE}) + + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # comment the line when a copyright and license is added to all source files + set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # comment the line when this package is in a git repo and when + # a copyright and license is added to all source files + set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +#Creating a library for the class that I made +add_library(math_node SHARED src/Mather.cpp) +ament_target_dependencies(math_node +${DEPENDENCIES}) + +#exporting the library +ament_export_targets(math_node HAS_LIBRARY_TARGET) +install( + TARGETS math_node + EXPORT math_node + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + INCLUDES DESTINATION include +) + +#Main Method Stuff +add_executable(math_main_executable src/main.cpp) +ament_target_dependencies(math_main_executable + ${DEPENDENCIES} +) +target_link_libraries(math_main_executable +math_node) + +install(TARGETS +math_main_executable +DESTINATION lib/${PROJECT} +) + +#Gtest stuff +ament_add_gtest(test_example src/wills_test_file.cpp) +target_link_libraries(test_example + math_node + gtest +) + +install( + DIRECTORY include/ + DESTINATION include +) + + + +ament_package() diff --git a/10_Examples/will_onboarding1/include/will_onboarding1/Mather.hpp b/10_Examples/will_onboarding1/include/will_onboarding1/Mather.hpp new file mode 100644 index 00000000..19305865 --- /dev/null +++ b/10_Examples/will_onboarding1/include/will_onboarding1/Mather.hpp @@ -0,0 +1,62 @@ +#pragma once + +#include +#include +#include + +#include "rclcpp/rclcpp.hpp" +#include "std_msgs/msg/int32.hpp" + +namespace math_space { + +/* + Class defining the Mather class: + + The Mather class is a ROS node that can take in an input and output a corresponding value depending on the initial arguments the Mather + object is constructed with and which operation you want done. + + inputs - operations: + + 1 - addion + 2 - multiplication + 3 - subtraction + 4 - modulus + other - will simply output a 0 + + */ +class Mather : public rclcpp::Node { +public: + + /* + Mather Constructor, the parameters are the two argumets of the operation you want to perform + */ + Mather(int m_first, int m_second); + + /* + Parameter is the input value(read from a member variable that gets automatically updated in the subscriber callback function) and output + is the result of the operation + */ + int decode(int encoded); + + /* + This is the subscriber callback funtion, this function subscribes to the topic "/input_topic" and updates the member variable m_decode_int + */ + void topic_callback(const std_msgs::msg::Int32::SharedPtr msg); + + /* + This is the publisher callback funtion, this function outputs the result of the function "decode" to the topic "/output_topic" + */ + void timer_callback(); + +private: + int m_first;// this is the first element of the operation + int m_second;// this is the second element of the operation + int m_decode_int;// this is the member variable that stores the output for the function "decode" + + rclcpp::TimerBase::SharedPtr timer_; // this is a shared pointer to the ROS timer object + rclcpp::Publisher ::SharedPtr publisher_; // this is "Mather"'s publisher + rclcpp::Subscription::SharedPtr subscription_;// this is "Mather"'s subscriber + size_t count_;// I honestly don't know what this does. +}; + +} \ No newline at end of file diff --git a/10_Examples/will_onboarding1/package.xml b/10_Examples/will_onboarding1/package.xml new file mode 100644 index 00000000..08371a23 --- /dev/null +++ b/10_Examples/will_onboarding1/package.xml @@ -0,0 +1,22 @@ + + + + will_onboarding1 + 0.0.0 + TODO: Package description + will + TODO: License declaration + + ament_cmake + + rclcpp + std_msgs + ament_cmake_gtest + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/10_Examples/will_onboarding1/src/Mather.cpp b/10_Examples/will_onboarding1/src/Mather.cpp new file mode 100644 index 00000000..d411d2c5 --- /dev/null +++ b/10_Examples/will_onboarding1/src/Mather.cpp @@ -0,0 +1,55 @@ +#include "will_onboarding1/Mather.hpp" + +using namespace std::chrono_literals; +using namespace std; +using std::placeholders::_1; + +namespace math_space { + +Mather::Mather(int a, int b) : + Node("math_node"), + count_(0), + m_first(a), + m_second(b){ + // publisher stuff + publisher_ = this->create_publisher("/output_topic", 10); + timer_ = this->create_wall_timer( + 500ms, std::bind(&Mather::timer_callback, this)); + + // subscriber stuff + subscription_ = this->create_subscription( + "/input_topic", 10, std::bind(&Mather::topic_callback, this, _1)); +} + +int Mather::decode(int encoded){ + if(encoded == 1){ + return m_first + m_second; + } + else if(encoded == 2){ + return m_first * m_second; + } + else if(encoded == 3){ + return m_first - m_second; + } + else if(encoded == 4){ + return m_first % m_second; + } + else{ + return 0; + } +} + +// publisher callback +void Mather::timer_callback(){ + std_msgs::msg::Int32 msg; + msg.data = decode(m_decode_int); + RCLCPP_INFO(this->get_logger(), "the current value is: %d\n",(decode(m_decode_int))); + publisher_->publish(msg); +} + +// subscriber callback +void Mather::topic_callback(const std_msgs::msg::Int32::SharedPtr msg) { + this->m_decode_int = msg->data; +} + +} \ No newline at end of file diff --git a/10_Examples/will_onboarding1/src/main.cpp b/10_Examples/will_onboarding1/src/main.cpp new file mode 100644 index 00000000..513d6415 --- /dev/null +++ b/10_Examples/will_onboarding1/src/main.cpp @@ -0,0 +1,8 @@ +#include "will_onboarding1/Mather.hpp" + +int main(int argc, char * argv[]){ + rclcpp::init(argc, argv); + rclcpp::spin(std::make_shared(1,1)); + rclcpp::shutdown(); + return 0; +} \ No newline at end of file diff --git a/10_Examples/will_onboarding1/src/wills_test_file.cpp b/10_Examples/will_onboarding1/src/wills_test_file.cpp new file mode 100644 index 00000000..08863375 --- /dev/null +++ b/10_Examples/will_onboarding1/src/wills_test_file.cpp @@ -0,0 +1,42 @@ +#include "gtest/gtest.h" +#include "will_onboarding1/Mather.hpp" + +class MyTest : public ::testing::Test { +protected: + + MyTest(){ + node_ = std::make_shared(5,2); + } + + void SetUp() override { + } + + void TearDown() override { + } + std::shared_ptr node_; +}; + +TEST_F(MyTest, addTest){ + EXPECT_EQ((node_->decode(1)),7); +} +TEST_F(MyTest, multTest){ + EXPECT_EQ((node_->decode(2)),10); +} +TEST_F(MyTest, subTest){ + EXPECT_EQ((node_->decode(3)),3); +} +TEST_F(MyTest, modTest){ + EXPECT_EQ((node_->decode(4)),1); +} +TEST_F(MyTest, randTest){ + EXPECT_EQ((node_->decode(5)),0); +} + +int main(int argc, char **argv) { + // This line is always required if you are going to instantiate a ROS node. + // For testing regular C++ libraries, it should be excluded. + rclcpp::init(argc, argv); + // Standard GTest main + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} \ No newline at end of file diff --git a/10_Examples/zaara-onboarding/CMakeLists.txt b/10_Examples/zaara-onboarding/CMakeLists.txt new file mode 100644 index 00000000..6343a34e --- /dev/null +++ b/10_Examples/zaara-onboarding/CMakeLists.txt @@ -0,0 +1,80 @@ +cmake_minimum_required(VERSION 3.8) +project(zaara-onboarding) + +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +set(DEPENDENCIES + ament_cmake + ament_cmake_gtest + rclcpp + std_msgs + ) + + +foreach(pkg ${DEPENDENCIES}) + find_package(${pkg} REQUIRED) +endforeach() + +ament_export_dependencies(${DEPENDENCIES}) + +set(INCLUDE + include +) + +include_directories(${INCLUDE}) +ament_export_include_directories(${INCLUDE}) + + +add_executable(triv_method_publisher src/trivialmethodspublisher.cpp) +ament_target_dependencies(triv_method_publisher ${DEPENDENCIES}) +install(TARGETS + triv_method_publisher + DESTINATION lib/${PROJECT_NAME}) + +add_library(triv_method_subscriber SHARED src/trivialmethodssubscriber.cpp) +ament_target_dependencies(triv_method_subscriber + ${DEPENDENCIES} +) +ament_export_targets(triv_method_subscriber HAS_LIBRARY_TARGET) +install( + TARGETS triv_method_subscriber + EXPORT triv_method_subscriber + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + INCLUDES DESTINATION include +) + +add_executable(triv_method_main src/trivialmethodsmain.cpp) +ament_target_dependencies(triv_method_main + ${DEPENDENCIES} +) +target_link_libraries(triv_method_main + triv_method_subscriber +) +install(TARGETS + triv_method_main + DESTINATION lib/${PROJECT_NAME}) + + ament_add_gtest(onboarding_test test/tests.cpp) + target_link_libraries(onboarding_test + triv_method_subscriber + gtest + ) + + install( + DIRECTORY include/ + DESTINATION include + ) + + + + +ament_package() \ No newline at end of file diff --git a/10_Examples/zaara-onboarding/include/zaara-onboarding/trivialmethodssubscriber.hpp b/10_Examples/zaara-onboarding/include/zaara-onboarding/trivialmethodssubscriber.hpp new file mode 100644 index 00000000..a19f833a --- /dev/null +++ b/10_Examples/zaara-onboarding/include/zaara-onboarding/trivialmethodssubscriber.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include +#include "std_msgs/msg/string.hpp" +#include "std_msgs/msg/float32.hpp" +#include "rclcpp/rclcpp.hpp" + +using std::placeholders::_1; + +namespace myonboarding{ + class TrivMethodSubscriber : public rclcpp::Node { + public: + TrivMethodSubscriber(); + void topic_callback(const std_msgs::msg::String::SharedPtr msg); + float add_floats(float a, float b); + + + private: + rclcpp::Subscription::SharedPtr subscription_; + }; + + + +} \ No newline at end of file diff --git a/10_Examples/zaara-onboarding/package.xml b/10_Examples/zaara-onboarding/package.xml new file mode 100644 index 00000000..8b1958b7 --- /dev/null +++ b/10_Examples/zaara-onboarding/package.xml @@ -0,0 +1,18 @@ + + + + zaara-onboarding + 0.0.0 + TODO: Package description + zaara + TODO: License declaration + + ament_cmake + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/10_Examples/zaara-onboarding/src/trivialmethodsmain.cpp b/10_Examples/zaara-onboarding/src/trivialmethodsmain.cpp new file mode 100644 index 00000000..0aed3353 --- /dev/null +++ b/10_Examples/zaara-onboarding/src/trivialmethodsmain.cpp @@ -0,0 +1,8 @@ +#include "zaara-onboarding/trivialmethodssubscriber.hpp" + +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/10_Examples/zaara-onboarding/src/trivialmethodspublisher.cpp b/10_Examples/zaara-onboarding/src/trivialmethodspublisher.cpp new file mode 100644 index 00000000..3b353eb1 --- /dev/null +++ b/10_Examples/zaara-onboarding/src/trivialmethodspublisher.cpp @@ -0,0 +1,45 @@ +#include +#include +#include +#include +#include "std_msgs/msg/string.hpp" +#include "rclcpp/rclcpp.hpp" + + +//a little confused about what chrono_literals is +using namespace std::chrono_literals; + +class TrivMethodPublisher : public rclcpp::Node +{ + public: + TrivMethodPublisher() + : Node("onboarding_publisher"), count_(0) + { + publisher_ = this->create_publisher("onboarding_topic", 10); + timer_ = this->create_wall_timer( + 500ms, std::bind(&TrivMethodPublisher::timer_callback, this)); + } + + private: + void timer_callback() + { + auto message = std_msgs::msg::String(); + //changing counter to be a string + message.data = "Useless Counter: " + std::to_string(count_+=2); + + RCLCPP_INFO(this->get_logger(), "'%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/10_Examples/zaara-onboarding/src/trivialmethodssubscriber.cpp b/10_Examples/zaara-onboarding/src/trivialmethodssubscriber.cpp new file mode 100644 index 00000000..5e1c9316 --- /dev/null +++ b/10_Examples/zaara-onboarding/src/trivialmethodssubscriber.cpp @@ -0,0 +1,26 @@ +#include "zaara-onboarding/trivialmethodssubscriber.hpp" + +namespace myonboarding { + +TrivMethodSubscriber::TrivMethodSubscriber() : Node("onboarding_subscriber") { + subscription_ = this->create_subscription( + "onboarding_topic", 10, std::bind(&TrivMethodSubscriber::topic_callback, this, _1)); +} + +void TrivMethodSubscriber::topic_callback(const std_msgs::msg::String::SharedPtr msg) { + //adds two float values and outputs that along with message gotten from publisher + //made two variables for the floats because I was trying to make it randomly select two values, + //but I couldn't figure out how I would set a range of values to choose from + float float1 = 1.5; + float float2 = 2.5; + float float_addition = add_floats(float1, float2); + + RCLCPP_INFO(this->get_logger(), "Float addition value is: '%f' and message is: '%s'", float_addition, msg->data.c_str()); +} + +float TrivMethodSubscriber::add_floats(float a, float b) { + return a + b; +} + +} + diff --git a/10_Examples/zaara-onboarding/test/tests.cpp b/10_Examples/zaara-onboarding/test/tests.cpp new file mode 100644 index 00000000..8283ca4c --- /dev/null +++ b/10_Examples/zaara-onboarding/test/tests.cpp @@ -0,0 +1,31 @@ +#include "zaara-onboarding/trivialmethodssubscriber.hpp" +#include "gtest/gtest.h" + +class OnboardingTest : public ::testing::Test { +protected: + + OnboardingTest(){ + subscriber_node_ = std::make_shared(); + } + + void SetUp() override { + } + + void TearDown() override { + } + std::shared_ptr subscriber_node_; +}; + +//testing if addition of floats is working +TEST_F(OnboardingTest, testAddFloats){ + EXPECT_FLOAT_EQ(subscriber_node_->add_floats(2, 3), 5.0); +} + +int main(int argc, char **argv) { + + rclcpp::init(argc, argv); + + + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} \ No newline at end of file diff --git a/README.md b/README.md index 414f11ff..d1d30999 100644 --- a/README.md +++ b/README.md @@ -31,12 +31,15 @@ git submodule update --recursive #### Add Setup to ~/.bashrc (which "configures" a new terminal when you open it) ```sh echo "export VEXU_HOME=\"/home/$(whoami)/VEXU_GHOST\"" >> ~/.bashrc -source "$VEXU_HOME/scripts/setup_env.sh" - -``` echo 'source "$VEXU_HOME/scripts/setup_env.sh"' >> ~/.bashrc ``` Close this terminal, and open a new one to load new settings. +#### Go to the VEXU_GHOST directory (every time you open a new terminal) + +``` +cd ~/VEXU_GHOST +``` + #### Update Dependencies ```sh ./scripts/update_dependencies.sh diff --git a/Testing/Temporary/CTestCostData.txt b/Testing/Temporary/CTestCostData.txt new file mode 100644 index 00000000..ed97d539 --- /dev/null +++ b/Testing/Temporary/CTestCostData.txt @@ -0,0 +1 @@ +--- diff --git a/Testing/Temporary/LastTest.log b/Testing/Temporary/LastTest.log new file mode 100644 index 00000000..d12ac8fa --- /dev/null +++ b/Testing/Temporary/LastTest.log @@ -0,0 +1,3 @@ +Start testing: Mar 02 00:39 CST +---------------------------------------------------------- +End testing: Mar 02 00:39 CST diff --git a/cmake/GhostConfig.cmake b/cmake/GhostConfig.cmake index 3e79ce28..756ab740 100644 --- a/cmake/GhostConfig.cmake +++ b/cmake/GhostConfig.cmake @@ -34,18 +34,3 @@ add_definitions(-DGHOST_JETSON=1) add_definitions(-DGHOST_V5_BRAIN=2) add_definitions(-DGHOST_DEVICE=1) - -########################## -### Autolinter Testing ### -########################## -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # comment the line when a copyright and license is added to all source files - set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # comment the line when this package is in a git repo and when - # a copyright and license is added to all source files - set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() \ No newline at end of file