ROS对topic进行帧率的变化,以及显示

1.下载topic_tools

git clone https://github.com/ros/ros_comm.git

对其进行catkin_make编译以及加入环境变量即可,是一个ros package。

2.把左右相机的数据帧率降到4

rosrun topic_tools throttle messages /mynteye/right/image_raw 4

这条指令会默认的创建一个新的帧率为4的topic,topic的名字为 /mynteye/right/image_raw_throttle

3.把低帧率的原始数据显示出来

rosrun image_view image_view  imag:=/mynteye/right/image_raw_throttle

由于是4帧每秒,所以看起来会有一些一卡一顿的,这样证明成功降低了帧率。

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在Qt中使用ROS2进行topic通讯需要使用ROS2的C++ API。以下是一些基本步骤: 1. 安装ROS2和Qt 2. 在Qt中创建一个C++项目 3. 在CMakeLists.txt中添加以下代码以链接ROS2: ``` find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) find_package(std_msgs REQUIRED) ``` 4. 在Qt中创建一个ROS2节点: ``` #include "rclcpp/rclcpp.hpp" #include "std_msgs/msg/string.hpp" class MyNode : public rclcpp::Node { public: MyNode() : Node("my_node") { publisher_ = this->create_publisher<std_msgs::msg::String>("my_topic", 10); timer_ = this->create_wall_timer(std::chrono::milliseconds(500), std::bind(&MyNode::publishMessage, this)); } private: void publishMessage() { auto message = std_msgs::msg::String(); message.data = "Hello, world!"; publisher_->publish(message); } rclcpp::Publisher<std_msgs::msg::String>::SharedPtr publisher_; rclcpp::TimerBase::SharedPtr timer_; }; ``` 5. 在Qt中订阅ROS2话题: ``` #include "rclcpp/rclcpp.hpp" #include "std_msgs/msg/string.hpp" class MyNode : public rclcpp::Node { public: MyNode() : Node("my_node") { subscriber_ = this->create_subscription<std_msgs::msg::String>("my_topic", 10, std::bind(&MyNode::receiveMessage, this, std::placeholders::_1)); } private: void receiveMessage(const std_msgs::msg::String::SharedPtr message) { qDebug() << "Received message: " << message->data.c_str(); } rclcpp::Subscription<std_msgs::msg::String>::SharedPtr subscriber_; }; ``` 这些是基本的步骤,你可以根据你的需求和情况进行调整。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值