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

mcamurri's profile - activity

2022-07-22 01:23:28 -0500 received badge  Good Answer (source)
2021-12-23 05:42:42 -0500 received badge  Nice Answer (source)
2021-04-12 08:06:04 -0500 received badge  Notable Question (source)
2020-09-06 15:17:04 -0500 received badge  Famous Question (source)
2020-08-11 13:02:52 -0500 received badge  Self-Learner (source)
2020-08-11 13:02:52 -0500 received badge  Teacher (source)
2020-08-11 08:57:52 -0500 answered a question programmatically load yaml parameters in C

Thanks @praskot, but I did not specify that I don't want to depend explicitly on yaml-cpp. I've resolved by invoking the

2020-08-11 08:57:52 -0500 received badge  Rapid Responder (source)
2020-08-11 08:53:14 -0500 commented answer programmatically load yaml parameters in C

But how about cached parameters? Here it says that the nodes are notified when such parameters are changed, but it is no

2020-08-11 08:50:51 -0500 received badge  Notable Question (source)
2020-08-10 22:39:42 -0500 received badge  Popular Question (source)
2020-08-10 15:18:56 -0500 asked a question programmatically load yaml parameters in C

programmatically load yaml parameters in C Hi all, I'm trying to load a YAML file into the parameter server programmatic

2020-05-08 23:14:39 -0500 received badge  Good Question (source)
2019-12-05 08:23:23 -0500 received badge  Nice Question (source)
2019-09-24 07:55:55 -0500 received badge  Famous Question (source)
2019-09-24 07:55:55 -0500 received badge  Notable Question (source)
2019-09-24 07:55:55 -0500 received badge  Popular Question (source)
2019-07-28 21:16:03 -0500 received badge  Famous Question (source)
2019-07-08 07:06:36 -0500 received badge  Famous Question (source)
2019-06-20 09:39:19 -0500 marked best answer rosbag and parameters dump with unique timestamp in filename

Dear all,
my problem is the following:
I want to save a rosbag file and dump at the same time the content of the parameter server on a file.
I want the file and the rosbag to have exactly the same time appendix. This is a similar problem to this but not quite the same because it doesn't involve setting the timestamps into parameter server values.

I couldn't find a way to save the timestamp string into an arg, however the following code kind of works for the parameters:

<launch>
  <arg name="time_now" value="`date +'%Y-%m-%d-%H-%M-%S'`" />
  <rosparam command="dump" param="/robot_description" file="robot_description_$(arg time_now).yaml" />
  <node name="rosbag" pkg="rosbag" type="record"
          args="-O robot_$(arg time_now).bag /chatter "/>
</launch>

The output says something like:

running rosparam dump robot_description_`date +'%Y-%m-%d-%H-%M-%S'`.yaml /robot_description

but the filename is correct.

However, when it comes to the rosbag part, the command is not understood, and in particular it believes +'%Y-%m-%d-%H-%M-%S' is a topic to log instead of the argument of date.

I know I could exploit the automatic appending of the string from rosbag, but there is a tiny chance the two string would be different.

I've tried to execute a fake node with a bash script inside that sets up an environment variable to be captured with $(env ...) but it didn't work out.

I've tried to use python and $(eval ...), but I couldn't get to work because I cant import and use time in the same line.

I understood that param are inaccessible from a launchfile (you can only set them but not get) unless you do dirty tricks with launch-prefix.

