ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

merosss's profile - activity

2023-02-08 10:19:24 -0500 edited answer Why does my compiler warn at usage of operators of ros::TimeBase?

The same exact warning annoyed me for a while. In my case the warnings are coming from the CLang Code Model inspector (i

2023-02-08 09:45:57 -0500 answered a question Why does my compiler warn at usage of operators of ros::TimeBase?

The same exact warning annoyed me for a while. In my case the warnings are coming from the CLang Code Model inspector (i

2022-12-29 09:53:45 -0500 commented answer function callback using std::bind in ros 2 subscription

It's a pity that this function broke in ros2. This gave me headaches for days, thanks a lot for your solution, worked as

2022-11-17 03:43:24 -0500 received badge  Famous Question (source)
2022-11-17 03:43:24 -0500 received badge  Notable Question (source)
2022-11-10 03:03:50 -0500 received badge  Good Question (source)
2022-11-10 03:03:42 -0500 received badge  Self-Learner (source)
2022-05-11 06:05:17 -0500 edited answer How to get ROS version?

As of Indigo the correct command for ROS1 is: rosversion -d For ROS2 instead use: echo $ROS_DISTRO

2022-04-14 05:36:47 -0500 received badge  Popular Question (source)
2022-02-04 03:30:38 -0500 edited question Invalid port mapping: port number(s) of out range

Invalid port mapping: port number(s) of out range I just updated my ROS2 version, from foxy to galactic, and I am gettin

2022-02-04 02:52:09 -0500 edited answer Invalid port mapping: port number(s) of out range

I don't think this is a solution, but switching the DDS solved the problem. I added to my .bashrc file the following li

2022-02-04 01:49:35 -0500 edited question Running multiple instances of same node

Running multiple instances of same node Hi everybody. I'm slightly new to Ros so I'm sorry for any mistake in terminolog

2022-02-03 09:42:44 -0500 edited answer Invalid port mapping: port number(s) of out range

I don't think this is a solution, but switching the DDS solved the problem. I deleted my build files, added to my .bash

2022-02-03 09:42:44 -0500 received badge  Associate Editor (source)
2022-02-03 09:39:00 -0500 edited answer Invalid port mapping: port number(s) of out range

I don't think this is a solution, but switching the DDS solved the problem. I deleted my build files, added to my .bash

2022-02-03 09:38:17 -0500 edited answer Invalid port mapping: port number(s) of out range

I don't think this is a solution, but switching the DDS solved the problem. I deleted my build files, added to my .bash

2022-02-03 09:36:04 -0500 edited answer Invalid port mapping: port number(s) of out range

I don't think this is a solution, but switching the DDS solved the problem. I deleted my build files, added to my bashr

2022-02-03 09:35:30 -0500 edited answer Invalid port mapping: port number(s) of out range

I don't think this is a solution, but I switching the DDS solved the problem. I deleted my build files, added to my bas

2022-02-03 09:35:05 -0500 answered a question Invalid port mapping: port number(s) of out range

I don't think this is a solution, but I switching the DDS solved the problem. I deleted my build files, added to my bash

2022-02-03 09:35:05 -0500 received badge  Rapid Responder (source)
2022-02-03 09:32:16 -0500 edited question Invalid port mapping: port number(s) of out range

Invalid port mapping: port number(s) of out range I just updated my ROS2 version, from foxy to galactic, and I am gettin

2022-02-03 09:31:43 -0500 edited question Invalid port mapping: port number(s) of out range

Invalid port mapping: port number(s) of out range I just updated my ROS2 version, from foxy to galactic, and I am gettin

2022-02-03 09:03:15 -0500 edited question Invalid port mapping: port number(s) of out range

Invalid port mapping: port number(s) of out range I just updated my ROS2 version, from foxy to galactic, and I am gettin

2022-02-03 09:02:19 -0500 edited question Invalid port mapping: port number(s) of out range

Invalid port mapping: port number(s) of out range I just updated my ROS2 version, from foxy to galactic, and I am gettin

2022-02-03 08:09:07 -0500 edited question Invalid port mapping: port number(s) of out range

Invalid port mapping: port number(s) of out range I just updated my ROS2 version, from foxy to galactic, and I am gettin

2022-02-03 08:02:25 -0500 asked a question Invalid port mapping port number(s) of out range

Invalid port mapping port number(s) of out range I just updated my ROS2 version, from foxy to galactic, and I am getting

2022-02-03 08:01:21 -0500 asked a question Invalid port mapping: port number(s) of out range

Invalid port mapping: port number(s) of out range I just updated my ROS2 version, from foxy to galactic, and I am gettin

2020-08-06 12:53:17 -0500 received badge  Good Question (source)
2019-03-23 14:33:51 -0500 commented answer How to get ROS version?

@breandan I've updated the answer ;)

2019-03-23 14:33:18 -0500 edited answer How to get ROS version?

As of Indigo the correct command for ROS1 is: rosversion -d For ROS2 instead use: echo $ROS_DISTRO

2018-07-11 05:07:00 -0500 commented answer Cannot install kinetic (unmet dependencies)

Thanks this was the solution for me! qt5 was breaking ros installation

2018-04-19 05:13:51 -0500 received badge  Enlightened (source)
2018-04-19 05:13:51 -0500 received badge  Guru (source)
2017-07-31 11:49:07 -0500 received badge  Nice Question (source)
2017-01-20 05:23:31 -0500 received badge  Nice Question (source)
2016-11-10 05:05:15 -0500 received badge  Critic (source)
2016-03-22 19:11:36 -0500 marked best answer Undefined reference to class::function()

Hi everybody, I'm a little bit new to ROS and making classes in c++ so excuse me for all the crap I'll surely write. My problem is that: I want to write a class called Cao and call its function from the Ros file which contains the main, but when I try to catkin_make it gives me the error: undefined reference to `Cao::SayHello()'.

Since the absence of a main I've declared the class a library adding this line in the CMakeLists.txt:

add_library(quadcopter_ctrl src/Cao.cpp)

The header Cao.h looks like this:

#ifndef CAO_H_
#define CAO_H_

#include <iostream>

class Cao{
private:
  int state;

public:
  Cao();
  virtual ~Cao();    
  static void SayHello();   
};

#endif /* CAO_H_ */

And the Cao.cpp is like this:

#include "Cao.h"

Cao::Cao(){
  state = 0;
}

Cao::~Cao(){
  // TODO Auto-generated destructor stub
}

void Cao::SayHello(){
  std::cout << "Hello World!";
  std::cout << std::endl;
}

I'm calling the SayHello function in this quadcopterRosCtrl.cpp file:

#include "ros/ros.h"
#include "geometry_msgs/PoseStamped.h"
#include "std_msgs/String.h"
#include "../include/quadcopter_ctrl/termColors.h"
#include "../include/quadcopter_ctrl/quadcopterRosCtrl.h"
#include "Cao.h"

geometry_msgs::PoseStamped quadPos;
int quadPosAcquired = 0;

void quadPosFromVrep(const geometry_msgs::PoseStamped::ConstPtr& pubQuadPose)
{
    quadPos.pose.position.x = pubQuadPose->pose.position.x;
    quadPos.pose.position.y = pubQuadPose->pose.position.y;
    quadPosAcquired = 1;    
}

int main(int argc, char **argv)
{
    ros::init(argc, argv, "quadcopterRosCtrl");
    ros::NodeHandle n;

    ros::Publisher targetObjPos_pub = n.advertise<geometry_msgs::PoseStamped>("vrep/targetObjPos", 100);
    ros::Subscriber quadcopPos_sub = n.subscribe("vrep/quadcopPos", 100, quadPosFromVrep);

    Cao::SayHello();

    [ SOME CODE IN THE MIDDLE ]

    return 0;
}

And I didn't manage to get rid of this error in any way. It's something related to the code or to the CMakeList.txt?? The full output error after catkin_make is the following:

CMakeFiles/quadcopterRosCtrl.dir/src/quadcopterRosCtrl.cpp.o: In function `main':
/home/francescow/catkin_ws/src/quadcopter_ctrl/src/quadcopterRosCtrl.cpp:103: undefined reference to `Cao::SayHello()'
collect2: ld returned 1 exit status
make[2]: *** [/home/francescow/catkin_ws/devel/lib/quadcopter_ctrl/quadcopterRosCtrl] Error 1
make[1]: *** [quadcopter_ctrl/CMakeFiles/quadcopterRosCtrl.dir/all] Error 2
make: *** [all] Error 2

Thanks in advance.

2015-08-10 10:27:13 -0500 marked best answer It's safe to Publish and Subscribe on same Topic?

Hi everybody, I am developing a framework where multiple identical nodes are running concurrently and each of them controls the movements of a different robot (3 robots for now). They all have a matrix describing the environment in which they are moving to plan the movements.

Each of them also has another matrix containing the number of times a certain position has been visited. What I want is that every node updates its map when one of the robots moves to a new position and to do this I was thinking of making them publishing and subscribing to the same topic their position, and in the callback function modify the "visitCountMatrix" accordingly.

Is this safe? If not, can you think of a different solution? Keep in mind that I want the controllers to be independent one from another, i.e. they cannot share a common matrix. Thanks! :)

2015-08-10 10:26:27 -0500 received badge  Good Question (source)
2015-06-11 16:11:12 -0500 received badge  Great Answer (source)
2015-04-17 08:48:37 -0500 received badge  Good Answer (source)
2015-04-01 10:06:29 -0500 marked best answer Running multiple instances of same node

Hi everybody. I'm slightly new to Ros so I'm sorry for any mistake in terminology or logic I will do while asking. My problem is that I've written a node that communicates with Vrep (a robot simulator) publishing some positions to a topic to which Vrep is subscribed (goal positions that the robot is following), it is also subscribed to a topic which is published by Vrep that publishes the current position of the robot.

What i want to do is to run multiple instances of this node with different topic names so to control multiple robots, but I can't figure out which is the best solution. The thing is that I also want to dynamically generate the needed number of nodes, and give as arguments to the nodes the name of the topics to which they have to subscribe/publish. Is this possible?

The only solutions I found out so far are:

  1. Create multiple .cpp files with the topic names hardcoded in them, one for every robot I want to control. (NOT Dynamic)
  2. Create multiple nodes inside a single main with appropriate callback functions defined for every robot. (Seems messy, still NOT Dynamic)

Thanks in advance.