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

alexandru.lesi's profile - activity

2018-07-09 14:07:59 -0500 marked best answer Image Publisher and Subscriber in same node.

I'm trying to get this code to work:

#include "ros/ros.h"
#include "std_msgs/String.h"
#include "image_transport/image_transport.h"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "cv_bridge/cv_bridge.h"
#include "image_geometry/pinhole_camera_model.h"

#include <sstream>

class GetRays{

private:

  image_transport::Publisher  pub;
  image_transport::Subscriber sub;

public:

  GetRays(ros::NodeHandle &nh, image_transport::ImageTransport &it){
    pub = it.advertise("/blob_map",1);
    sub = it.subscribe("/saliency_map", 1, imageCallback);
  }

  void thresholdImage(const sensor_msgs::ImageConstPtr& msg, sensor_msgs::ImageConstPtr& out){
    cv::Mat mat = cv_bridge::toCvShare(msg, "bgr8")->image;
    cv::threshold(mat,mat,0,255,3);
    out = cv_bridge::CvImage(std_msgs::Header(), "bgr8", mat).toImageMsg();
  }

  void imageCallback(const sensor_msgs::ImageConstPtr& msg)
  {
    sensor_msgs::ImageConstPtr thresh;
    thresholdImage(msg,thresh);
    pub.publish(msg);
  }
};

int main(int argc, char **argv)
{
  ros::NodeHandle nh;
  image_transport::ImageTransport it(nh);
  ros::init(argc, argv, "get_ray");
  GetRays getRays(nh,it);
  ros::spin();

  return 0;
}

But for some reason it keeps complaining that I'm not passing the right attributes to the it.subscribe("/saliency_map", 1, imageCallback) constructor:

/disk/users/lesi/Saliency/catkin_ws/src/saliency/src/get_rays.cpp: In constructor 'GetRays::GetRays(ros::NodeHandle&, image_transport::ImageTransport&)':
/disk/users/lesi/Saliency/catkin_ws/src/saliency/src/get_rays.cpp:22:57: error: no matching function for call to 'image_transport::ImageTransport::subscribe(const char [14], int, <unresolved overloaded function type>)'
     sub = it.subscribe("/saliency_map", 1, imageCallback);
                                                         ^
