@@ -35,6 +35,7 @@ void RGB::setNames() {
3535 ispQName = getName () + " _isp" ;
3636 previewQName = getName () + " _preview" ;
3737 controlQName = getName () + " _control" ;
38+ stillQName = getName () + " _still" ;
3839}
3940
4041void RGB::setXinXout (std::shared_ptr<dai::Pipeline> pipeline) {
@@ -59,6 +60,9 @@ void RGB::setXinXout(std::shared_ptr<dai::Pipeline> pipeline) {
5960 if (ph->getParam <bool >(" i_enable_preview" )) {
6061 previewPub = setupOutput (pipeline, previewQName, [&](auto input) { colorCamNode->preview .link (input); });
6162 }
63+ if (ph->getParam <bool >(" i_enable_still" )) {
64+ stillPub = setupOutput (pipeline, stillQName, [&](auto input) { colorCamNode->still .link (input); });
65+ }
6266 xinControl = pipeline->create <dai::node::XLinkIn>();
6367 xinControl->setStreamName (controlQName);
6468 xinControl->out .link (colorCamNode->inputControl );
@@ -119,6 +123,33 @@ void RGB::setupQueues(std::shared_ptr<dai::Device> device) {
119123 previewPub->setup (device, convConfig, pubConfig);
120124 };
121125 controlQ = device->getInputQueue (controlQName);
126+ if (ph->getParam <bool >(" i_enable_still" )) {
127+ auto tfPrefix = getOpticalTFPrefix (getSocketName (static_cast <dai::CameraBoardSocket>(ph->getParam <int >(" i_board_socket_id" ))));
128+ utils::ImgConverterConfig convConfig;
129+ convConfig.tfPrefix = tfPrefix;
130+ convConfig.getBaseDeviceTimestamp = ph->getParam <bool >(" i_get_base_device_timestamp" );
131+ convConfig.updateROSBaseTimeOnRosMsg = ph->getParam <bool >(" i_update_ros_base_time_on_ros_msg" );
132+ convConfig.addExposureOffset = ph->getParam <bool >(" i_add_exposure_offset" );
133+ convConfig.expOffset = static_cast <dai::CameraExposureOffset>(ph->getParam <int >(" i_exposure_offset" ));
134+
135+ utils::ImgPublisherConfig pubConfig;
136+ pubConfig.daiNodeName = getName ();
137+ pubConfig.topicName = " ~/" + getName ();
138+ pubConfig.lazyPub = ph->getParam <bool >(" i_enable_lazy_publisher" );
139+ pubConfig.socket = static_cast <dai::CameraBoardSocket>(ph->getParam <int >(" i_board_socket_id" ));
140+ pubConfig.calibrationFile = ph->getParam <std::string>(" i_calibration_file" );
141+ pubConfig.rectified = false ;
142+ pubConfig.width = ph->getParam <int >(" i_still_width" );
143+ pubConfig.height = ph->getParam <int >(" i_still_height" );
144+ pubConfig.maxQSize = ph->getParam <int >(" i_max_q_size" );
145+ pubConfig.topicSuffix = " /still/image_raw" ;
146+ pubConfig.flipImage = ph->getParam <bool >(" i_flip_published_image" );
147+
148+ stillPub->setup (device, convConfig, pubConfig);
149+
150+ triggerStillService = getROSNode ()->create_service <std_srvs::srv::Trigger>(
151+ " ~/" + getName () + " /trigger_still" , std::bind (&RGB ::triggerStillCB, this , std::placeholders::_1, std::placeholders::_2));
152+ };
122153}
123154
124155void RGB::closeQueues () {
@@ -128,6 +159,10 @@ void RGB::closeQueues() {
128159 previewPub->closeQueue ();
129160 }
130161 }
162+ if (ph->getParam <bool >(" i_enable_still" )) {
163+ triggerStillService.reset ();
164+ stillPub->closeQueue ();
165+ }
131166 controlQ->close ();
132167}
133168
@@ -156,5 +191,13 @@ void RGB::updateParams(const std::vector<rclcpp::Parameter>& params) {
156191 controlQ->send (ctrl);
157192}
158193
194+ void RGB::triggerStillCB (std_srvs::srv::Trigger::Request::ConstSharedPtr /* req*/ , std_srvs::srv::Trigger::Response::SharedPtr res) {
195+ dai::CameraControl ctrl;
196+ ctrl.setCaptureStill (true );
197+ controlQ->send (ctrl);
198+ res->success = true ;
199+ res->message = " Still capture request sent" ;
200+ }
201+
159202} // namespace dai_nodes
160203} // namespace depthai_ros_driver
0 commit comments