Created
February 21, 2022 10:28
-
-
Save surajRathi/d27fe1c4a04465f3c991480d47357c55 to your computer and use it in GitHub Desktop.
Use image_transport::subscribe_camera
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ros/ros.h> | |
#include <image_transport/image_transport.h> | |
int main(int argc, char *argv[]) { | |
ros::init(argc, argv, "auto_brightness", ros::init_options::AnonymousName); | |
ros::NodeHandle nh, pnh("~"); | |
image_transport::ImageTransport it{nh}; // Is this necessary? | |
auto input_ns = pnh.param("input", std::string{"camera"}); | |
auto output_ns = pnh.param("output", std::string{"fake_stereo"}); | |
auto callback = []( | |
const sensor_msgs::ImageConstPtr &img, const sensor_msgs::CameraInfoConstPtr &cinfo) { | |
ROS_WARN("recv data"); | |
}; | |
ROS_ERROR("Node runnin? %s %s", input_ns.c_str(), output_ns.c_str()); | |
auto camera_sub = it.subscribeCamera(input_ns + "/image_raw", 10, | |
image_transport::CameraSubscriber::Callback{callback}); | |
ros::spin(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment