Skip to main content

Questions tagged [c++]

C++ is a compiled general-purpose programming language that adds object-oriented features and other enhancements to the C language. It is popular for both embedded (including robotics) and PC software development.

Filter by
Sorted by
Tagged with
0 votes
2 answers
33 views

node crashes when initializing object from shared lib

I've been banging my head against my keyboard for the last week or so trying to figure this one out and still havent - so here I am asking for help from the internet! I have this package I've been ...
user avatar
0 votes
1 answer
31 views

How to read files in a directory?

Hello I need to read some files from a directory and the std::filesystem does not seems to work. I already tried ...
user avatar
0 votes
1 answer
93 views

How to list the ros2 topics from a c++ node?

How to list the ros2 topics from a c++ node? I am interested in all the topics in the ros2 network. Something equivalent to the commnand line ros2 topic list I ...
Pablo Iñigo Blasco's user avatar
1 vote
3 answers
338 views

What is the best way to simulate Staubli robots inside a C++/C# app

A little bit of context : I want to create an app using C++ (or C#) to handle 3D objects (obj), I will perform some operations on those 3D models to create some robotic trajectories. Then I want to ...
Jack's user avatar
  • 123
0 votes
1 answer
100 views

Client doesn't return when you create a client class ROS2

Hi community, I would like to write a client and server node using classes. I started writing the client in a class "form" using the tutorial in the documentation and I used the same ...
user avatar
0 votes
1 answer
11 views

std_msgs::string compare in a callback cpp node

Hi all, I'm trying to create a node with rosserial on Arduino. It should publish some sensor information and acts when I publish a command through a command topic. I wrote a cpp node with a callback ...
Iftahnaf's user avatar
1 vote
1 answer
58 views

difference between the two constructors

What is the difference between the 2 pieces of code - ...
skpro19's user avatar
  • 314
0 votes
1 answer
35 views

Transform a points reference frame for object scanning

I am trying to create a path for a robot to move a camera around an object at a specified distance and angle. I have a defined object_link with world as parent and I have a robot_base_link with world ...
sniegs's user avatar
  • 50
0 votes
1 answer
5 views

add a non-ros library c++

Hello. I have a C++ node working with openCV and I want to add a non-ROS library to my package. The library is here. I don't want to install the whole external ...
user avatar
0 votes
1 answer
14 views

Making a simple program which uses cmd_vel

Hello, I am trying to make a simple program which sends a cmd_vel message. My program is looking like this right now. I work on an virtual machine with Ubuntu (ROS noetic) if that matters. ...
user avatar
0 votes
1 answer
9 views

gtsam prints pointers instead of values

Hello. I'm trying to run some of the gtsam library examples in one of my nodes. When one of the print function is called (i.e. ...
user avatar
0 votes
1 answer
44 views

How to prevent the second publisher to publish on the same topic?

Hello everyone, I am working with ROS2 in my project and I know ROS/ROS2 is capable to handle multiple publishers and subscribers on the same topic. Due to some limitations in my project, I would like ...
user avatar
0 votes
1 answer
7 views

does ROS support callback-on-subscription?

My basic problem is that there is a chain of nodes all doing heavy computational work and all publishing the results to lots of intermediate topics. At any one time, only a small number of the final ...
user avatar
0 votes
1 answer
9 views

Only available with -std=c++11 or -std=gnu++11

Hi everyone, I tried to use "range based for loop" and "lambdas" in my programs. Everything was fine in fact. My IDE didn't throw any error or warning at all. After "...
user avatar
0 votes
1 answer
3 views

Ros service not advertised in functions

Followed the tutorial, adapted it to my project. When I call the advertiseService in the main, it works. When it is called in a function called by main, it doesn't. Here some code. First, tutorial ...
user avatar
0 votes
0 answers
273 views

Simple inverse Kinematic algorithm

I was looking for a simple inverse Kinematic algorithm that doesn't depend on eigen(doesn't work on my machine + dependency conflict never fixed it) Most of the code out in the internet is way to ...
Max N's user avatar
  • 11
3 votes
2 answers
473 views

PID Control: Is adding a delay before the next loop a good idea?

I am implementing PID control in c++ to make a differential drive robot turn an accurate number of degrees, but I am having many issues. Exiting control loop early due to fast loop runtime If the ...
droiddoes9's user avatar
0 votes
1 answer
30 views

