Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cant understand ros api properly

I am looking at ros::nodehandle::advertise api here: , and ros::nodehandle::publish in here, acc to these description of advertise member function :

 template<class M >
Publisher ros::NodeHandle::advertise    (   const std::string &     topic,
        uint32_t    queue_size,
        const SubscriberStatusCallback &    connect_cb,
        const SubscriberStatusCallback &    disconnect_cb = SubscriberStatusCallback(),
        const VoidConstPtr &    tracked_object = VoidConstPtr(),
        bool    latch = false 
)

the shortest vesrion of these function is as: handle.advertise<std_msgs::Empty>("my_topic", 1, (ros::SubscriberStatusCallback)connectCallback);

and for subscriber it is like:

template<class M , class T >
Subscriber ros::NodeHandle::subscribe   (   const std::string &     topic,
        uint32_t    queue_size,
        void(T::*)(const boost::shared_ptr< M const > &)    fp,
        T *     obj,
        const TransportHints &      transport_hints = TransportHints() 
    )       [inline]

with shortest version or simple description as:

ros::Subscriber sub = handle.subscribe("my_topic", 1, &Foo::callback, &foo_object);

I am using them in my node as: ros::NodeHandle nh; ros::Subscriber sub = nh.subscribe ("/camera/depth/points", 1, cloud_cb); marker_pub = nh.advertise<visualization_msgs::marker> ("visualization_marker",1); So why cant i create the subscriber as :

   ros::Subscriber sub = nh.subscribe<visualization_msgs::Marker> ("/camera/depth/points", 1, cloud_cb);

and the publisher as:

  marker_pub = nh.advertise ("visualization_marker",1);

Before these i was not studying the ros api in detail but now since i need to comibine ros and gazebo i am also trying to understand ros api. I haven't api before these. gazebo api was ok for me, now i am trying understand ros api also and i got stuck in these part.

cant understand ros api properly

I am looking at ros::nodehandle::advertise api here: , and ros::nodehandle::publish in here, acc to these description of advertise member function :

 template<class M >
Publisher ros::NodeHandle::advertise    (   const std::string &     topic,
        uint32_t    queue_size,
        const SubscriberStatusCallback &    connect_cb,
        const SubscriberStatusCallback &    disconnect_cb = SubscriberStatusCallback(),
        const VoidConstPtr &    tracked_object = VoidConstPtr(),
        bool    latch = false 
)

the shortest vesrion of these function is as: handle.advertise<std_msgs::Empty>("my_topic", 1, (ros::SubscriberStatusCallback)connectCallback);

and for subscriber it is like:

template<class M , class T >
Subscriber ros::NodeHandle::subscribe   (   const std::string &     topic,
        uint32_t    queue_size,
        void(T::*)(const boost::shared_ptr< M const > &)    fp,
        T *     obj,
        const TransportHints &      transport_hints = TransportHints() 
    )       [inline]

with shortest version or simple description as:

ros::Subscriber sub = handle.subscribe("my_topic", 1, &Foo::callback, &foo_object);

I am using them in my node as: as:

   ros::NodeHandle nh;
    ros::Subscriber sub = nh.subscribe ("/camera/depth/points", 1, cloud_cb);
    marker_pub = nh.advertise<visualization_msgs::marker> nh.advertise<visualization_msgs::Marker> ("visualization_marker",1);

So why cant i create the subscriber as :

   ros::Subscriber sub = nh.subscribe<visualization_msgs::Marker> ("/camera/depth/points", 1, cloud_cb);

and the publisher as:

  marker_pub = nh.advertise ("visualization_marker",1);

Before these i was not studying the ros api in detail but now since i need to comibine ros and gazebo i am also trying to understand ros api. I haven't api before these. gazebo api was ok for me, now i am trying understand ros api also and i got stuck in these part.

cant understand ros api properly

I am looking at ros::nodehandle::advertise api here: , and ros::nodehandle::publish in here, acc to these description of advertise member function :

 template<class M >
Publisher ros::NodeHandle::advertise    (   const std::string &     topic,
        uint32_t    queue_size,
        const SubscriberStatusCallback &    connect_cb,
        const SubscriberStatusCallback &    disconnect_cb = SubscriberStatusCallback(),
        const VoidConstPtr &    tracked_object = VoidConstPtr(),
        bool    latch = false 
)

the shortest vesrion of these function is as: handle.advertise<std_msgs::Empty>("my_topic", 1, (ros::SubscriberStatusCallback)connectCallback);

and for subscriber it is like:

template<class M , class T >
Subscriber ros::NodeHandle::subscribe   (   const std::string &     topic,
        uint32_t    queue_size,
        void(T::*)(const boost::shared_ptr< M const > &)    fp,
        T *     obj,
        const TransportHints &      transport_hints = TransportHints() 
    )       [inline]

