2727#include " sensor_msgs/msg/battery_state.hpp"
2828#include " sensor_msgs/msg/image.hpp"
2929
30+ // Constants
3031#define IMAGE_HEIGHT 432
3132#define IMAGE_WIDTH 768
3233#define TILE_X 2
3334#define TILE_Y 3
34-
35- #define SCORE_THRESH 0.4
3635#define LINE_NUM 16
3736
3837#define NODE_NAME " pose_display"
3938#define WINDOW_NAME " Clearpath Turtlebot 4 Demo"
39+
40+ // Settings
41+ #define SCORE_THRESH 0.4
4042#define DISPLAY_PERIOD 83 // ms; 12 fps
4143
4244const int max_num_streams = TILE_X * TILE_Y;
@@ -57,6 +59,7 @@ void imageCallback(uint num, std::string ns, const sensor_msgs::msg::Image::Cons
5759 const int x = (num % TILE_X) * IMAGE_WIDTH;
5860 const int y = (num / TILE_X) * IMAGE_HEIGHT;
5961 frame.copyTo (full_frame (cv::Rect (x, y, IMAGE_WIDTH, IMAGE_HEIGHT)));
62+
6063 cv::putText (full_frame, ns, cv::Point (x + 50 , y + 50 ),
6164 cv::FONT_HERSHEY_PLAIN, 2 , cv::Scalar (0 , 0 , 255 ), 2 );
6265 if (batt_perc[num])
@@ -88,6 +91,9 @@ void imageCallback(uint num, std::string ns, const sensor_msgs::msg::Image::Cons
8891 }
8992 }
9093 }
94+
95+ cv::rectangle (full_frame, cv::Rect (x, y, IMAGE_WIDTH, IMAGE_HEIGHT),
96+ cv::Scalar (150 , 150 , 150 ), 2 , cv::LINE_AA);
9197 }
9298 catch (const std::exception& e)
9399 {
@@ -154,12 +160,25 @@ int main(int argc, char ** argv)
154160 rclcpp::Subscription<geometry_msgs::msg::PoseArray>::SharedPtr body_sub[max_num_streams];
155161 rclcpp::Subscription<sensor_msgs::msg::BatteryState>::SharedPtr battery_sub[max_num_streams];
156162
163+ const rmw_qos_profile_t rmw_qos_profile_video =
164+ {
165+ RMW_QOS_POLICY_HISTORY_KEEP_LAST,
166+ 1 ,
167+ RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT,
168+ RMW_QOS_POLICY_DURABILITY_VOLATILE,
169+ RMW_QOS_DEADLINE_DEFAULT,
170+ RMW_QOS_LIFESPAN_DEFAULT,
171+ RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
172+ RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT,
173+ false
174+ };
175+
157176 for (uint i=0 ; i < namespaces.size (); i++)
158177 {
159178 frame_sub[i] = image_transport::create_subscription (
160179 node.get (), " /" + namespaces[i]+" /oakd/rgb/preview/encoded" ,
161180 [i, namespaces] (const sensor_msgs::msg::Image::ConstSharedPtr & msg) {imageCallback (i, namespaces[i], msg);},
162- " ffmpeg" , rmw_qos_profile_sensor_data );
181+ " ffmpeg" , rmw_qos_profile_video );
163182
164183 body_sub[i] = node->create_subscription <geometry_msgs::msg::PoseArray>(
165184 " /" + namespaces[i]+" /body_pose" ,
0 commit comments