Is there another way (please don't tell me the only way is to create a Python script to run the rosbag)?

2019-06-20 09:39:14 -0500 commented answer rosbag and parameters dump with unique timestamp in filename

This answer wins. Thanks!

2019-06-20 09:01:25 -0500 received badge  Famous Question (source)
2019-06-20 09:01:25 -0500 received badge  Notable Question (source)
2019-06-17 08:20:10 -0500 received badge  Popular Question (source)
2019-06-14 11:48:15 -0500 commented question rosbag and parameters dump with unique timestamp in filename

you mean, calling the ROS commands (i.e., rosparam dump, rosbag, etc.) in a bash script and then calling the bash scrip

2019-06-14 10:09:45 -0500 asked a question rosbag and parameters dump with unique timestamp in filename

rosbag and parameters dump with unique timestamp in filename Dear all, my problem is the following: I want to save a r

2019-06-14 07:51:00 -0500 commented answer Get timestamp during roslaunch

I figured out myself. For interested people: <arg name="time_now" value="`date +'%Y-%m-%d-%H-%M-%S'`" /> <r

2019-06-11 04:54:15 -0500 commented answer Get timestamp during roslaunch

I figured out myself. For interested people: <arg name="time_now" value="`date +'%Y-%m-%d-%H-%M-%S'`" /> <r

2019-06-11 04:13:29 -0500 commented answer Get timestamp during roslaunch

Hi all, I have a very similar problem. Instead of dumping the timestamp into a parameter, I need to concatenate the time

2019-05-20 20:12:32 -0500 received badge  Famous Question (source)
2019-05-16 01:35:42 -0500 received badge  Popular Question (source)
2019-05-14 08:54:09 -0500 commented question see full launchfile from top tier one

That's not exactly what I've asked but I agree it's very similar. I've asked to generate the full launchfile from nested

2019-05-14 08:54:09 -0500 received badge  Commentator
2019-05-14 08:21:15 -0500 commented question see full launchfile from top tier one

That one works, thanks! Not marking as solved because maybe there's some other solution available.

2019-05-14 06:36:37 -0500 commented question see full launchfile from top tier one

Thanks but it seems not to be supported in melodic. I've tried to clone and run anyway but I get import errors related t

2019-05-14 05:49:47 -0500 asked a question see full launchfile from top tier one

see full launchfile from top tier one Large launch files have several includes. It would be helpful to have a command t

2019-03-28 03:24:14 -0500 received badge  Student (source)
2019-03-28 03:23:33 -0500 received badge  Notable Question (source)
2019-03-28 03:23:33 -0500 received badge  Popular Question (source)
2019-03-05 04:14:19 -0500 received badge  Enthusiast
2019-02-28 06:33:14 -0500 asked a question Optimal record settings for large rosbags with camera inputs

Optimal record settings for large rosbags with camera inputs Hi all, I was wondering what are the best settings to recor

2019-02-19 09:55:09 -0500 received badge  Notable Question (source)
2019-02-18 06:15:53 -0500 marked best answer subscribe to callback which takes arguments and transport hints

Hi all, I'm subscribing to a callback which takes arguments by using the boost::bind structure:

nh_.subscribe<MsgT>(topic, 1000,  boost::bind(&ROSFrontEnd::callback<MsgT>, this, _1, sensor_id));

where the callback signature is the follwing:

template <class MsgT>
void callback(boost::shared_ptr<MsgT const> msg,
              const SensorId& Key);

Now I want to extend the subscription by adding transport hints, like so:

nh_.subscribe<MsgT>(topic, 1000,  boost::bind(&ROSFrontEnd::callback<MsgT>, this, _1, sensor_id), ros::TransportHints().tcpNoDelay());

but I get a compilation error saying that there is no such signature for subscribe.

What is the correct way to subscribe to a callback taking arguments and passing transport hints as well?

The code worked just fine without the transport hints. I'm using Ubuntu 16.04 with ROS Kinetic.

UPDATE Here is a MCVE with the full error listing:

#include <boost/shared_ptr.hpp>
#include <boost/bind.hpp>
#include <std_msgs/String.h>
#include <ros/node_handle.h>
#include <ros/subscriber.h>
#include <ros/transport_hints.h>

class TransportHintsTest {
public:
    typedef std::string SensorId;
public:

    TransportHintsTest(ros::NodeHandle& nh) : nh_(nh){

        SensorId id = "string";
        sub = nh_.subscribe<std_msgs::String>("mytopic", 10, boost::bind(&TransportHintsTest::callback<std_msgs::String>,
                                                                         this,
                                                                         _1,
                                                                         id),
                                              ros::TransportHints().tcpNoDelay()); // without this last argument, compiles fine
    }

    template <class MsgT>
    void callback(boost::shared_ptr<MsgT const> msg, const SensorId& sensor_id){
    }

private:
    ros::Subscriber sub;
    ros::NodeHandle nh_;
};

int main(int argc, char** argv) {
    ros::init(argc, argv,"transport_hint_test");
    ros::NodeHandle nh;
    TransportHintsTest node(nh);
}

The error says:

/home/mcamurri/catkin_ws/src/transport_hint_test/src/transport_hints.cpp: In constructor ‘TransportHintsTest::TransportHintsTest(ros::NodeHandle&)’:
/home/mcamurri/catkin_ws/src/transport_hint_test/src/transport_hints.cpp:20:81: error: no matching function for call to ‘ros::NodeHandle::subscribe(const char [8], int, boost::_bi::bind_t<void, boost::_mfi::mf2<void, TransportHintsTest, boost::shared_ptr<const std_msgs::String_<std::allocator<void> > >, const std::__cxx11::basic_string<char>&>, boost::_bi::list3<boost::_bi::value<TransportHintsTest*>, boost::arg<1>, boost::_bi::value<std::__cxx11::basic_string<char> > > >, ros::TransportHints&)’
                                               ros::TransportHints().tcpNoDelay());
                                                                                 ^
