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

Winston's profile - activity

2023-04-29 03:49:51 -0500 marked best answer Run one node in another node?

The subject looks weird and difficult to understand so I am going to explain what I mean here. I want to know if it is possible to run a node inside another node. For example, when you have written a ROS node A and what you want A to do is to run other several ROS nodes B, C, D and etc. How to implement that? I don't want to use roslaunch to run several nodes in this case because after node A has run other nodes, it also has to do other stuff.

To go further, I want to write a ROS server and what it is supposed to do is waiting for "node request", that is , when a client calls this service, the server tries to run a node instantaneously. That is to say, how to run nodes in a service server? I think this case is essentially the same as the former one.

Any suggestions are appreciated very much.

2021-01-13 18:34:32 -0500 marked best answer setup.bash setup.sh setup.zsh

I want to find out the differences between 3 files created when using the command 'rosws init ~/fuerte-ws /opt/ros/fuerte' : setup.bash setup.sh setup.zsh. In the rosbuild tutorial, it tells me to source setup.sh. But in catkin tutorial, we source setup.bash. So do these three files serve the same function? Why no one uses setup.zsh? What is it?

Thank you very much.

2020-12-24 02:34:18 -0500 received badge  Nice Answer (source)
2020-11-06 09:09:46 -0500 received badge  Good Question (source)
2020-06-06 20:54:15 -0500 received badge  Taxonomist
2020-05-29 08:06:47 -0500 received badge  Famous Question (source)
2019-08-01 21:25:55 -0500 received badge  Nice Question (source)
2019-03-27 07:56:52 -0500 marked best answer PR2 rqt_plot has the error TopicCompleter.update_topics(): could not get message class

I have written a publisher in PR2's computer to publish message whose type is "beginner_tutorials/Num" on topic "/chatter2". Then I want to plot the data from this topic. I cannot use rqt_plot in PR2's computer because it does not support graphics. So I open a terminal in my own computer(which of course supports graphics) and export ROS_MASTER_URI=[PR2 computer's address] so that I can communicate with PR2's roscore. In this local terminal, I use rqt_plot to plot the data like: rqt_plot /chatter2/data, but there is an error:

TopicCompleter.update_topics(): could not get message class for topic type "beginner_tutorials/Num" on topic "/chatter2"

It seems that rqt_plot cannot subscribe to the topic. But curiously, indeed I can "rostopic list" this topic in the same terminal. So how to let rqt_plot subscribe successfully to the topic and plot my data?

2019-03-27 07:56:51 -0500 received badge  Teacher (source)
2019-03-27 07:56:51 -0500 received badge  Self-Learner (source)
2018-09-19 17:18:56 -0500 marked best answer Can't view the pointclouds in the rviz

I use the bumblebee2 get stereo picture of the left and right image,and use the stereo_image_proc package to deal with it . i got the rect image and disparity image with no problem, and use the command of "rostopic echo /stereo_camera/pointclouds2",got the pointclouds data as followed image description then i want to use the rviz to see the pointclouds picture ,it failed. image description

I think it's not the problem of "tf data",as i use the bumbleebee on line get the pointclouds picture by rviz have the same warn of "tf data",but it's no matter to view the pointclouds in the rviz!

2018-05-26 02:23:17 -0500 received badge  Favorite Question (source)
2018-02-28 14:58:55 -0500 received badge  Famous Question (source)
2018-02-27 04:05:26 -0500 received badge  Good Question (source)
2018-02-20 22:03:56 -0500 marked best answer Real time ROS node without ROS control, orocos?

I have a hardware controller node which controls three motors using SOEM with Ethercat. I use a ROS timer in this node with 500 Hz control frequency. However, I find out that the timer is not accurate at all; sometimes there is a 100ms delay and cause the Ethercat to send 'stop-working' commands to motors. So I plan to use a RT_PREEMPT patch to the current Linux kernel to solve the 'jitter' problem. However, I want to solve this problem with least effort possible. So what is the possible shortcut? And are there any problems if I only use the RT_PREEMPT patch without using ros_control or orocos framework as many people are actually using them?

Another problem is how to choose a suitable realtime priority for my hardware controller node?

2017-12-08 09:20:40 -0500 received badge  Popular Question (source)
2017-12-08 09:20:40 -0500 received badge  Notable Question (source)
2017-09-30 02:23:39 -0500 marked best answer The difference between Spin() and SpinOnce().

Can someone tell me the difference between Spin() and SpinOnce()? And what exactly they are doing, is it like a while loop to process some ROS stuff?

2017-09-29 10:56:08 -0500 marked best answer ros service dead lock?

This is the situation:
Node A has a service client which calls a service server defined in node B for all the time.

In the meanwhile, node B also has a service client which calls a service server defined in node A for all the time.

In other words, there are a service client and server in node A, and there are also a service server and client in node B. And they call each other all the time.

Now comes the problem, the program hangs there and no call is successful. It seems there is a deadlock. Any one could give me a detailed explanation? And any one could provide me with a solution? Thanks!

Node A:

#include "ros/ros.h"
#include "roscpp_tutorials/TwoInts.h"
#include <cstdlib>

bool test(roscpp_tutorials::TwoInts::Request  &req,
         roscpp_tutorials::TwoInts::Response &res )
{
  res.sum = req.a + req.b;
  ROS_INFO("test : x=%ld, y=%ld", (long int)req.a, (long int)req.b);
  ROS_INFO(" test sending back response: [%ld]", (long int)res.sum);
  return true;
}

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

    ros::ServiceClient client = n.serviceClient<roscpp_tutorials::TwoInts>("add_two_ints");
    ros::ServiceServer server = n.advertiseService("test", test);

    ros::Rate rate(10);

    roscpp_tutorials::TwoInts srv;
    srv.request.a = 1;
    srv.request.b = 2;

    while(ros::ok())
    {
        if (client.call(srv))
        {
          ROS_INFO("Sum: %ld", (long int)srv.response.sum);
        }
        else
        {
          ROS_ERROR("Failed to call service add_two_ints");
        }
        ros::spinOnce();
        rate.sleep();
    }

    return 0;
}