compiler warning: parameter passing for argument X changed in GCC 7.1 (ARM)

Hi, I'm getting a few of the following warning when compiling a node using geometry_msgs::Twist. Any idea what I'm doing wrong and how to get rid of it? EDIT: ...
user avatar
0 votes
1 answer
4 views

ros::Timer won't start if initialized before dynamic reconfigure server

Hey, I am not sure where to post the issue, so I am showing it here first. Maybe I am doing something wrong. My ros::Timer won't start if I initialize it before the initialization of a dynamic ...
user avatar
0 votes
1 answer
3 views

How does one assign values to messages with arrays in C++

This is probably more C++ focused, but here is my issue: ...
user avatar
0 votes
1 answer
66 views

ROS2: Can subscribe to String, but not Twist, "no overloaded function"

Using the example subscriber found in the official ROS2 tutorials, I was able to create a subscriber that listened for String messages. I then tried to simply change it to listen to Twist messages, ...
user avatar
1 vote
0 answers
25 views

Getting the new heading after a Transformation

Lets say I have 2d poses as such (angles in degrees): world_to_robot = {0, 4, 45} robot_to_object = {4, -4, -45} From a graph it would be easy to see that: world_to_object = {4, 8, theta}, what goes ...
notARobot's user avatar
0 votes
1 answer
40 views

Exception thrown when deserializing message of length [453372] from [/my_filter]: std::bad_alloc

Hello, I am trying to publish PCL point clouds which are obtained from velodyne point cloud. The program is compiled and running. I can even see the height and width information from the PCL point ...
user avatar
0 votes
1 answer
5 views

Why planning scene can't subscribe the new planning scene?

Hi everyone! I am trying to add an object into RVIZ throught C++ interface. I had follow the official tutorial Planning Scene ROS API and failed in step 1.... My Code is follow ...
user avatar
0 votes
1 answer
109 views

Not receiving messages in ros2 while subscribing to topic from Gazebo 11 plugin demo world

Problem Starting a demo world in Gazebo 11 by using gazebo --verbose /opt/ros/foxy/share/gazebo_plugins/worlds/gazebo_ros_depth_camera_demo.world causes all topics ...
user avatar
0 votes
1 answer
168 views

[ROS2] symbol lookup error and undefined symbol while using image transport cpp

Hi fellow developers, I am a beginner at ROS2. After building the package and trying to run it I get the following error. ...
user avatar
0 votes
2 answers
292 views

Using C++ message filters in ROS2

I am trying to subscribe to two topics. If their header stamps are equal they should be combined into a single message and published. I believe that an exact_time message_filter is the way to go here. ...
user avatar
0 votes
2 answers
81 views

programmatically load yaml parameters in C

Hi all, I'm trying to load a YAML file into the parameter server programmatically in C++. I know it is possible with Python, from this question here, but I couldn't find a way to do it in C++. I'm ...
user avatar
0 votes
1 answer
67 views

How to get length of array of geometry_msg:Points in service handle?

I'm trying to find the length of an array of geometry_msg:Point passed to a service handle, so I can iterate over each Point, apply a transform and then push onto a response. when I use sizeof(req....
user avatar
0 votes
1 answer
38 views

service not visible when launched inside class

I'm attempting to implement a service in which the callback is a member function of a class (with reference to the tutorial) My code, as below, builds and runs without error, outputting the expected &...
user avatar
1 vote
0 answers
78 views

How to correctly use [VertexSE3Expmap] as two connecting Vertex in Edge_V_V_GICP?

I am working on a pose estimation problem solved by Levenberg-Marquardt with g2o. I want to build 3D rigid constraint between two pose, so I choose Edge_V_V_GICP and test the g2o/examples/icp/...
Jerry123's user avatar
0 votes
1 answer
7 views

Writing a Subscriber template

I am trying to write a subscriber template that can be initialized using any type of message and with an assignable callback. Below is my code for this template, and as such it compiles, however ...
user avatar
0 votes
1 answer
2 views

publish topic through serial/usb

Hi, I am trying to publish three topics through usb connection to a custom pcb with an MSP432. I need to use c++ as this if for safety critical vehicle control (Ford F-150) based on control outputs ...
user avatar
0 votes
1 answer
9 views

