Ask Your Question

Felix Tr's profile - activity

2019-11-20 07:17:14 -0600 received badge  Favorite Question (source)
2018-08-16 05:36:04 -0600 received badge  Great Question (source)
2017-10-13 09:01:10 -0600 received badge  Great Question (source)
2017-08-22 16:22:35 -0600 received badge  Great Question (source)
2016-01-07 09:30:37 -0600 received badge  Good Question (source)
2015-09-28 10:23:35 -0600 received badge  Good Question (source)
2015-08-12 09:49:20 -0600 received badge  Favorite Question (source)
2015-08-12 09:49:17 -0600 received badge  Good Question (source)
2015-08-10 09:49:11 -0600 received badge  Nice Question (source)
2014-12-05 09:55:26 -0600 received badge  Nice Question (source)
2014-04-20 12:27:21 -0600 marked best answer How to redirect warnings to the screen?

Hello all,

I am writing code C code that uses ROS and my OS is Linux. I also use launch file in order to run my program.

My problem: I don´t see the warnings on the screen after compilation. The only thing I am able to see is this message:

[rosmake-3] Finished <<< guiPackage [PASS] [ 4.21 seconds ] -- WARNING: 2 compiler warnings

My Questions:

  1. Is this problem connected to the launch file or not?
  2. Whatever the answer for 1 is, how can I see the warnings on the shell screen of Linux in this case?

Thank you all for your time, Felix.

2014-04-20 12:26:48 -0600 marked best answer How to convert XmlRpc::XmlRpcValue into string?

Hello All,

I am trying to extract topic name as strings from a "yaml" file. The goal is depicted here:

http://answers.ros.org/question/3289/how-to-write-and-parse-yaml-file-for-ros

I think that I have succeeded to receive the list as XmlRpc::XmlRpcValue class, but I am not succeeding to convert this to a string format.

I have tried to do it in two different ways:

    for (int32_t i = 0; i < my_list.size(); ++i) 
    {
        printf ( "Topic %d is: %s.\n", i, static_cast<std::string>(my_list[i]) );
    }

if ( my_list.stringFromXml ( topicsList, &offset ) == TRUE )
{
        printf ("\"topic_list = \"%s", topicsList );
    }

The first way doesn´t compiles, and the second doesn´t run...

The two relevant links, I have found, that are connected to this problem are:

  1. http://www.ros.org/wiki/roscpp/Overview/Parameter%20Server (roll till the end of the page).
  2. http://xmlrpcpp.sourceforge.net/doc/classXmlRpc_1_1XmlRpcValue.html

Both of them doesn´t really help me.

Here is also the code for getting my_list:

ros::NodeHandle nh;
XmlRpc::XmlRpcValue my_list;
nh.getParam("topic_list", my_list);
if ( my_list.stringFromXml ( topicsList, &offset ) == TRUE )
{
        printf ("\"topic_list = \"%s", topicsList );
    }

While topic_list is the name of the list in "yaml" file:

topic_list:
- /bb2/left/image_rect
- /bb2/right/image_rect

Thanks in advance, Felix.

2014-04-20 12:26:47 -0600 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.

2014-04-20 12:26:44 -0600 marked best answer How to create "parameters" inside launch files in ROS?

Hello all,

I am a little stuck, so some help be very appreciated very much. I would like to create a list of parameters/variables in the beginning of my launch file, in such a way, that it will available for the user to change the "contents" of the variables, but the rest of the launch file will not change!

Examples: Nowadays I have the next line in my launch file:

<node pkg="rosbag" type="rosbag" name="rosbag1" args="play -l $(find guiPackageParametersToCallback)/BagFiles/2011-12-05-10-55-01.bag" required="true"/>

But the name of the recorded bag file can change so I want to do something like that:

filename = 2011-12-05-10-55-01.bag
<node pkg="rosbag" type="rosbag" name="rosbag1" args="play -l $(find guiPackageParametersToCallback)/BagFiles/filename" required="true"/>

Or in the next case:

 <node name="republish1" type="republish" pkg="image_transport" output="screen" args="compressed in:=/bb2/left/image_rect raw out:=leftCameraTopic" required="true" />

I would like to something:

inputTopic = /bb2/left/image_rect
    <node name="republish1" type="republish" pkg="image_transport" output="screen" args="compressed in:=inputTopic raw out:=leftCameraTopic" required="true" />

Since I am interested to do it in the limits of the launch file itself, I am not sure that "remap" will solve the case here.

Thanks in advance, Felix.

2014-04-20 12:26:43 -0600 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.

2014-04-20 12:26:37 -0600 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-04-20 12:26:35 -0600 marked best answer How to get meaningful backtraces in ROS?

Hello all,

I have a question and I would be grateful if you could find time to answer. I have a segmentation fault using Linux + ROS + C, and I want to analyse it. What I do is the next:

ulimit -c unlimited

compiling + running

gdb my_executable core

bt

But I receive "??" instead of functions names.

In order to do solve it, I have uncommented the next line in CmakeLiskts.txt file: set(ROS_BUILD_TYPE RelWithDebInfo).

And I also have tried to use: set(ROS_BUILD_TYPE Debug)

I still have problems...

Your help will be more than appreciated.

Felix.

2014-04-20 12:26:15 -0600 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-04-20 12:25:32 -0600 marked best answer How to colorize shell while using rosmake?

Hello All,

I am a ROS user, and I compile and build packages using the "rosmake" command. I would be more than happy to know how to see the warnings and the errors coloured in my shell (if possible, using different colours).

Thank you all in advance, Felix.