with shortest version or simple description as:

ros::Subscriber sub = handle.subscribe("my_topic", 1, &Foo::callback, &foo_object);

I am using them in my node as:

   ros::NodeHandle nh;
    ros::Subscriber sub = nh.subscribe ("/camera/depth/points", 1, cloud_cb);
    marker_pub = nh.advertise<visualization_msgs::Marker> ("visualization_marker",1);

So why cant i create the subscriber as :

   ros::Subscriber sub = nh.subscribe<visualization_msgs::Marker> ("/camera/depth/points", 1, cloud_cb);

and the publisher as:

  marker_pub = nh.advertise ("visualization_marker",1);

Before these i was not studying the ros api in detail but now since i need to comibine ros and gazebo i am also trying to understand ros api. I haven't seen ros api before these. these in detail. gazebo api was ok for me, now i am trying understand ros api also and i got stuck in these part.

cant understand ros api properly

I am looking at ros::nodehandle::advertise api here: , and ros::nodehandle::publish in here, acc to these description of advertise member function :

 template<class M >
Publisher ros::NodeHandle::advertise    (   const std::string &     topic,
        uint32_t    queue_size,
        const SubscriberStatusCallback &    connect_cb,
        const SubscriberStatusCallback &    disconnect_cb = SubscriberStatusCallback(),
        const VoidConstPtr &    tracked_object = VoidConstPtr(),
        bool    latch = false 
)

the shortest vesrion of these function is as: handle.advertise<std_msgs::Empty>("my_topic", 1, (ros::SubscriberStatusCallback)connectCallback);

and for subscriber it is like:

template<class M , class T >
Subscriber ros::NodeHandle::subscribe   (   const std::string &     topic,
        uint32_t    queue_size,
        void(T::*)(const boost::shared_ptr< M const > &)    fp,
        T *     obj,
        const TransportHints &      transport_hints = TransportHints() 
    )       [inline]

with shortest version or simple description as:

ros::Subscriber sub = handle.subscribe("my_topic", 1, &Foo::callback, &foo_object);

I am using them in my node as:

   ros::NodeHandle nh;
    ros::Subscriber sub = nh.subscribe ("/camera/depth/points", 1, cloud_cb);
    marker_pub = nh.advertise<visualization_msgs::Marker> ("visualization_marker",1);

So why cant i create the subscriber as :

   ros::Subscriber sub = nh.subscribe<visualization_msgs::Marker> ("/camera/depth/points", 1, cloud_cb);

and the publisher as:

  marker_pub = nh.advertise ("visualization_marker",1);

Before these i was not studying the ros api in detail but now since i need to comibine ros and gazebo i am also trying to understand ros api. I haven't seen ros api before these in detail. gazebo api was ok for me, now i am trying understand ros api also and i got stuck in didn't understood these part.

cant understand ros api properly

I am looking at ros::nodehandle::advertise api here: , and ros::nodehandle::publish in here, acc to these description of advertise member function :

 template<class M >
Publisher ros::NodeHandle::advertise    (   const std::string &     topic,
        uint32_t    queue_size,
        const SubscriberStatusCallback &    connect_cb,
        const SubscriberStatusCallback &    disconnect_cb = SubscriberStatusCallback(),
        const VoidConstPtr &    tracked_object = VoidConstPtr(),
        bool    latch = false 
)

the shortest vesrion of these function is as: handle.advertise<std_msgs::Empty>("my_topic", 1, (ros::SubscriberStatusCallback)connectCallback);

and for subscriber it is like:

template<class M , class T >
Subscriber ros::NodeHandle::subscribe   (   const std::string &     topic,
        uint32_t    queue_size,
        void(T::*)(const boost::shared_ptr< M const > &)    fp,
        T *     obj,
        const TransportHints &      transport_hints = TransportHints() 
    )       [inline]

with shortest version or simple description as:

ros::Subscriber sub = handle.subscribe("my_topic", 1, &Foo::callback, &foo_object);

I am using them in my node as:

   ros::NodeHandle nh;
    ros::Subscriber sub = nh.subscribe ("/camera/depth/points", 1, cloud_cb);
    marker_pub = nh.advertise<visualization_msgs::Marker> ("visualization_marker",1);

So why cant i create the subscriber as :

   ros::Subscriber sub = nh.subscribe<visualization_msgs::Marker> ("/camera/depth/points", 1, cloud_cb);

and the publisher as:

  marker_pub = nh.advertise ("visualization_marker",1);

Before these i was not studying the ros api in detail but now since i need to comibine ros and gazebo i am also trying to understand ros api. I haven't seen ros api before these in detail. gazebo api was ok for me, now i am trying understand ros api also and i didn't understood these part.