Using NodeHandle in callback

Hello, I am making an initialization node for AHRS and I'm trying to get the initial bias of gyroscope by averaging the first 1000 readings that I get. I need to advertise the service only after I ...
user avatar
0 votes
1 answer
23 views

Cross compile my ROS package for Nvidia jetson TX2

I have some ROS packages developed for a robot which I want to deploy on a jetson TX2(ARM® Cortex®-A57 MPCore) with ROS melodic (the robot has a TX2 for its computer). I want the packages to be ...
user avatar
0 votes
1 answer
1 view

Problems finding messages when compiling ROS project

Hi, I've been having some problems lately with ROS and catkin_make. Whenever I compile the whole project cmake struggles to find certain messages. I would paste the errors codes but they are just like ...
user avatar
0 votes
1 answer
43 views

How can I find the line where the code crashes?

Hi I only got the following error message: ...
user avatar
0 votes
1 answer
79 views

ros2 logging demo C++

I am trying to migrate code to ROS2 and I am stuck on logging. From https://index.ros.org/doc/ros2/Concepts/Logging/ I got to the code example at https://github.com/ros2/demos/tree/master/logging_demo ...
user avatar
0 votes
1 answer
44 views

how do you create a group of joints for MoveIt Planning Group for a custom robot

Hi everyone, first time posting. My question relates to my attempt at creating a custom robot from scratch and trying to control it using MoveIt. I reverse engineered a model for an existing toy robot ...
user avatar
0 votes
2 answers
62 views

How do I get competent in using c++ for my projects? [closed]

I am a PhD student, working on Sensor Fusion and estimation problems. I would like as I finish my PhD to have acquired sound knowledge in what seems to be the industry norm for working with real ...
D Dim's user avatar
  • 21
0 votes
1 answer
22 views

Can I change which topic usb_cam is publishing?

Can I change the topic which each node publishes? I'm using usb_cam with multiple nodes and each node will run in different devices, I need them to publish on different topics so the server can send ...
user avatar
0 votes
1 answer
273 views

Getting a Node::SharedPtr from "this"

A number of functions expect a rclcpp::Node::SharedPtr, but when you are in an rclcpp::Node subclass it is not available, and of ...
user avatar
0 votes
1 answer
32 views

createTimer() replacement in eloquent

In ROS1 we can simply do: ros::Timer timer = nh.createTimer(ros::Duration(0.1), timerCallback); This gives us a tick approximately every 100 ms of ROS time. In ...
user avatar
0 votes
1 answer
74 views

Subscriber callback not triggering while in a while loop

Hi, I would like to create a subscriber that uses the callback to get the data, but that is also able to do things with that data in the main loop (where the node is declared). Here is a simple ...
user avatar
0 votes
1 answer
64 views

stl mesh does not become visible in Rviz

With the code below I try to get a collision object into Rviz. For some reason the stl mesh is not showing in the 3D viewer. However the object I am trying to insert is based on the exact same stl ...
user avatar
0 votes
1 answer
35 views

Unable to open stl file into scene in C++

Dear All, I am having some trouble importing an stl file into my scene. I am able to import the stl file into the scene trough the Rviz gui in the 'scene objects' tab and the part becomes visible in ...
user avatar
0 votes
1 answer
26 views

Install SWIG python bindings in install space

We're using SWIG to generate python bindings for some C++ classes. This works fine in the devel space (cmake below). However, I can't figure out how to change our cmake to also install the python ...
user avatar
0 votes
1 answer
9 views

ros2 how to get non-ros parameter argument count

I have code like: int main(...) { rclcpp::init(argc, argv); if(argc != 3) { printf("Error, missing arguments for a, b\n"); } ... The ...
user avatar
0 votes
2 answers
16 views

"c++: internal compiler error: Killed" while building Universal Robots ROS Driver

I am attempting to build the Universal Robots ROS Driver on ROS Melodic Ubutnu 18.04, but when I try to build the workspace with catkin_make I get the error below. ...
user avatar
0 votes
1 answer
253 views

ROS2 add parameter to c++ and launch file

So I'm a novice when it comes to ROS2, but have some experience with ROS1. I've been trying to convert an existing project from ROS kinetic to ROS eloquent. In this project I've made a node in c++ ...
user avatar

1 2 3
4
5
17