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

Felix Tr's profile - activity

2021-11-18 04:33:52 -0500 received badge  Self-Learner (source)
2021-11-18 04:33:52 -0500 received badge  Teacher (source)
2021-02-01 06:51:42 -0500 received badge  Favorite Question (source)
2019-11-20 07:17:14 -0500 received badge  Favorite Question (source)
2018-10-03 23:04:33 -0500 marked best answer How to use txt file as a parameter to roslaunch file?

Hello All,

Background:

My idea is to receive not constant number of topics, to which I want to subscribe in my C code. I decided to do it in the next way: I will prepare a text file with the number and the name of the topics ---> convert it using launch file syntax to a string ---> parse the string in my C code ---> decide to which topics to subscribe.

In such a way I will only have to change the text file, while the launch file and the C code will not be changed.

Question:

I have written the next line of code in my launch file:

<param name="topics_list" textfile="$(find package_name)/file_name.txt"/>

And I have placed my text file in the appropriate folder. In my C file I do the next:

if ( nh.getParam("topics_list", topicsList) )
{
   ROS_INFO ("The contents of the file \"file_name.txt\" as a string are: %s\n",   
   topicsList); 
}
else
{
   ROS_INFO ("The topics list was not loaded succesfully. Aborting...\n");
   ros::shutdown();
}

It doesn´t work.

  1. Is my way correct?
  2. Why the above doesn´t work properly?

Thank you all in advance, Felix.

2018-08-16 05:36:04 -0500 received badge  Great Question (source)
2017-10-13 09:01:10 -0500 received badge  Great Question (source)
2017-08-22 16:22:35 -0500 received badge  Great Question (source)
2016-01-07 09:30:37 -0500 received badge  Good Question (source)
2015-09-28 10:23:35 -0500 received badge  Good Question (source)
2015-08-12 09:49:20 -0500 received badge  Favorite Question (source)
2015-08-12 09:49:17 -0500 received badge  Good Question (source)
2015-08-10 09:49:11 -0500 received badge  Nice Question (source)
2015-06-12 15:50:31 -0500 marked best answer How to deliver arguments to a callback function?

Hello All,

I am relatively new user of ROS, and would be grateful if you could answer to my question. I work with Linux and C, and I want to deliver arguments to my callback function. Lets say I want to deliver to it the next struct as a parameter:

typedef struct imageManagmentStruct
{
    IplImage*  pSrcIplImage;
    IplImage*  pDstIplImage;
    GdkPixbuf* pGtkPixbuf;
    GtkWidget* pGtkImgWindow;    
    int        previousImageSize;
    int        left_attach;
    int        right_attach;
    int        top_attach;
    int        bottom_attach;    
} ImageManagmentStruct;

My callback is:

void imageCallback ( const sensor_msgs::ImageConstPtr& msg,
                     ImageManagmentStruct* pToImageManagmentStruct
                   )
{
    // My code.
}

The call to the callback from the main done like this:

ros::Subscriber subLeft = nh.subscribe ("/bb2/left/image_raw", 10, imageCallback,  
                                        pointerToImageManagmentStruct);

And this is not compiling...

Thank you all, Felix.

2014-12-05 09:55:26 -0500 received badge  Nice Question (source)
2014-11-16 17:30:10 -0500 marked best answer Launch file - how to write it?

Hello All,

I am relatively new user of ROS, and this is the first time I should write a launch file. I would be happy if you could navigate me to the best way to do it.

What I do is: I subscribe to recorded topics (bag files) using image_transport package, I republish their content to different topics (from compressed to raw), and eventually I subscribe to those topics with my subscriber (the only node I have created). The shell command lines I use in order to run my program without a launch file are:

roscore

rosbag play -l left_camrea.bag

rosbag play -l rigth_camrea.bag

rosrun image_transport republish compressed in:=/bb2/left/image_rect raw 
  out:=lefttopic

rosrun image_transport republish compressed in:=/bb2/right/image_rect raw     
  out:=righttopic

rosrun myPackage myExecutibleFile

I also need to configure parameters for my program via this launch file.

What from the above can/should be included in the launch file? What should not?

What is the conceptual structure of my file should be like?

Thank you for your attention, Felix,

2014-10-08 02:50:19 -0500 marked best answer How to write and parse "yaml" file for ROS?

Hello all,

My goal is to subscribe to an "unknown" number of topics. I want to do the next algorithm:

  1. Create a "yaml" file for ROS, where all my topics are listed.
  2. Extract it´s data as a string.
  3. Parse the data, according to which I will know the number and the names of the topics to which I want to subscribe.
  4. Subscribe in a loop to all of them.

The problem is that I have never written a "yaml" file, and the explanations in the Wikipedia page are not good for ROS. I would also be happy to know what is the best way to "parse" the info in my code (C).

Thank you for your help, Felix.