/disk/users/lesi/Saliency/catkin_ws/src/saliency/src/get_rays.cpp:22:57: note: candidates are:
In file included from /disk/users/lesi/Saliency/catkin_ws/src/saliency/src/get_rays.cpp:3:0:
/opt/ros/indigo/include/image_transport/image_transport.h:74:14: note: image_transport::Subscriber image_transport::ImageTransport::subscribe(const string&, uint32_t, const boost::function<void(const boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&)>&, const VoidPtr&, const image_transport::TransportHints&)
   Subscriber subscribe(const std::string& base_topic, uint32_t queue_size,
              ^
/opt/ros/indigo/include/image_transport/image_transport.h:74:14: note:   no known conversion for argument 3 from '<unresolved overloaded function type>' to 'const boost::function<void(const boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&)>&'
/opt/ros/indigo/include/image_transport/image_transport.h:82:14: note: image_transport::Subscriber image_transport::ImageTransport::subscribe(const string&, uint32_t, void (*)(const ImageConstPtr&), const image_transport::TransportHints&)
   Subscriber subscribe(const std::string& base_topic, uint32_t queue_size,
              ^
/opt/ros/indigo/include/image_transport/image_transport.h:82:14: note:   no known conversion for argument 3 from '<unresolved overloaded function type>' to 'void (*)(const ImageConstPtr&) {aka void (*)(const boost::shared_ptr<const sensor_msgs::Image_<std::allocator<void> > >&)}'
/opt/ros/indigo/include/image_transport/image_transport.h:95:14: note: template<class T> image_transport::Subscriber image_transport::ImageTransport::subscribe(const string&, uint32_t, void (T::*)(const ImageConstPtr&), T*, const image_transport::TransportHints&)
   Subscriber subscribe(const std::string& base_topic, uint32_t queue_size,
              ^
/opt/ros/indigo/include/image_transport/image_transport.h:95:14: note:   template argument deduction/substitution failed:
/disk/users/lesi/Saliency/catkin_ws/src/saliency/src/get_rays.cpp:22:57: note:   candidate expects 5 arguments, 3 provided
     sub = it.subscribe("/saliency_map", 1, imageCallback);
                                                         ^
In file included from /disk/users/lesi/Saliency/catkin_ws/src/saliency/src/get_rays.cpp:3:0:
/opt/ros/indigo/include/image_transport/image_transport.h:106:14: note ...
(more)
2018-07-09 14:01:52 -0500 marked best answer FLIR PTU initialization error

Hi,

I'm trying to get a FLIR pan and tilt unit (PTU) to run. I've cloned the following repo's:

https://github.com/wjwwood/serial.git
https://github.com/ros-drivers/flir_ptu.git

My username has been added to the dialup group. I've checked that the device is on and connected (dmesg | grep tty). I made sure the baud rate is correct. I tried launching it with the delivered launch file:

roslaunch flir_ptu_driver ptu.launch

But unfortunately I get:

SUMMARY
========

PARAMETERS
 * /ptu/ptu_driver/port: /dev/ttyUSB0
 * /robot_description: <?xml version="1....
 * /rosdistro: indigo
 * /rosversion: 1.11.21

NODES
  /ptu/
    ptu_driver (flir_ptu_driver/ptu_node)
  /
    robot_state_publisher (robot_state_publisher/state_publisher)

auto-starting new master
process[master]: started with pid [21768]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 6da03ef4-3956-11e7-be4f-8c89a57cea6f
process[rosout-1]: started with pid [21781]
started core service [/rosout]
process[robot_state_publisher-2]: started with pid [21785]
process[ptu/ptu_driver-3]: started with pid [21798]
[ERROR] [1494842903.849068048]: Error getting pan-tilt res
[ERROR] [1494842904.052991450]: Error getting pan-tilt res
[ERROR] [1494842904.257020561]: Error getting pan-tilt limit
[ERROR] [1494842904.460998246]: Error getting pan-tilt limit
[ERROR] [1494842904.664990558]: Error getting pan-tilt limit
[ERROR] [1494842904.868993172]: Error getting pan-tilt limit
[ERROR] [1494842905.072993043]: Error getting pan-tilt limit
[ERROR] [1494842905.276940833]: Error getting pan-tilt limit
[ERROR] [1494842905.480866315]: Error getting pan-tilt limit
[ERROR] [1494842905.684846684]: Error getting pan-tilt limit
[ERROR] [1494842905.684931517]: Could not initialize FLIR PTU on /dev/ttyUSB0

I can't figure out what else I could try from here to get it to run. Has anyone got any suggestions or has anyone had the same issue?

2018-07-09 14:00:58 -0500 received badge  Famous Question (source)
2018-07-09 14:00:58 -0500 received badge  Notable Question (source)
2018-07-02 10:12:14 -0500 received badge  Famous Question (source)
2018-03-16 13:48:49 -0500 received badge  Notable Question (source)
2017-11-03 22:46:26 -0500 received badge  Popular Question (source)
2017-07-19 01:54:17 -0500 received badge  Famous Question (source)
2017-06-14 06:16:07 -0500 received badge  Enthusiast
2017-06-13 12:08:01 -0500 asked a question How to fix ros::ConflictingSubscriptionException?

How to fix ros::ConflictingSubscriptionException? Hi, I'm trying to run a node that keeps dying as the following error

2017-06-12 08:40:05 -0500 received badge  Notable Question (source)
2017-05-18 07:14:41 -0500 received badge  Popular Question (source)
2017-05-15 14:02:41 -0500 commented answer FLIR PTU initialization error

Like I mentioned in my description my username has already been added to the dialup group

2017-05-15 05:17:59 -0500 asked a question FLIR PTU initialization error

FLIR PTU initialization error Hi, I'm trying to get a FLIR pan and tilt unit (PTU) to run. I've cloned the following re

2017-05-15 04:36:58 -0500 commented question FLIR 46-70 connectivity error.

Did you solve your issue?

2017-05-02 07:35:21 -0500 received badge  Popular Question (source)
2017-04-30 10:35:11 -0500 edited question How can I make an Image Subscriber and Publisher in the same Node?

How can I make an Image Subscriber and Publisher in the same Node? I'm trying to get this code to work: #include "ros/r

2017-04-30 10:33:46 -0500 asked a question How can I make an Image Subscriber and Publisher in the same Node?

How can I make an Image Subscriber and Publisher in the same Node? I'm trying to get this code to work: #include "ros/r

2017-04-30 10:33:45 -0500 asked a question Image Publisher and Subscriber in same node.

Image Publisher and Subscriber in same node. I'm trying to get this code to work: #include "ros/ros.h" #include "std_ms