In file included from /home/mcamurri/catkin_ws/src/transport_hint_test/src/transport_hints.cpp:4:0:
/opt/ros/kinetic/include/ros/node_handle.h:402:14: note: candidate: template<class M, class T> ros::Subscriber ros::NodeHandle::subscribe(const string&, uint32_t, void (T::*)(M), T*, const ros::TransportHints&)
   Subscriber subscribe(const std::string& topic, uint32_t queue_size, void(T::*fp)(M), T* obj, 
              ^
/opt/ros/kinetic/include/ros/node_handle.h:402:14: note:   template argument deduction/substitution failed:
/home/mcamurri/catkin_ws/src/transport_hint_test/src/transport_hints.cpp:20:81: note:   mismatched types ‘void (T::*)(std_msgs::String_<std::allocator<void> >)’ and ‘boost::_bi::bind_t<void, boost::_mfi::mf2<void, TransportHintsTest, boost::shared_ptr<const std_msgs::String_<std::allocator<void> > >, const std::__cxx11::basic_string<char>&>, boost::_bi::list3<boost::_bi::value<TransportHintsTest*>, boost::arg<1>, boost::_bi::value<std::__cxx11::basic_string<char> > > >’
                                               ros::TransportHints().tcpNoDelay());
                                                                                 ^
In file included from /home/mcamurri/catkin_ws/src/transport_hint_test/src/transport_hints.cpp:4:0:
/opt/ros/kinetic/include/ros/node_handle.h:413:14: note: candidate: template<class M, class T> ros::Subscriber ros::NodeHandle::subscribe ...
(more)
2019-02-18 06:15:51 -0500 commented answer subscribe to callback which takes arguments and transport hints

Thank you! It works!

2019-02-18 04:59:19 -0500 received badge  Popular Question (source)
2019-02-18 04:32:26 -0500 edited question subscribe to callback which takes arguments and transport hints

subscribe to callback which takes arguments and transport hints Hi all, I'm subscribing to a callback which takes argume

2019-02-18 04:29:50 -0500 edited question subscribe to callback which takes arguments and transport hints

subscribe to callback which takes arguments and transport hints Hi all, I'm subscribing to a callback which takes argume

2019-02-18 04:28:16 -0500 commented question subscribe to callback which takes arguments and transport hints

I've added a minimal example with full error output.

2019-02-18 04:28:15 -0500 edited question subscribe to callback which takes arguments and transport hints

subscribe to callback which takes arguments and transport hints Hi all, I'm subscribing to a callback which takes argume