Skip to content

Commit

Permalink
build ok
Browse files Browse the repository at this point in the history
  • Loading branch information
antbono committed Apr 15, 2024
1 parent 6ddfa48 commit 41e600d
Show file tree
Hide file tree
Showing 11 changed files with 675 additions and 697 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/build_and_test_humble.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ros-tooling/setup-ros@v0.7
#with:
# use-ros2-testing: true
with:
use-ros2-testing: true
- uses: ros-tooling/action-ros-ci@v0.3
with:
skip-tests: true
target-ros2-distro: humble
colcon-defaults: |
{
"build": {
"symlink-install": false
}
}
vcs-repo-file-url: dependencies.repos
11 changes: 2 additions & 9 deletions .github/workflows/build_and_test_iron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ros-tooling/setup-ros@v0.7
#with:
# use-ros2-testing: true
with:
use-ros2-testing: true
- uses: ros-tooling/action-ros-ci@v0.3
with:
skip-tests: true
target-ros2-distro: iron
colcon-defaults: |
{
"build": {
"symlink-install": false
}
}
vcs-repo-file-url: dependencies.repos
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Build (humble)](https://github.com/antbono/nao_led/actions/workflows/build_and_test_humble.yaml/badge.svg)](https://github.com/antbono/nao_led/actions/workflows/build_and_test_humble.yaml)
[![Build (iron)](https://github.com/antbono/nao_led/actions/workflows/build_and_test_iron.yaml/badge.svg)](https://github.com/antbono/nao_led/actions/workflows/build_and_test_iron.yaml)
[![Build (rolling)](https://github.com/antbono/nao_led/actions/workflows/build_and_test_rolling.yaml/badge.svg)](https://github.com/antbono/nao_led/actions/workflows/build_and_test_rolling.yaml)
[![Build and test (humble)](https://github.com/antbono/nao_led/actions/workflows/build_and_test_humble.yaml/badge.svg)](https://github.com/antbono/nao_led/actions/workflows/build_and_test_humble.yaml)
[![Build and test (iron)](https://github.com/antbono/nao_led/actions/workflows/build_and_test_iron.yaml/badge.svg)](https://github.com/antbono/nao_led/actions/workflows/build_and_test_iron.yaml)
[![Build and test (rolling)](https://github.com/antbono/nao_led/actions/workflows/build_and_test_rolling.yaml/badge.svg)](https://github.com/antbono/nao_led/actions/workflows/build_and_test_rolling.yaml)

# nao_led

Expand Down
6 changes: 3 additions & 3 deletions nao_led_interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ rosidl_generate_interfaces(${PROJECT_NAME}
"msg/LedModes.msg"
"action/LedsPlay.action"
DEPENDENCIES geometry_msgs
)
)

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)
#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)
#set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()

Expand Down
7 changes: 3 additions & 4 deletions nao_led_interfaces/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
<buildtool_depend>ament_cmake</buildtool_depend>

<depend>geometry_msgs</depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<test_depend>ament_cmake_clang_format</test_depend>
<buildtool_depend>rosidl_default_generators</buildtool_depend>
<exec_depend>rosidl_default_runtime</exec_depend>
<member_of_group>rosidl_interface_packages</member_of_group>


<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
Expand Down
4 changes: 2 additions & 2 deletions nao_led_server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ 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)
#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)
#set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()

Expand Down
110 changes: 55 additions & 55 deletions nao_led_server/include/nao_led_server/led_action_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,68 +18,68 @@
#include <functional>
#include <future>
#include <memory>
#include <string>
#include <sstream>
#include <string>

#include "ament_index_cpp/get_package_share_directory.hpp"
#include "boost/filesystem.hpp"

#include "rclcpp/rclcpp.hpp"
#include "rclcpp_action/rclcpp_action.hpp"
#include "rclcpp_components/register_node_macro.hpp"

#include "nao_led_interfaces/action/leds_play.hpp"
#include "nao_led_interfaces/msg/led_indexes.hpp"
#include "nao_led_interfaces/msg/led_modes.hpp"
#include "nao_lola_command_msgs/msg/chest_led.hpp"
#include "nao_lola_command_msgs/msg/head_leds.hpp"
#include "nao_lola_command_msgs/msg/right_eye_leds.hpp"
#include "nao_lola_command_msgs/msg/left_ear_leds.hpp"
#include "nao_lola_command_msgs/msg/left_eye_leds.hpp"
#include "nao_lola_command_msgs/msg/left_foot_led.hpp"
#include "nao_lola_command_msgs/msg/right_ear_leds.hpp"
#include "nao_lola_command_msgs/msg/left_ear_leds.hpp"
#include "nao_lola_command_msgs/msg/chest_led.hpp"
#include "nao_lola_command_msgs/msg/right_eye_leds.hpp"
#include "nao_lola_command_msgs/msg/right_foot_led.hpp"
#include "nao_lola_command_msgs/msg/left_foot_led.hpp"

#include "nao_led_interfaces/action/leds_play.hpp"
#include "nao_led_interfaces/msg/led_indexes.hpp"
#include "nao_led_interfaces/msg/led_modes.hpp"
#include "nao_led_interfaces/action/leds_play.hpp"

#include "rclcpp/rclcpp.hpp"
#include "rclcpp_action/rclcpp_action.hpp"
#include "rclcpp_components/register_node_macro.hpp"
#include "std_msgs/msg/color_rgba.hpp"

namespace nao_led_action_client {

class LedsPlayActionClient : public rclcpp::Node {
public:
explicit LedsPlayActionClient(const rclcpp::NodeOptions & options = rclcpp::NodeOptions{});
virtual ~LedsPlayActionClient();

void eyesStatic( bool flag );
void headStatic( bool flag );
void earsStatic( bool flag );
void chestStatic( bool flag );
void earsLoop( bool flag );
void headLoop( bool flag );
void eyesLoop( bool flag );

private:

void goalResponseCallback(
const rclcpp_action::ClientGoalHandle<nao_led_interfaces::action::LedsPlay>::SharedPtr & goal_handle);
void feedbackCallback(
rclcpp_action::ClientGoalHandle<nao_led_interfaces::action::LedsPlay>::SharedPtr,
const std::shared_ptr<const nao_led_interfaces::action::LedsPlay::Feedback> feedback);
void resultCallback(
const rclcpp_action::ClientGoalHandle<nao_led_interfaces::action::LedsPlay>::WrappedResult & result);


rclcpp_action::Client<nao_led_interfaces::action::LedsPlay>::SharedPtr client_ptr_;

rclcpp_action::ClientGoalHandle<nao_led_interfaces::action::LedsPlay>::SharedPtr head_goal_handle_;
//std::shared_future<nao_led_interfaces::action::LedsPlay::Impl::CancelGoalService::Response::SharedPtr> head_goal_handle_;
rclcpp_action::ClientGoalHandle<nao_led_interfaces::action::LedsPlay>::SharedPtr eyes_goal_handle_;
rclcpp_action::ClientGoalHandle<nao_led_interfaces::action::LedsPlay>::SharedPtr ears_goal_handle_;


}; // LedsPlayActionClient

} // nao_led_action_client

#endif // NAO_LED_SERVER__LED_ACTION_CLIENT_HPP_
namespace nao_led_action_client
{

class LedsPlayActionClient : public rclcpp::Node
{
public:
explicit LedsPlayActionClient(const rclcpp::NodeOptions & options = rclcpp::NodeOptions{});
virtual ~LedsPlayActionClient();

void eyesStatic(bool flag);
void headStatic(bool flag);
void earsStatic(bool flag);
void chestStatic(bool flag);
void earsLoop(bool flag);
void headLoop(bool flag);
void eyesLoop(bool flag);

private:
void goalResponseCallback(
const rclcpp_action::ClientGoalHandle<nao_led_interfaces::action::LedsPlay>::SharedPtr &
goal_handle);
void feedbackCallback(
rclcpp_action::ClientGoalHandle<nao_led_interfaces::action::LedsPlay>::SharedPtr,
const std::shared_ptr<const nao_led_interfaces::action::LedsPlay::Feedback> feedback);
void resultCallback(
const rclcpp_action::ClientGoalHandle<nao_led_interfaces::action::LedsPlay>::WrappedResult &
result);

rclcpp_action::Client<nao_led_interfaces::action::LedsPlay>::SharedPtr client_ptr_;

rclcpp_action::ClientGoalHandle<nao_led_interfaces::action::LedsPlay>::SharedPtr
head_goal_handle_;
// std::shared_future<nao_led_interfaces::action::LedsPlay::Impl::CancelGoalService::Response::SharedPtr>
// head_goal_handle_;
rclcpp_action::ClientGoalHandle<nao_led_interfaces::action::LedsPlay>::SharedPtr
eyes_goal_handle_;
rclcpp_action::ClientGoalHandle<nao_led_interfaces::action::LedsPlay>::SharedPtr
ears_goal_handle_;

}; // LedsPlayActionClient

} // namespace nao_led_action_client

#endif // NAO_LED_SERVER__LED_ACTION_CLIENT_HPP_
147 changes: 72 additions & 75 deletions nao_led_server/include/nao_led_server/led_action_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,97 +21,94 @@
//#include <vector>
#include <array>
//#include <chrono>
#include <string> // std::string, std::stof
#include <cstring>
#include <iostream> // std::cout

#include "rclcpp/rclcpp.hpp"
#include "rclcpp_action/rclcpp_action.hpp"
#include "rclcpp_components/register_node_macro.hpp"
#include <iostream> // std::cout
#include <string> // std::string, std::stof

#include "nao_led_interfaces/action/leds_play.hpp"
#include "nao_led_interfaces/msg/led_indexes.hpp"
#include "nao_led_interfaces/msg/led_modes.hpp"
#include "nao_lola_command_msgs/msg/chest_led.hpp"
#include "nao_lola_command_msgs/msg/head_leds.hpp"
#include "nao_lola_command_msgs/msg/right_eye_leds.hpp"
#include "nao_lola_command_msgs/msg/left_ear_leds.hpp"
#include "nao_lola_command_msgs/msg/left_eye_leds.hpp"
#include "nao_lola_command_msgs/msg/left_foot_led.hpp"
#include "nao_lola_command_msgs/msg/right_ear_leds.hpp"
#include "nao_lola_command_msgs/msg/left_ear_leds.hpp"
#include "nao_lola_command_msgs/msg/chest_led.hpp"
#include "nao_lola_command_msgs/msg/right_eye_leds.hpp"
#include "nao_lola_command_msgs/msg/right_foot_led.hpp"
#include "nao_lola_command_msgs/msg/left_foot_led.hpp"


#include "nao_led_interfaces/msg/led_indexes.hpp"
#include "nao_led_interfaces/msg/led_modes.hpp"
#include "nao_led_interfaces/action/leds_play.hpp"

#include "rclcpp/rclcpp.hpp"
#include "rclcpp_action/rclcpp_action.hpp"
#include "rclcpp_components/register_node_macro.hpp"
#include "std_msgs/msg/color_rgba.hpp"


namespace nao_led_action_server
namespace nao_led_action_server
{

using LedsPlay = nao_led_interfaces::action::LedsPlay;
using GoalHandleLedsPlay = rclcpp_action::ServerGoalHandle<LedsPlay>;
using LedIndexes = nao_led_interfaces::msg::LedIndexes;
using LedModes = nao_led_interfaces::msg::LedModes;


class LedsPlayActionServer : public rclcpp::Node
class LedsPlayActionServer : public rclcpp::Node
{
public:
explicit LedsPlayActionServer(const rclcpp::NodeOptions & options = rclcpp::NodeOptions{});
virtual ~LedsPlayActionServer();

private:

rclcpp_action::Server<nao_led_interfaces::action::LedsPlay>::SharedPtr action_server_;
std::shared_ptr<rclcpp_action::ServerGoalHandle<nao_led_interfaces::action::LedsPlay>> goal_handle_;


rclcpp::Publisher<nao_lola_command_msgs::msg::HeadLeds>::SharedPtr head_pub_;
rclcpp::Publisher<nao_lola_command_msgs::msg::RightEyeLeds>::SharedPtr right_eye_pub_;
rclcpp::Publisher<nao_lola_command_msgs::msg::LeftEyeLeds>::SharedPtr left_eye_pub_;
rclcpp::Publisher<nao_lola_command_msgs::msg::RightEarLeds>::SharedPtr right_ear_pub_;
rclcpp::Publisher<nao_lola_command_msgs::msg::LeftEarLeds>::SharedPtr left_ear_pub_;
rclcpp::Publisher<nao_lola_command_msgs::msg::ChestLed>::SharedPtr chest_pub_;
rclcpp::Publisher<nao_lola_command_msgs::msg::RightFootLed>::SharedPtr right_foot_pub_;
rclcpp::Publisher<nao_lola_command_msgs::msg::LeftFootLed>::SharedPtr left_foot_pub_;

std_msgs::msg::ColorRGBA color_off_;
//color_off_.r=0.0; color_off_.g=0.0; color_off_.b=0.0;
nao_led_interfaces::msg::LedIndexes led_indexes_msg_;
nao_led_interfaces::msg::LedModes led_modes_msg_;


rclcpp_action::GoalResponse handleGoal(
const rclcpp_action::GoalUUID & uuid,
std::shared_ptr<const nao_led_interfaces::action::LedsPlay::Goal> goal);

rclcpp_action::CancelResponse handleCancel(
const std::shared_ptr<rclcpp_action::ServerGoalHandle<nao_led_interfaces::action::LedsPlay>> goal_handle);

void handleAccepted(
const std::shared_ptr<rclcpp_action::ServerGoalHandle<nao_led_interfaces::action::LedsPlay>> goal_handle);

void execute(
const std::shared_ptr<rclcpp_action::ServerGoalHandle<nao_led_interfaces::action::LedsPlay>> goal_handle);

void steadyMode(
const std::shared_ptr<rclcpp_action::ServerGoalHandle<nao_led_interfaces::action::LedsPlay>> goal_handle,
std::array<uint8_t, 2> & leds,
float frequency,
std::array<std_msgs::msg::ColorRGBA, 8> & colors, std::array<float, 12> & intensities);

bool blinkingMode(
const std::shared_ptr<rclcpp_action::ServerGoalHandle<nao_led_interfaces::action::LedsPlay>> goal_handle,
std::array<uint8_t, 2> & leds, float frequency,
std::array<std_msgs::msg::ColorRGBA, 8> & colors);

bool loopMode(
const std::shared_ptr<rclcpp_action::ServerGoalHandle<nao_led_interfaces::action::LedsPlay>> goal_handle,
std::array<uint8_t, 2> & leds, float frequency,
std::array<std_msgs::msg::ColorRGBA, 8> & colors);
public:
explicit LedsPlayActionServer(const rclcpp::NodeOptions & options = rclcpp::NodeOptions{});
virtual ~LedsPlayActionServer();

private:
rclcpp_action::Server<nao_led_interfaces::action::LedsPlay>::SharedPtr action_server_;
std::shared_ptr<rclcpp_action::ServerGoalHandle<nao_led_interfaces::action::LedsPlay>>
goal_handle_;

rclcpp::Publisher<nao_lola_command_msgs::msg::HeadLeds>::SharedPtr head_pub_;
rclcpp::Publisher<nao_lola_command_msgs::msg::RightEyeLeds>::SharedPtr right_eye_pub_;
rclcpp::Publisher<nao_lola_command_msgs::msg::LeftEyeLeds>::SharedPtr left_eye_pub_;
rclcpp::Publisher<nao_lola_command_msgs::msg::RightEarLeds>::SharedPtr right_ear_pub_;
rclcpp::Publisher<nao_lola_command_msgs::msg::LeftEarLeds>::SharedPtr left_ear_pub_;
rclcpp::Publisher<nao_lola_command_msgs::msg::ChestLed>::SharedPtr chest_pub_;
rclcpp::Publisher<nao_lola_command_msgs::msg::RightFootLed>::SharedPtr right_foot_pub_;
rclcpp::Publisher<nao_lola_command_msgs::msg::LeftFootLed>::SharedPtr left_foot_pub_;

std_msgs::msg::ColorRGBA color_off_;
// color_off_.r=0.0; color_off_.g=0.0; color_off_.b=0.0;
nao_led_interfaces::msg::LedIndexes led_indexes_msg_;
nao_led_interfaces::msg::LedModes led_modes_msg_;

rclcpp_action::GoalResponse handleGoal(
const rclcpp_action::GoalUUID & uuid,
std::shared_ptr<const nao_led_interfaces::action::LedsPlay::Goal> goal);

rclcpp_action::CancelResponse handleCancel(
const std::shared_ptr<rclcpp_action::ServerGoalHandle<nao_led_interfaces::action::LedsPlay>>
goal_handle);

void handleAccepted(
const std::shared_ptr<rclcpp_action::ServerGoalHandle<nao_led_interfaces::action::LedsPlay>>
goal_handle);

void execute(
const std::shared_ptr<rclcpp_action::ServerGoalHandle<nao_led_interfaces::action::LedsPlay>>
goal_handle);

void steadyMode(
const std::shared_ptr<rclcpp_action::ServerGoalHandle<nao_led_interfaces::action::LedsPlay>>
goal_handle,
std::array<uint8_t, 2> & leds, float frequency,
std::array<std_msgs::msg::ColorRGBA, 8> & colors, std::array<float, 12> & intensities);

bool blinkingMode(
const std::shared_ptr<rclcpp_action::ServerGoalHandle<nao_led_interfaces::action::LedsPlay>>
goal_handle,
std::array<uint8_t, 2> & leds, float frequency,
std::array<std_msgs::msg::ColorRGBA, 8> & colors);

bool loopMode(
const std::shared_ptr<rclcpp_action::ServerGoalHandle<nao_led_interfaces::action::LedsPlay>>
goal_handle,
std::array<uint8_t, 2> & leds, float frequency,
std::array<std_msgs::msg::ColorRGBA, 8> & colors);
};

}
} // namespace nao_led_action_server

#endif // NAO_LED_SERVER__LED_ACTION_SERVER_HPP_
#endif // NAO_LED_SERVER__LED_ACTION_SERVER_HPP_
Loading

0 comments on commit 41e600d

Please sign in to comment.