Questions tagged [rclcpp]
The rclcpp tag has no usage guidance.
76
questions
1
vote
0
answers
32
views
error: no type named ‘type’ in ‘struct std::enable_if<false, void>’ when calling rclcpp::create_timer()
I am trying to convert a piece of code written in ROS1 to ROS2. I am having trouble with the following line, which instantiates a ros:::Timer object:
in ROS1:
...
0
votes
0
answers
19
views
rclcpp::spin_until_future_complete(): Timeout for "non-blocking" call
tl;dr
Expected behaviour: Having a non-blocking spin.
Current behaviour: spin_until_future_complete() always returns timeout without firing any topic callback
Hi, I am working on implementing the ...
1
vote
0
answers
13
views
Pybind11 python bindings for Node
I'm currently creating python bindings for libhri, a ROS C++ library on Humble. The current C++ implementation (not public yet) takes a rclcpp::Node::SharedPtr argument to internally create topic ...
0
votes
1
answer
38
views
How to stop the subscription to "/parameter_events" that is automatically created in each node
I have been able to stop the publisher to the topic (/parameter_events) by setting start_parameter_event_publisher in ...
0
votes
1
answer
26
views
What is the difference between RCL_STEADY_TIME, RCL_SYSTEM_TIME and RCL_ROS_TIME?
I wrote the following code to check the difference myself, but I could not find any considerable difference.
...
0
votes
0
answers
40
views
ROS2 rclcpp serialization : Cannot deserialize message of type geometry_msgs/msg/transform_stamped
I'm trying to plot the trajectory of a Crazyflie2 drone which is record on the /tf topic of a rosbag. I reused the code copied the code from this ROS2 tutorial (https://docs.ros.org/en/rolling/...
0
votes
1
answer
55
views
exception thrown in rcl_logging_rosout_remove_sublogger on destruction with a child logger with static lifetime
I believe this is likely a bug. Here is a minimal example and the output with a stack trace (made with backwardcpp):
...
0
votes
0
answers
23
views
Example for using ROS2 Moveit2's asyncExecute()
I would like to use the asyncExecute() function offered by Moveit2 CPP API (ROS2 Humble), and then monitor the status of execution.
I searched for a bit and only ...
0
votes
1
answer
40
views
rclcpp::Time epochs
I would like to get seconds, and nanoseconds from inside my node, so I have a timer_callback that executes each 100ms, to note seconds and nanoseconds of the rclcpp::Time
...
1
vote
0
answers
90
views
spin_until_future_complete in an already spinning node
I’m making a program, this program has a rclcpp::node and is running with several threads. In the main thread I have
executor.add_node(node);
executor.spin();
this ...
0
votes
1
answer
37
views
How can I call a member method which is inside a ROS2 node class?
I have a node class shown below and I want to call its setCloud method from another class but it gives me the error:
error: ‘using element_type = class rclcpp::Node’ {aka ‘class
rclcpp::Node’} has no ...
0
votes
1
answer
14
views
Getting current log directory in a CPP Node
I have a different process in my CPP node that writes a separate log file.
Right now, this log is written to a file in ros2_ws/log/additional_process.log but I ...
0
votes
1
answer
95
views
ROS2 CPP file only second logger
For a specific ROS2 (humble) node that I'm working on I want to add a second logger that just logs to a file (preferably its own). Setting up a second logger is straightforward, as one can just call <...
0
votes
0
answers
12
views
Recall global parameters: std::shared_future<std::vector<rclcpp::Parameter>>
I'm looking to retrive some global parameters (the name of my topics) from an yaml file that is shared by a global_parameter_server node. Now from another node I'm trying to recall these parameters.I'...
0
votes
1
answer
120
views
fatal error: rclcpp/rclcpp.hpp: No such file or directory
I already build some others packages without errors, but now i'm trying to build a library now and i have this error: fatal error: rclcpp/rclcpp.hpp: No such file or directory
10 | #include "...
3
votes
1
answer
206
views
Start and stop a node from another node with no system call (ROS2 CPP)
The issue I'm reporting is quite common looking at similar questions:
Shutdown a node from another node in ROS CPP
Start or stop the ROS node in another node
Could a node can be stoped by another node?...
0
votes
0
answers
33
views
How to handle cascaded service calls in ROS2 node integration tests with gtest (C++)
I want to write some integration tests for my ROS2 node (Humble) that provides an service which in turn calls a service. While during runtime this works perfectly fine, when I try to create a unit ...
0
votes
1
answer
198
views
ROS2 - Initialize rclcpp within a class (for tests)
I'm trying to write some tests for my package. Since there's the option of using fixtures, I planned on using those, but I came across this problem.
I've created a test class like so
...
0
votes
1
answer
233
views
ament_target_dependencies not linking an upstream ament package?
Background
Upstream pkg (called rclcpp_sample) provides a library-a.
Downstream pkg (called rclcpp_child_sample) provides an executable that depends on library-a.
Both are ...
0
votes
1
answer
31
views
Deprecating a ROS 2 parameter name
ros-perception/image_transport_plugins was ported across from ROS 1 to ROS 2 a while back. During the port, some parameters were given the wrong parameter name. We are trying to revert the parameter ...
0
votes
1
answer
6
views
Dynamic TF Publishing Discrepancy Between Foxy and Humble
I have posted an issue on GitHub; however, no one responds to it. So I start to wonder if it is my own mistake.
It begins from one day when I transform a piece of ROS foxy code into the Humble ...
1
vote
1
answer
40
views
Is it possible to set up intra process communications b/w 1 publisher and multiple subscribers?
I was reading this tutorial: https://docs.ros.org/en/humble/Tutorials/Demos/Intra-Process-Communication.html
Is it possible to have multiple subscribers to the published message? How does the unique ...
0
votes
2
answers
7
views
the same msg type of multiple topic names can use only one callback on ros2?
Hello,
I have /camera_1, /camera_2, /camera_3 and ...
2
votes
3
answers
1k
views
VS Code C/C++ extension Issue with ros program header file
Recently, when I was trying to compile a ROS programm written in C++ (with C/C++ extension installed in VSCode) I ran in to a problem with the header files included in the program (...
3
votes
1
answer
641
views
How do you automate fixing formatting errors found by ament_cpplint?
I'm working on a PR for rclcpp, and when I run the tests, I get formatting errors about white space from cpplint. Is there any automated way to fix these? Here is an example:
...
0
votes
1
answer
48
views
error: no matching function for call to create_subscription
Hello,
I'm trying to run orbslam2 on a tello drone using ros 2 (foxy distro, ubuntu 20.04).
For the purpose, I am trying to use this repository:
https://github.com/tentone/tello-ros2
What I managed to ...
0
votes
1
answer
7
views
How to access executable for ComposableNodeContainer for gdb debugging?
I have a .py launch file that defines two composable node descriptions: desc1 and desc2, each of which describe two nodes that ...
0
votes
1
answer
12
views
Communication between rclpy client and rlcpp server
I am working on converting a ros 1 (noetic) project to ros 2 (foxy). I am on Ubuntu 20.04 I am running into an issue where the python node call the service and the cpp node receives the request and ...
0
votes
1
answer
13
views
ROS2 gmock for external libraries
Hi all,
I am trying to implement unit testing in my ROS2 project. I used to work with python and ROS1, where I had experience with pytest and nose. Now I am using ROS2-foxy, C++ and I've chosen gtest, ...
0
votes
1
answer
28
views
Getting the rclcpp::Duration in microseconds
Hello everyone!
I am trying to calculate the time it takes for a single message from one Node to get to the other Node.
The way I calculate the difference is by substituting the timestamp of the ...
1
vote
1
answer
7
views
Is there a concise way to initialize a message with specific values?
Whenever I need to instantiate a message with specific values (in test code, for example), I end up writing something like this:
...
0
votes
1
answer
18
views
Node publishes only half of expected frequency
I'm writing a ROS2 C++ node for a camera. In the code we create a callback from the camera driver which then publishes the image. When we measure the topic frequency we only get half the actual ...
0
votes
1
answer
12
views
Intra-Process Communication between Components in Container
Is it possible to take advantage of Intra Process Comms (IPC) when starting nodes in a container? I've made an example, trying to made a basic subscriber and publisher and looking at the pointer ...
0
votes
2
answers
67
views
`rclcpp::Clock(RCL_ROS_TIME).now()` vs. `node_->get_clock()->now()`
Is rclcpp::Clock(RCL_ROS_TIME).now() always the same as node_->get_clock()->now()?
Originally posted by galou on ROS ...
0
votes
1
answer
29
views
Wait for subscriber to exist?
I would like for one node to wait for a subscriber to a topic to exist before publishing to it. Is there a straightforward way to do that in rclcpp?
I'm developing on rolling if that matters.
...
0
votes
1
answer
14
views
Wrap rclcpp::Node with basic Lifecycle behavior?
I have a system built leveraging multiple rclcpp::Lifecycle nodes for managing system lifecycle. I would like to include an external non-lifecycle node in this system, but ideally allow it to be ...
0
votes
1
answer
12
views
[ROS2] ros2 command stucks without exit
Hi,
I'm planning to convert my code to ROS2 Galactic. So i installed on all my machines ROS2 Galactic beside Foxy.
Now I have a problem only on one PC:
After sourcing ROS2 Galactic ...
0
votes
1
answer
66
views
ROS2 lookupTransform() - cannot get transform at time now()
I am having issues acquiring transformation at the required time using lookupTransform()
It works as expected when I use ...
0
votes
1
answer
1
view
node_interface for now?
The node_interfaces (https://github.com/ros2/rclcpp/tree/master/rclcpp/include/rclcpp/node_interfaces) are really useful for dependency injection allowing much nicer tests. There however does not ...
0
votes
1
answer
6
views
ROS2 one action client calling multiple servers
I would like to call multiple action servers with a single client, however, with the current rclcpp implementation server name is only passed in the constructor, so ...
0
votes
1
answer
8
views
Getting node name namespace from rclcpp
Hi is there a way to get to a node namespace in some clean way before that node is constructed using make shared?
Processing argv doesn't seem like a good idea :/
Let's say
...
0
votes
1
answer
18
views
ros2_control - Created node by ControllerInterface gets nodename of controller_manager no matter what (diff_drive_controller)
Hi!
I started to work with ros2_control and want to set it up with a diff_drive_controller. Therefore I wrote an Actuator that implements the handling of my motors.
The issue I now have is that when ...
0
votes
1
answer
11
views
Linker error for geometry_msgs
Hi,
I explore ros2 recently. Differences with ros, creating custom messages, pub sub examples for c++ etc.
I just wanted to demonstrate that another package can be used in a custom message.
I ...
0
votes
1
answer
9
views
How to set NodeOptions for a ComposableNode in a .launch.py file?
I'm modifying a ROS2 node to be a component, and I'm trying to set additional node options when launching this node. Here is a snippet from a genericized but representative launch file:
...
0
votes
1
answer
17
views
ROS2 Resolve topic names rclcpp
In ros1 cpp I was able to resolve a string containing the topic name to the actual topic name that accounts for remappings using the following block:
...
0
votes
1
answer
19
views
[ROS2][rclcpp][services] Service not being created
I am attempting to write a ROS2 SetBool Service.
I am getting no compile-time errors, and I am getting to a logger message that is placed after I call the ...
0
votes
1
answer
41
views
How to print a message to stdout in ROS2?
I am porting C++ code from ROS1 to ROS2. Apparently there was an operator<< automatically generated for messages in ROS1 but that's no longer (or not yet) ...
0
votes
1
answer
3
views
exampe of using AsyncParametersClient for multiple params
I am trying to use a parameter node to store all the params that define a robot using the guide HERE.
The examples show are for only one param, how would you do set it up for multiple params? Do I ...
0
votes
1
answer
50
views
tf::createQuaternionFromYaw equivalent in ros2
How should I create a quaternion of a simple yaw (zaxis) rotation in ros2?
The alternative in ros1 were essentially tf::createQuaternionMsgFromYaw or ...
0
votes
1
answer
12
views
Where are ros2 message ostream operators for c++ logging?
Hello.
I am trying to use RCLCPP_XX_STREAM function passing directly a message to the stream. The problem is that I am getting compilation errors because the message ostream operators are not found.
...