Skip to content
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

SyncParametersClient creation for a class inheriting from rclcpp::Node #599

Closed
alsora opened this issue Dec 4, 2018 · 3 comments
Closed
Labels
enhancement New feature or request

Comments

@alsora
Copy link
Collaborator

alsora commented Dec 4, 2018

Bug report

Required Info:

  • Operating System:
    • Ubuntu 18.04
  • Installation type:
    • from binary
  • DDS implementation:
    • Fast-RTPS
  • Client library (if applicable):
    • rclcpp

Steps to reproduce issue

#include "rclcpp/rclcpp.hpp"

class MyNode : public rclcpp::Node {

public:

    MyNode() : Node("my_node")
    {
        _async_param_client = std::make_shared<rclcpp::AsyncParametersClient>(this, "other_node");
        _sync_param_client = std::make_shared<rclcpp::SyncParametersClient>(this, "other_node");
    }

private:

    rclcpp::SyncParametersClient::SharedPtr _sync_param_client;
    rclcpp::AsyncParametersClient::SharedPtr _async_param_client;
};


Expected behavior

I create a new class which inherits from rclcpp::Node and I want to create synchronous and asynchronous parameter clients.

Actual behavior

The syncrhonous parameter client creation fails due to

/usr/include/c++/7/ext/new_allocator.h:136:4: error: no matching function for call to ‘rclcpp::SyncParametersClient::SyncParametersClient(MyNode*, const char [11])’
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }

On the other hand the asynchronous parameter client works.

It still do not work if I pass as argument this->get_node_base_interface()

@clalancette
Copy link
Contributor

Right, it looks like that on bouncy, we just don't have an overloaded SyncParametersClient constructor that takes in an rclcpp::Node *, while we do have one for AsyncParametersClient. I'll mark this as an enhancement, though it is a fairly low priority for us at the moment. If you have time to add that constructor, that would move it along faster. Thanks.

@clalancette clalancette added the enhancement New feature or request label Dec 6, 2018
@alsora
Copy link
Collaborator Author

alsora commented Dec 10, 2018

Ok perfect, I will make a PR very soon.

@wjwwood
Copy link
Member

wjwwood commented Dec 12, 2018

You could use this->shared_from_this(), but that won't work in the constructor.

So a raw pointer version would be good.

@alsora alsora closed this as completed Dec 20, 2018
nnmm pushed a commit to ApexAI/rclcpp that referenced this issue Jul 9, 2022
* Add tests for time.c module
* Add test for function rcl_timer_clock
* Fix linter style issues
* Add test for rcl_timer_call
* Add callback test and improve call test
* Add fixture class to reuse timer init/fini code
* Change error code returned to match function being tested
* Add tests for timer_reset function
* Add tests for exchange_callback function
* Add null parameter test for get guard condition
* Add allocator testing tools auxiliar file
* Add tests for failing ini/fini conditions
* Add test for get_period function
* Add test to get_time_since_last_call
* Remove comment related to variable names
* Fix return value on test case for fini clock
* Address peer review comments
* Fix CLang warning, replacing NULL with false

Signed-off-by: Jorge Perez <jjperez@ekumenlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants