Skip to main content

Questions tagged [rclcpp]

rclcpp provides the standard C++ API for interacting with ROS 2.

Filter by
Sorted by
Tagged with
0 votes
1 answer
26 views

ROS2 rclcpp understanding get_topic_names_and_types()

I came across this function get_topic_names_and_types in rclcpp recently and I have a basic question about it. Output type is <...
aarsht7's user avatar
  • 113
1 vote
1 answer
40 views

How can I run (C++) unit tests without "spinning" the node?

[ros2 humble] Edit 2 - More general form of the question, but previous question below the line Generally speaking, when I run a unit test, I don't want to test that the ROS software works, I want to ...
Alex Shaver's user avatar
0 votes
1 answer
31 views

get_parameter() colcon build error `no matching function for call`

I have create a ros2 node which simply declares and get parameter. I am getting the following error. ...
Pratham's user avatar
  • 63
0 votes
1 answer
64 views

URDF File is not parsed, robot state publisher sees the robot description empty. RCLCPP does not exist in libexec?

After finishing the migration of a project for a simulation of a robot, my first launch file which i will provide later contains the robot state publisher, which I give the the robot description and ...
Omar El Sherbeny's user avatar
0 votes
0 answers
104 views

High frequency service call cause the freeze of service client on ros2

The service client sometimes freeze in spin_until_future_complete on high frequency service call. I run 1 service server and 3 service clients which call service on high frequency. I tested it on ros:...
kjjpc's user avatar
  • 1
0 votes
0 answers
12 views

how to construct a std::map of topic_name(std::string) as key and ros2 msg class(ptr) as value?

i need a std::map with topic_name as key and some-different-types of msgdata(or msgdata prt) as value in ros2, like ...
furynerd's user avatar
1 vote
1 answer
43 views

ROS2 example : colcon build --symlink-install,error~~

Ubuntu 20.04, ROS2-rolling. When I refer to https://docs.ros.org/en/rolling/Tutorials/Beginner-Client-Libraries/Colcon-Tutorial.html to execute colcon build --symlink-install, the compilation error: <...
longmarchw's user avatar
0 votes
0 answers
39 views

jazzy ros2 does not recognize rclcpp::ok(), rclcpp::sleep_for()

We just updated our robot stack from ROS2 Iron to ROS2 Jazzy, and we are facing a problem, when we are building package, we receive a build error, that ok() and sleep_for() is not a member of rclcpp <...
PDvorak's user avatar
0 votes
0 answers
22 views

How to verify if the camera is calibrated?

I am trying to perform RGB camera calibrations with ROS2 Humble on Ubuntu 22.04.4 . For this, I'm using cameras from LUCID connected with POE , model : Lucid Triton 54s-cc: https://thinklucid.com/...
Tlly's user avatar
  • 1
0 votes
0 answers
53 views

Failed to fetch current robot state when using MGI in wall timer callback function

I'm trying to use move_group_interface to get robot pose at a certain rate. So I put move_group_interface->getCurrentPose() in a function, and use ...
catmulti7's user avatar
2 votes
1 answer
42 views

ROS2 rclcpp subscriber callback uses same shared_ptr for each new message

I have an rclcpp node with some message data coming in (images, scans, etc). I would like to apply temporal filtering to this data, and therefore store a copy of each incoming message. I assumed ...
edgex004's user avatar
0 votes
1 answer
27 views

Is there any way to directly pass a closure to the event loop of a node, bypassing the overhead of using a ros message

I'd like to do some work in a std::thread and then occasionally pass this data to the ROS thread for publishing or further processing. The only way I can see how ...
user avatar
0 votes
0 answers
27 views

RCLCPP: rclcpp namespace used by default?

I have a "Node" class, used for pathfinding. However, when I try to use it anywhere in my rclcpp project, I get errors like "error: cannot convert ‘rclcpp::Node*’ to ‘Node*’". I ...
Matthew Gomes's user avatar
1 vote
1 answer
61 views

How to migrate ROS1 code that passes ros::Nodehandle to functions inside constructor

In ROS 1 C++ code, a somewhat popular idiom involves calling functions that takes ros::NodeHandle to initialize members, e.g. ...
Hs293Go's user avatar
  • 13
1 vote
1 answer
100 views

How to add an additional argument in a ROS2 cpp callback

I want to add an additional argument in a callback function for rclcpp, e.g. callback(msg, additional_argument). I can do it in ...
gab's user avatar
  • 113
0 votes
2 answers
147 views

rclcpp ROS2 params yaml file comments

Does anyone know, if there are available comments in the yaml files containing parameters? I tried to comment some information to keep it for later, but then I got rcl parsing exception. But maybe I ...
magladko's user avatar
0 votes
1 answer
276 views

Can’t see debug messages using RCLCPP_DEBUG

I can’t see messages using RCLCPP_DEBUG by terminal and rqt, but I can using other levels of verbosity( INFO, ERROR, FATAL…).Selecting debug in rqt to see those messages doesn’t work either. I’m using ...
pgarcia-dev's user avatar
0 votes
1 answer
28 views

When will subscriber status callbacks be available in ROS2?

What are the plans for implementing rclcpp subscriber status callbacks (connect/disconnect) in ROS2? I found this ROS1 feature quite handy. Note that this question has been asked before but since that ...
Bernd Pfrommer's user avatar
0 votes
1 answer
63 views

Nav2: Migrate from nav_msg::getPlan

I've been migrating to ROS Humble a ROS 1 exploration project in C++. This project considers a list of goal candidates and to evaluate them we use to call the service ...
joanvallve's user avatar
0 votes
0 answers
100 views

adjusting Timer period as it is in use, RCLCPP

I am using a rclcpp Timer, namely: rclcpp::TimerBase::SharedPtr timer = this->create_wall_timer(100m, std::bind(&MyTimerProg::timer_callback, this)); I would like to adjust the timer period as ...
Can Altineller's user avatar
0 votes
2 answers
106 views

Sending node object to a class inside the node

I have a class named UarmControl that inherits the Node class. Inside my UarmControl class, I want to send the node it self to another class named Uarm that I want to create inside my constructor. The ...
eidetech's user avatar
0 votes
0 answers
21 views

how many callback groups lifecycle nodes use by default and why?

I am checking number of callback groups in my lifecycle node using : this->get_node_base_interface()->get_callback_groups().size()); Before initialising any ...
tomRob's user avatar
  • 88
0 votes
1 answer
69 views

Lifecycle node consuming cpu in deactivated state

My node which is a critical component of a larger system contains the following interfaces for communicating with other nodes Two action servers One tf listner One service server Four subscribers Two ...
tomRob's user avatar
  • 88
0 votes
1 answer
62 views

How to declare parameter that are only known at runtime

I'm currently facing an issue with the ros2 parameters. I'm not sure how to approach this, from Iron on ros2_controller creates a node without the node options ...
saikishor's user avatar
0 votes
0 answers
49 views

Error when running RCLCPP examples on microROS workspace with rmw_microxrcedds

I am trying to build rclcpp publisher subscriber example on microROS (host workspace on ubuntu:jammy). I am able to compile it (with -DRMW_IMPLEMENTATION=rmw_microxrcedds) and run it for cyclonedds ...
Ace_Dalman's user avatar
0 votes
1 answer
71 views

Using ImageTransport in a constructor throws std::bad_weak_ptr

I am trying to create an ImageTransport instance to set up an image publisher which is a class member). I stick to this example, trying to adapt it to my class: <...
labude's user avatar
  • 11
0 votes
1 answer
97 views

rclcpp - float conversion warning when using `declare_parameter<float>`

Compiling a node with the following snippet and -Wfloat-conversion leads to the following: ...
Patrick Roncagliolo's user avatar
0 votes
0 answers
24 views

ros2 using cpp ament package library in another cpp ament package

i'm trying to transform ego-planner-swarm founded in: https://github.com/ZJU-FAST-Lab/ego-planner-swarm to ros2... in my ros2 workspace, i have 3 packages... bspline_opt(as library) plan_manage ...
arash mokhtari sherkat's user avatar
0 votes
2 answers
277 views

rclcpp::QoS error when running colcon build

I am trying to run ros2-canopen from VirtualBox in Ubuntu 22.04.03., the host is Windows11. I have installed ros2 following instructions from: https://docs.ros.org/en/humble/Installation/Ubuntu-...
user avatar
0 votes
1 answer
697 views

ROS2 multi-threaded executor timers block subscriber callbacks

Using RCLCPP, ROS2-Iron, Ubuntu 22.04. Using rclcpp::executors::MultiThreadedExecutor executor When defining callback groups, if I leave both timers and subscribers ...
Toby Buckley's user avatar
0 votes
1 answer
110 views

Is there a way to enumerate over predefined constants in ROS2 message definitions?

I'd like to know if there is a way to enumerate over the available constants defined in a message. As an example, let's take the visualization_msgs/Marker.msg as an ...
Steve's user avatar
  • 1
0 votes
3 answers
2k views

ros2 spinning problem[SOLVED]

i'm trying to transform ego-planner-swarm founded in: https://github.com/ZJU-FAST-Lab/ego-planner-swarm to ros2... the problem was in one of the subscription's callbacks there was a function in which ...
arash mokhtari sherkat's user avatar
0 votes
2 answers
201 views

Multiple servers in a single node [ROS2]

I am trying to make two servers for two different services in a single node. For example, like so: ...
Suchetan Saravanan's user avatar
0 votes
0 answers
82 views

undefined reference to many pkgs

I just started out with ROS 2.0. I am unsure if I am doing something stupid or missing out something. However, I can’t build these files. If I should have posted somewhere else kindly let me know. i'm ...
husten's user avatar
  • 1
1 vote
0 answers
449 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: ...
Natanel Birarov's user avatar
0 votes
0 answers
299 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 ...
magladko's user avatar
1 vote
0 answers
38 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 ...
Luka Juricic's user avatar
0 votes
1 answer
73 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 ...
user37234's user avatar
0 votes
1 answer
417 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. ...
RobotBramhana's user avatar
0 votes
0 answers
418 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/...
chade's user avatar
  • 1
0 votes
1 answer
91 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): ...
Tyler Weaver's user avatar
0 votes
0 answers
130 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 ...
Tejas Kumar's user avatar
0 votes
1 answer
249 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 ...
Can Altineller's user avatar
2 votes
1 answer
556 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 ...
Donca's user avatar
  • 21
0 votes
1 answer
110 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 ...
SEC's user avatar
  • 3
0 votes
1 answer
39 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 ...
moschmdt's user avatar
0 votes
1 answer
276 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 <...
snoato's user avatar
  • 103
0 votes
0 answers
13 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'...
Donca's user avatar
  • 21
0 votes
1 answer
724 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 "...
Donca's user avatar
  • 21
3 votes
1 answer
1k 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?...
Antonio Bono's user avatar