当前位置:网站首页>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]:~$
边栏推荐
- 1696C. Fishingprince Plays With Array【思维题 + 中间状态 + 优化存储】
- matlab查找某一行或者某一列在矩阵中的位置
- Every k nodes in the linked list are flipped
- RK3568开发板评测篇(二):开发环境搭建
- excel表格计算时间日期的差值,并转化为分钟数
- Baidu AI Cloud takes the lead in building a comprehensive and standardized platform for smart cloud
- 【AutoSAR 一 概述】
- 删除有序链表中重复的元素-II
- 比较版本号
- Leetcode-849: maximum distance to the nearest person
猜你喜欢

Embrace the safety concept of platform delivery

无向图的割点

leetcode-2280:表示一个折线图的最少线段数

Understanding and distinguishing of some noun concepts in adjustment / filtering

MySQL

Linear programming of mathematical modeling (including Matlab code)

(C语言)数据的存储

研发一款国产ARM智能边缘计算网关需要什么

异步、郵件、定時三大任務

JS inheritance and prototype chain
随机推荐
Every k nodes in the linked list are flipped
JS inheritance and prototype chain
Arduino开发之按键检测与正弦信号输出
[AUTOSAR nine c/s principle Architecture]
数据分析思维分析犯法和业务知识——分析方法(一)
【AutoSAR 一 概述】
mysql 多表联合删除
R language generalized linear model function GLM, (model fit and expression diagnostics), model adequacy evaluation method, use plot function and car package function
【无标题】
Leetcode-2280: represents the minimum number of line segments of a line graph
比较版本号
【AutoSAR 十 IO架构】
18_ The wechat video number of wechat applet scrolls and automatically plays the video effect to achieve 2.0
Array and collection performance comparison
The difference between relational database and non relational database
1038 Recover the Smallest Number
深度剖析数据在内存中的存储
瑞萨电子RZ/G2L开发板上手评测
leetcode-871:最低加油次数
链表中的节点每k个一组翻转