当前位置:网站首页>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]:~$
边栏推荐
- 指针进阶(一)
- 1038 Recover the Smallest Number
- Leetcode-1964: find the longest effective obstacle race route to each position
- 递归处理组织的几种情况
- excel表格计算时间日期的差值,并转化为分钟数
- 链表内指定区间反转
- Kubernetes resource object introduction and common commands (V) - (NFS & PV & PVC)
- 基本远程连接工具Xshell
- Vulkan performance and refinement
- Thank you for being together for these extraordinary two years!
猜你喜欢
FPGA - 7 Series FPGA internal structure clocking -04- multi area clock
[AUTOSAR 11 communication related mechanism]
[overview of AUTOSAR three RTE]
【AutoSAR 四 BSW概述】
Embrace the safety concept of platform delivery
1696C. Fishingprince plays with array [thinking questions + intermediate state + optimized storage]
Kubernetes resource object introduction and common commands (V) - (NFS & PV & PVC)
攻克哈希的基本概念与实现
(C语言)数据的存储
Assets, vulnerabilities, threats and events of the four elements of safe operation
随机推荐
Explain the basic concepts and five attributes of RDD in detail
On Fibonacci sequence
[love crash] neglected details of gibaro
[introduction to AUTOSAR seven tool chain]
Vulkan practice first bullet
【爱死机】《吉巴罗》被忽略的细节
[daily training] 871 Minimum refueling times
Win10 can't be installed in many ways Problems with NET3.5
ROS2之ESP32简单速度消息测试(极限频率)
[flutter] icons component (load the built-in icon of flutter | display the material design icon completely)
Rk3568 development board evaluation (II): development environment construction
[AUTOSAR 11 communication related mechanism]
[shutter] image component (configure local GIF image resources | load placeholder with local resources)
Compare version number
tail -f 、tail -F、tailf的区别
Thread start and priority
Reading and writing speed of Reza rz/g2l arm development board storage and network measurement
【AutoSAR 四 BSW概述】
Tensorflow 2. Chapter 15 of X (keras) source code explanation: migration learning and fine tuning
研发一款国产ARM智能边缘计算网关需要什么