Node B:

#include "ros/ros.h"
#include "roscpp_tutorials/TwoInts.h"

bool add(roscpp_tutorials::TwoInts::Request  &req,
         roscpp_tutorials::TwoInts::Response &res )
{
  res.sum = req.a + req.b;
  ROS_INFO("request: x=%ld, y=%ld", (long int)req.a, (long int)req.b);
  ROS_INFO("  sending back response: [%ld]", (long int)res.sum);
  return true;
}

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

  ros::ServiceServer service = n.advertiseService("add_two_ints", add);
  ros::ServiceClient client = n.serviceClient<roscpp_tutorials::TwoInts>("test");

  ros::Rate rate(10);

  roscpp_tutorials::TwoInts srv;
  srv.request.a = 1;
  srv.request.b = 2;

  while(ros::ok())
  {
      if (client.call(srv))
      {
        ROS_INFO("test: %ld", (long int)srv.response.sum);
      }
      else
      {
        ROS_ERROR("Failed to call service test");
      }
      ros::spinOnce();
      rate.sleep();
  }
  //ros::spin();

  return 0;
}
2017-09-20 14:36:14 -0500 received badge  Famous Question (source)
2017-08-30 06:07:25 -0500 received badge  Famous Question (source)
2017-07-21 21:18:38 -0500 commented answer Can ROS Service be used in Real-time Application or Hardware Control?

@ahendrix Have you seen my comments?

2017-07-19 17:18:46 -0500 received badge  Famous Question (source)
2017-07-19 03:32:56 -0500 commented answer Can ROS Service be used in Real-time Application or Hardware Control?

For example, the gazebo_plugin uses extensively the custom call back queues. Does it serve the purpose of processing the

2017-07-19 03:29:41 -0500 commented answer Can ROS Service be used in Real-time Application or Hardware Control?

Thank you very much. Sorry but the information is overwhelming. I try to use ros_control before but I think the document

2017-07-17 19:52:41 -0500 commented answer Can ROS Service be used in Real-time Application or Hardware Control?

Thank you for this comment. Could you provide me with the related code so that I know how to write this for our own rob

2017-07-17 13:27:06 -0500 marked best answer Can ROS Service be used in Real-time Application or Hardware Control?

I have 3 related questions about ROS service:

  • Is it a good idea to put a ROS service client in my robot hardware code?
  • Will it increase the time-delay of the hardware node and make my robot unable to work correctly?
  • Does PR2 robot use ROS service in its hardware node?
  • When should I use ROS service compared with ROS messages?)