当前位置:网站首页>Esp32 simple speed message test of ros2 (limit frequency)
Esp32 simple speed message test of ros2 (limit frequency)
2022-07-03 01:07:00 【zhangrelay】
video :
turtlesim_esp32 Release speed test
Use the following code , test :
#include <ros2arduino.h>
#include <WiFi.h>
#include <WiFiUdp.h>
#define SSID "***"
#define SSID_PW "***"
#define AGENT_IP "***"
#define AGENT_PORT *** //AGENT port number
#define PUBLISH_FREQUENCY 5000 //hz
void publishVel(geometry_msgs::Twist* vel, void* arg)
{
(void)(arg);
static int cnt = 0;
vel->linear.x = 0.1+0.01*cnt; // Linear velocity
vel->angular.z = 0.1+0.01*cnt; // angular velocity
// vel->linear.x = ((double)rand()/(RAND_MAX)); // Random linear velocity
// vel->angular.z = ((double)rand()/(RAND_MAX)); // Random angular velocity
// vel->linear.x = 0.2; // Fixed linear velocity
// vel->angular.z = 1.0 - 0.001*cnt; // Changing angular velocity
cnt++;
}
class VelPub : public ros2::Node
{
public:
VelPub()
: Node("esp32_cmdvel")
{
ros2::Publisher<geometry_msgs::Twist>* publisher_ = this->createPublisher<geometry_msgs::Twist>("turtle1/cmd_vel");
this->createWallFreq(PUBLISH_FREQUENCY, (ros2::CallbackFunc)publishVel, nullptr, publisher_);
}
};
WiFiUDP udp;
void setup()
{
WiFi.begin(SSID, SSID_PW);
while(WiFi.status() != WL_CONNECTED);
ros2::init(&udp, AGENT_IP, AGENT_PORT);
}
void loop()
{
static VelPub VelNode;
ros2::spin(&VelNode);
}The effect is as follows :

[email protected]:~$ ros2 topic -h
usage: ros2 topic [-h] [--include-hidden-topics]
Call `ros2 topic <command> -h` for more detailed usage. ...
Various topic related sub-commands
optional arguments:
-h, --help show this help message and exit
--include-hidden-topics
Consider hidden topics as well
Commands:
bw Display bandwidth used by topic
delay Display delay of topic from timestamp in header
echo Output messages from a topic
find Output a list of available topics of a given type
hz Print the average publishing rate to screen
info Print information about a topic
list Output a list of available topics
pub Publish a message to a topic
type Print a topic's type
Call `ros2 topic <command> -h` for more detailed usage.
[email protected]:~$ ros2 The theme -h
usage :ros2 topic [-h] [--include-hidden-topics]
call `ros2 topic <command> -h` For more detailed usage . ...Subcommands related to various topics
Optional parameters :
-h, --help Display this help message and exit
--include-hidden-topics
Also consider hidden themescommand :
bw Shows the bandwidth used by the theme
delay Show the delay of the topic from the timestamp in the title
echo Output messages from a topic
find Output a list of available topics of a given type
hz Print the average release rate to the screen
info Print information about the subject
list Output a list of available topics
pub Post a message to the subject
type Type of print topiccall `ros2 topic <command> -h` For more detailed usage .
[email protected]:~$ ros2 topic hz -h
usage: ros2 topic hz [-h] [--window WINDOW] [--filter EXPR] [--wall-time]
topic_name
Print the average publishing rate to screen
positional arguments:
topic_name Name of the ROS topic to listen to (e.g. '/chatter')
optional arguments:
-h, --help show this help message and exit
--window WINDOW, -w WINDOW
window size, in # of messages, for calculating rate
(default: 10000)
--filter EXPR only measure messages matching the specified Python
expression
--wall-time calculates rate using wall time which can be helpful
when clock is not published during simulation
[email protected]:~$
[email protected]:~$ ros2 The theme hz -h
usage :ros2 topic hz [-h] [--window WINDOW] [--filter EXPR] [--wall-time]
Subject namePrint the average release rate to the screen
Positional arguments :
topic_name To listen to ROS The name of the subject ( for example '/chatter')Optional parameters :
-h, --help Display this help message and exit
--window window ,-w window
Window size , In the number of messages , Used to calculate the rate
( The default value is :10000)
--filter EXPR Only measure to match the specified Python The news of
expression
--wall-time Use wall time Calculation rate , It helps
When the clock is not released during simulation
[email protected]:~$
边栏推荐
- Baidu AI Cloud takes the lead in building a comprehensive and standardized platform for smart cloud
- 瑞萨RZ/G2L ARM开发板存储读写速度与网络实测
- File operation io-part2
- Vulkan practice first bullet
- [AUTOSAR five methodology]
- [AUTOSAR 11 communication related mechanism]
- [AUTOSAR nine c/s principle Architecture]
- leetcode-871:最低加油次数
- matlab查找某一行或者某一列在矩阵中的位置
- Leetcode-871: minimum refueling times
猜你喜欢

Deep analysis of data storage in memory
![[shutter] image component (cached_network_image network image caching plug-in)](/img/cc/967ff62c7f82e1c6613b3d0f26bb3e.gif)
[shutter] image component (cached_network_image network image caching plug-in)

1696C. Fishingprince Plays With Array【思维题 + 中间状态 + 优化存储】

指针进阶(一)

机器学习术语

详解RDD基本概念、RDD五大属性

(C语言)数据的存储

matlab 多普勒效应产生振动信号和处理

Assets, vulnerabilities, threats and events of the four elements of safe operation

【爱死机】《吉巴罗》被忽略的细节
随机推荐
详解RDD基本概念、RDD五大属性
Thread start and priority
Array and collection performance comparison
leetcode:871. Minimum refueling times [Pat has done before + maximum stacking + greed]
[AUTOSAR XIII NVM]
【AutoSAR 十二 模式管理】
[AUTOSAR + IO Architecture]
Rk3568 development board evaluation (II): development environment construction
12_微信小程序之微信视频号滚动自动播放视频效果实现
2022.2.14 resumption
寻找标杆战友 | 百万级实时数据平台,终身免费使用
Embrace the safety concept of platform delivery
leetcode:701. 二叉搜索树中的插入操作【bst的插入】
Vulkan practice first bullet
FPGA - 7系列 FPGA内部结构之Clocking -04- 多区域时钟
递归处理组织的几种情况
[daily training] 871 Minimum refueling times
R language ggplot2 visualization: use ggplot2 to display dataframe data that are all classified variables in the form of thermal diagram, and customize the legend color legend of factor
【AutoSAR 一 概述】
Correctly distinguish the similarities and differences among API, rest API, restful API and web service