-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ROS 2 lights converter #223
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like the structure of this package. I pointed out a few minor things that, in my opinion, would look better. What are we doing with the header files? "" or <>? xd
@@ -0,0 +1,42 @@ | |||
// Copyright 2023 Husarion sp. z o.o. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update it to 2024?
{ | ||
public: | ||
/** | ||
* @brief Virtual LED segment of the robot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to move this description to the class brief. In my opinion, it would be better to add short descriptions to all or most impoertant classes in this package as it becomes more complex.
panther_lights/src/led_segment.cpp
Outdated
|
||
#include <panther_lights/animation/animation.hpp> | ||
|
||
#include <iostream> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it unused?
|
||
~LEDPanel() = default; | ||
|
||
void UpdateFrame(const std::size_t iterator_first, const std::vector<std::uint8_t> & values); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just a suggestion, but maybe we could add a short description and information about exceptions here?
std::size_t first_led_iterator_; | ||
std::size_t last_led_iterator_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure it is an iterator? Maybe something similar to first_led_position_
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Methods from algorithm library use "iterator" naming and I was using this logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with iterator 🤓
auto segment_desc = | ||
YAML::Load("{led_range: 0-" + std::to_string(segment_led_num_ - 1) + ", channel: 1}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto segment_desc = | |
YAML::Load("{led_range: 0-" + std::to_string(segment_led_num_ - 1) + ", channel: 1}"); | |
const auto segment_desc = | |
YAML::Load("{led_range: 0-" + std::to_string(segment_led_num_ - 1) + ", channel: 1}"); |
led_segment_ = std::make_shared<panther_lights::LEDSegment>(segment_desc, controller_freq); | ||
} | ||
|
||
// this method may be moved to utils |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good idea. Should we do it now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looked at it and it may be a bit tricky - test_utils have dependencie on rclcpp. There is no point in adding rclcpp dependencies in here. The best solution, I guess, is to devide test_utils into 2 files(for ros and non ros utils). This however makes need for changes in other repositories using current test_utils and I dont nkow if it is a good idea to make them in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, so it's up to you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make another PR with this
|
||
TEST(TestLEDSegmentInitialization, ValidDescription) | ||
{ | ||
auto segment_desc = YAML::Load("{led_range: 0-10, channel: 1}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto segment_desc = YAML::Load("{led_range: 0-10, channel: 1}"); | |
const auto segment_desc = YAML::Load("{led_range: 0-10, channel: 1}"); |
|
||
TEST(TestLEDSegmentInitialization, DescriptionMissingRequiredKey) | ||
{ | ||
auto segment_desc = YAML::Load(""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we move it to function like CreateSegmentDescription() in test_segment_converter.cpp?
auto anim_desc = YAML::Load( | ||
"{type: panther_lights::ImageAnimation, " | ||
"image: $(find panther_lights)/animations/triangle01_red.png, " | ||
"duration: 2}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with this. Could we move it to function?
* ROS 2 lights animations (#221) * add animation and image_animation class * controller node and pluginlib * add tests and fix issues * add animation images * add alpha channel * add charging animation with tests * update dummy controller * fix missing includes * add missing dep * Update panther_lights/include/panther_lights/animation/animation.hpp Co-authored-by: Paweł Kowalski <82044322+pkowalsk1@users.noreply.github.com> * Update panther_lights/include/panther_lights/animation/animation.hpp Co-authored-by: Paweł Kowalski <82044322+pkowalsk1@users.noreply.github.com> * review changes * update tests --------- Co-authored-by: Paweł Kowalski <82044322+pkowalsk1@users.noreply.github.com> * ROS 2 lights converter (#223) * add led_segment * WIP led_panel and segment converter * simplify converter * update segment conversion * add test for led panel, segment, and converter * review fixes * update copyright year * update controller so it somehow works * Update tests * Apply review fixes * fix gpio tests * parse controller configuration * add default animation * add yaml_utils to panther_utils * add led animation and queue * Fix queuing * fix bug * priority and timeout queue validation * move queue to separate file * add briefs * param and brightness handle * user animations, bugs, briefs * use yaml utils * fix tests * update tests * add led_animation test * test fixxes * add led animations queue tests * clean up code | clean up code * Update documentation | add launching controller node * make it work * update scheduler * Update panther_lights/LIGHTS_API.md Co-authored-by: Paweł Irzyk <108666440+pawelirh@users.noreply.github.com> * review fixes * update pre-commit and fix typos * Update panther_bringup/README.md Co-authored-by: rafal-gorecki <126687345+rafal-gorecki@users.noreply.github.com> * Update panther_hardware_interfaces/README.md Co-authored-by: rafal-gorecki <126687345+rafal-gorecki@users.noreply.github.com> * Update panther_lights/README.md Co-authored-by: rafal-gorecki <126687345+rafal-gorecki@users.noreply.github.com> * Update panther_lights/test/test_controller_node.cpp Co-authored-by: rafal-gorecki <126687345+rafal-gorecki@users.noreply.github.com> * review fixes * Update README.md --------- Co-authored-by: Paweł Kowalski <82044322+pkowalsk1@users.noreply.github.com> Co-authored-by: Paweł Irzyk <108666440+pawelirh@users.noreply.github.com> Co-authored-by: rafal-gorecki <126687345+rafal-gorecki@users.noreply.github.com>
This is a basic converter and most likely its functionality may change and be extended. Right now it is hard to predict what will be required by controller and I want to avoid rewriting parts of code.
The converter has only one simple method, this may change when implementing controller that's why I've put it inside separate files.