ROS2笔记-2:第一个在Gazebo中能动的例子
第一个在Gazebo中能动的例子
- 写在前面
- X-windows 与cursor
- Simple ROS2 Robot
- Project Structure
- Features
- Dependencies
- Installation
- Usage
- Robot Description
- Movement Pattern
- Customization
- 解释
- 运行的效果
- 启动
- 控制机器人移动
- 代码
写在前面
第一个在Gazebo中能动的例子 是指对我来说。在Gazebo中显示,第二个要求是能动。
这个目标对我来说并不容易。可能是我没有装实体机的原因。
如果在MobaStrem中,当然不需要考虑X-windows的问题,但如果在cursor中,就是一个大困难。
X-windows 与cursor
在学习新技术时,我一般需要cursor.
怎么说呢,我不想看书。不是我不想看,一般来说,也没有有书可以看。
再者,人脑容量是有限的,我们需要用一种哲学模式,来描述世界,我们需要在学习一种技术之前,利用哲学窠臼,来思考,如果是我们自己来实现,应当如何做。
所以,我一般都是放弃深度思考,反复与cursor磨合,看它如何进展和不断地犯错,来思考。
但是对X-windows的支持,cursor做得不好。这样一来,我就无法搞清楚是vmware带来的问题还是cursor的问题。
虽然,用手工来执行,也是一个方法,但那并不是个好主意。
所以,想来想去想了一晚上,才想到直接装到ubuntu上。真的是,这么个简单的答案,我一直没想到。
在ubuntu上,我又来到基本的目标,就是机器人能动。
# 部分笔记
因为ubuntu 的桌面,这几年没怎么用。
所以,也不想装输入法,就英文吧。蹩脚,乱,是难免的。
Simple ROS2 Robot
A simple differential drive robot implementation in ROS2 Humble with Gazebo simulation. This project serves as a learning platform for ROS2 and Gazebo integration.
Project Structure
simple_robot_ws/
├── src/
│ └── simple_robot/
│ ├── simple_robot/
│ │ ├── launch/
│ │ │ └── robot_gazebo.launch.py
│ │ ├── robot.urdf.xacro
│ │ └── square_movement.py
│ ├── package.xml
│ └── setup.py
Features
- Simple differential drive robot with two wheels
- Gazebo simulation integration
- Square movement pattern demonstration
- ROS2 Humble compatible
Dependencies
- ROS2 Humble
- Gazebo
- Python 3.10
- Required ROS2 packages:
- gazebo_ros_pkgs
- gazebo_ros2_control
- robot_state_publisher
- xacro
Installation
- Clone this repository into your ROS2 workspace:
cd ~/ros2_ws/src
git clone <repository-url> simple_robot
- Install dependencies:
sudo apt-get update
sudo apt-get install -y ros-humble-gazebo-ros-pkgs ros-humble-gazebo-ros2-control ros-humble-robot-state-publisher ros-humble-xacro
- Build the package:
cd ~/ros2_ws
colcon build --symlink-install
Usage
- Source the workspace:
source install/setup.bash
- Launch the robot in Gazebo:
ros2 launch simple_robot robot_gazebo.launch.py
- In a new terminal, run the square movement node:
source install/setup.bash
ros2 run simple_robot square_movement
Robot Description
The robot consists of:
- A blue rectangular base (0.3m x 0.3m x 0.1m)
- Two black wheels (radius: 0.05m, width: 0.04m)
- Differential drive control system
Movement Pattern
The robot follows a square pattern:
- Moves forward for 5 seconds at 0.2 m/s
- Turns 90 degrees at 0.5 rad/s
- Repeats the pattern
Customization
You can modify:
- Robot dimensions in
robot.urdf.xacro
- Movement speed and pattern in
square_movement.py
- Launch parameters in
robot_gazebo.launch.py
后面我会把这个代码放到github.
解释
the main source code files in detail to help you understand ROS2 concepts:
- First, let’s look at the URDF file (
robot.urdf.xacro
):
Read file: /data/myrobot/simple_robot_ws/src/simple_robot/simple_robot/robot.urdf.xacro
Let me explain the key components of the URDF file:
- Properties and Parameters:
<xacro:property name="PI" value="3.1415926535897931"/>
<xacro:property name="robot_width" value="0.3"/>
- These are reusable variables that define robot dimensions
- Makes it easy to modify robot size by changing one value
- Links (Physical parts of the robot):
<link name="base_link"><visual>...</visual><collision>...</collision><inertial>...</inertial>
</link>
visual
: Defines how the robot looks in simulationcollision
: Defines collision geometry for physicsinertial
: Defines mass and inertia properties
- Joints (Connections between links):
<joint name="base_right_wheel_joint" type="continuous"><parent link="base_link"/><child link="right_wheel"/><origin xyz="0 ${-(robot_width/2 + wheel_width/2)} 0" rpy="${PI/2} 0 0"/><axis xyz="0 0 1"/>
</joint>
type="continuous"
: Allows unlimited rotation (for wheels)parent
andchild
: Defines which links are connectedorigin
: Position and orientation of the jointaxis
: Axis of rotation
- Gazebo Plugin (Simulation interface):
<gazebo><plugin name="differential_drive" filename="libgazebo_ros_diff_drive.so"><left_joint>base_left_wheel_joint</left_joint><right_joint>base_right_wheel_joint</right_joint>...</plugin>
</gazebo>
- Connects ROS2 to Gazebo simulation
- Handles differential drive control
- Publishes odometry information
Now, let’s look at the Python node that controls the robot:
Read file: /data/myrobot/simple_robot_ws/src/simple_robot/simple_robot/simple_robot/square_movement.py
Let me explain the Python node:
- Node Initialization:
def __init__(self):super().__init__('square_movement')self.publisher = self.create_publisher(Twist, '/cmd_vel', 10)self.timer = self.create_timer(0.1, self.timer_callback)
- Creates a ROS2 node named ‘square_movement’
- Creates a publisher for Twist messages on ‘/cmd_vel’ topic
- Sets up a timer that calls
timer_callback
every 0.1 seconds
- Movement Control:
def timer_callback(self):current_time = self.get_clock().now()elapsed_time = (current_time - self.state_start_time).nanoseconds / 1e9msg = Twist()if self.state == 'forward':msg.linear.x = 0.2 # Move forward at 0.2 m/smsg.angular.z = 0.0if elapsed_time >= 5.0: # After 5 secondsself.state = 'turn'elif self.state == 'turn':msg.linear.x = 0.0msg.angular.z = 0.5 # Turn at 0.5 rad/sif elapsed_time >= 3.14: # After ~90 degreesself.state = 'forward'
- Uses a state machine to control robot movement
linear.x
: Forward/backward velocityangular.z
: Rotational velocity- Switches between forward and turning states
- Main Function:
def main(args=None):rclpy.init(args=args)node = SquareMovement()rclpy.spin(node)node.destroy_node()rclpy.shutdown()
- Initializes ROS2
- Creates and runs the node
- Handles cleanup on shutdown
Finally, let’s look at the launch file:
Read file: /data/myrobot/simple_robot_ws/src/simple_robot/simple_robot/launch/robot_gazebo.launch.py
The launch file is responsible for starting all necessary components:
- URDF Processing:
xacro_file = os.path.join(pkg_dir, 'robot.urdf.xacro')
robot_description_config = xacro.process_file(xacro_file)
robot_description = {'robot_description': robot_description_config.toxml()}
- Loads and processes the URDF file
- Converts Xacro macros into XML
- Gazebo Launch:
gazebo_launch = IncludeLaunchDescription(PythonLaunchDescriptionSource([os.path.join(get_package_share_directory('gazebo_ros'), 'launch', 'gazebo.launch.py')]),
)
- Starts the Gazebo simulator
- Robot State Publisher:
robot_state_publisher = Node(package='robot_state_publisher',executable='robot_state_publisher',output='screen',parameters=[robot_description]
)
- Publishes robot joint states
- Required for visualization and control
- Robot Spawning:
spawn_entity = Node(package='gazebo_ros',executable='spawn_entity.py',arguments=['-entity', 'simple_robot','-topic', 'robot_description'],output='screen'
)
- Spawns the robot in Gazebo
- Uses the processed URDF description
Key ROS2 Concepts Demonstrated:
- Nodes: Independent processes (square_movement.py)
- Topics: Communication channels (‘/cmd_vel’)
- Messages: Data structures (Twist)
- Launch System: Starting multiple nodes
- URDF/Xacro: Robot description
- Gazebo Integration: Simulation
- Parameters: Configuration values
- Publishers/Subscribers: Communication pattern
运行的效果
启动
root@ros:/data/myrobot/simple_robot_ws# source install/setup.bash && ros2 launch simple_robot robot_gazebo.launch.py
[INFO] [launch]: All log files can be found below /root/.ros/log/2025-04-06-12-30-45-332217-ros-4626
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [gzserver-1]: process started with pid [4634]
[INFO] [gzclient-2]: process started with pid [4636]
[INFO] [robot_state_publisher-3]: process started with pid [4638]
[INFO] [spawn_entity.py-4]: process started with pid [4640]
[robot_state_publisher-3] [WARN] [1743913845.758133319] [kdl_parser]: The root link base_link has an inertia specified in the URDF, but KDL does not support a root link with an inertia. As a workaround, you can add an extra dummy link to your URDF.
[robot_state_publisher-3] [INFO] [1743913845.758202925] [robot_state_publisher]: got segment base_link
[robot_state_publisher-3] [INFO] [1743913845.758239006] [robot_state_publisher]: got segment left_wheel
[robot_state_publisher-3] [INFO] [1743913845.758242357] [robot_state_publisher]: got segment right_wheel
[spawn_entity.py-4] [INFO] [1743913845.891193009] [spawn_entity]: Spawn Entity started
[spawn_entity.py-4] [INFO] [1743913845.891440305] [spawn_entity]: Loading entity published on topic robot_description
[spawn_entity.py-4] [INFO] [1743913845.892783074] [spawn_entity]: Waiting for entity xml on robot_description
[spawn_entity.py-4] [INFO] [1743913846.020159987] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
[spawn_entity.py-4] [INFO] [1743913846.020361422] [spawn_entity]: Waiting for service /spawn_entity
[spawn_entity.py-4] [INFO] [1743913847.038242167] [spawn_entity]: Calling service /spawn_entity
[spawn_entity.py-4] [INFO] [1743913847.248558627] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [simple_robot]
[gzserver-1] [INFO] [1743913847.262162662] [differential_drive]: Wheel pair 1 separation set to [0.340000m]
[gzserver-1] [INFO] [1743913847.262435027] [differential_drive]: Wheel pair 1 diameter set to [0.100000m]
[gzserver-1] [INFO] [1743913847.263072041] [differential_drive]: Subscribed to [/cmd_vel]
[gzserver-1] [INFO] [1743913847.264434814] [differential_drive]: Advertise odometry on [/odom]
[gzserver-1] [INFO] [1743913847.266079557] [differential_drive]: Publishing odom transforms between [odom] and [base_link]
[gzserver-1] [INFO] [1743913847.266098937] [differential_drive]: Publishing wheel transforms between [base_link], [base_left_wheel_joint] and [base_right_wheel_joint]
[INFO] [spawn_entity.py-4]: process has finished cleanly [pid 4640]
[gzclient-2] context mismatch in svga_surface_destroy
[gzclient-2] context mismatch in svga_surface_destroy
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[robot_state_publisher-3] [INFO] [1743917858.696625720] [rclcpp]: signal_handler(signum=2)
[gzclient-2] context mismatch in svga_surface_destroy
[gzclient-2] context mismatch in svga_surface_destroy
[INFO] [robot_state_publisher-3]: process has finished cleanly [pid 4638]
[INFO] [gzclient-2]: process has finished cleanly [pid 4636]
[INFO] [gzserver-1]: process has finished cleanly [pid 4634]
root@ros:/data/myrobot/simple_robot_ws# source install/setup.bash && ros2 launch simple_robot robot_gazebo.launch.py
[INFO] [launch]: All log files can be found below /root/.ros/log/2025-04-06-13-37-49-581935-ros-21692
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [gzserver-1]: process started with pid [21693]
[INFO] [gzclient-2]: process started with pid [21695]
[INFO] [robot_state_publisher-3]: process started with pid [21697]
[INFO] [spawn_entity.py-4]: process started with pid [21699]
[robot_state_publisher-3] [WARN] [1743917869.961730595] [kdl_parser]: The root link base_link has an inertia specified in the URDF, but KDL does not support a root link with an inertia. As a workaround, you can add an extra dummy link to your URDF.
[robot_state_publisher-3] [INFO] [1743917869.961810285] [robot_state_publisher]: got segment base_link
[robot_state_publisher-3] [INFO] [1743917869.961840435] [robot_state_publisher]: got segment left_wheel
[robot_state_publisher-3] [INFO] [1743917869.961843738] [robot_state_publisher]: got segment right_wheel
[spawn_entity.py-4] [INFO] [1743917870.115293166] [spawn_entity]: Spawn Entity started
[spawn_entity.py-4] [INFO] [1743917870.115563623] [spawn_entity]: Loading entity published on topic robot_description
[spawn_entity.py-4] [INFO] [1743917870.127828694] [spawn_entity]: Waiting for entity xml on robot_description
[spawn_entity.py-4] [INFO] [1743917870.140340287] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
[spawn_entity.py-4] [INFO] [1743917870.140550074] [spawn_entity]: Waiting for service /spawn_entity
[spawn_entity.py-4] [INFO] [1743917871.185531000] [spawn_entity]: Calling service /spawn_entity
[spawn_entity.py-4] [INFO] [1743917871.393789340] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [simple_robot]
[gzserver-1] [INFO] [1743917871.415619114] [differential_drive]: Wheel pair 1 separation set to [0.340000m]
[gzserver-1] [INFO] [1743917871.416094928] [differential_drive]: Wheel pair 1 diameter set to [0.100000m]
[gzserver-1] [INFO] [1743917871.416994931] [differential_drive]: Subscribed to [/cmd_vel]
[gzserver-1] [INFO] [1743917871.418813122] [differential_drive]: Advertise odometry on [/odom]
[gzserver-1] [INFO] [1743917871.421652281] [differential_drive]: Publishing odom transforms between [odom] and [base_link]
[gzserver-1] [INFO] [1743917871.421705231] [differential_drive]: Publishing wheel transforms between [base_link], [base_left_wheel_joint] and [base_right_wheel_joint]
[INFO] [spawn_entity.py-4]: process has finished cleanly [pid 21699]
[gzclient-2] context mismatch in svga_surface_destroy
[gzclient-2] context mismatch in svga_surface_destroy
控制机器人移动
root@ros:/data/myrobot/simple_robot_ws# cd /data/myrobot/simple_robot_ws && source install/setup.bash && ros2 run simple_robot square_movement
代码
https://download.csdn.net/download/haoyujie/90571841
不需要积分。
突然懒病就犯了。不想传到github去了。
相关文章:
ROS2笔记-2:第一个在Gazebo中能动的例子
第一个在Gazebo中能动的例子 写在前面X-windows 与cursorSimple ROS2 RobotProject StructureFeaturesDependenciesInstallationUsageRobot DescriptionMovement PatternCustomization 解释运行的效果启动控制机器人移动 代码 写在前面 第一个在Gazebo中能动的例子 是指对我来…...
剑指Offer(数据结构与算法面试题精讲)C++版——day6
剑指Offer(数据结构与算法面试题精讲)C版——day6 题目一:不含重复字符的最长子字符串题目二:包含所有字符的最短字符串题目三:有效的回文 题目一:不含重复字符的最长子字符串 这里还是可以使用前面&#x…...
人工智能起源:从图灵到ChatGPT
如今作诗AI的祖先是打卡机、缓慢行动的机器人和神一般的游戏引擎。 “第一台能产生自己想法”的机器问世近70年后,人类的大脑仍然没有真正的对手 1958年冬天,30岁的心理学家弗兰克 罗森布拉特(Frank Rosenblatt)正从康奈尔大学前…...
vue2打包部署到nginx,解决路由history模式下页面空白问题
项目使用的是vue2,脚手架vue-cli 4。 需求:之前项目路由使用的是hash,现在要求调整为history模式,但是整个过程非常坎坷,遇到了页面空白问题。现在就具体讲一下这个问题。 首先,直接讲路由模式由hash改为…...
ASM磁盘组替换
1.udev绑定新磁盘 udevadm control --reload-rules udevadm trigger [rootrac1 ~]# ll /dev/asm* brw-rw---- 1 grid asmadmin 8, 64 Apr 4 13:55 /dev/asm-arc brw-rw---- 1 grid asmadmin 8, 48 Apr 4 14:04 /dev/asm-data brw-rw---- 1 grid asmadmin 8, 80 Apr 4 14:03…...
ZooKeeper集群部署(容器)
文章目录 一、ZooKeeper基本概念二、ZooKeeper集群部署1、前置环境准备2、ZooKeeper伪集群部署(可选)3、ZooKeeper集群部署(可选) 三、ZooKeeper集群验证1、查看集群角色2、数据同步测试3、选举leader测试 一、ZooKeeper基本概念 ZooKeeper是一个分布式且开源的分布式应用程序…...
Scala语言基础:开启你的 Flink 之旅
引言:为什么选择Scala? 大家好,我是心海! Scala(Scalable Language)是一门融合面向对象与函数式编程的现代语言。它像瑞士军刀一样灵活——既能编写简洁的脚本,又能构建复杂的分布式系统。想象你…...
C++计算机视觉实战:100个实际案例分析
【2025最新版】C计算机视觉100个案例算法汇总(长期更新版) 本文是基于C的项目实战,需要具备一点C基础与深度学习基础,并且对opencv、open3d、tensorrt、onnxruntime有一定了解。 你们的订阅是我更新的动力,请订阅、点赞、收藏。 1.Yolov5实…...
V-SHOW和箭头函数在VUE项目的踩坑点
v-show和v-if v-show控制显示隐藏是通过控制CSS的display决定dom节点的显示和隐藏。v-if通过控制dom节点的渲染与否实现元素的显示和隐藏。 在vue中,template标签不参与页面渲染,也不会破坏代码的层级结构,所以多和v-if结合控制元素的显示隐…...
vscode使用方式
一、常用快捷键与代码操作 注释与代码排版 行注释:Ctrl /;块注释:Shift Alt A。 代码缩进:选中代码段后按 Tab(右移)或 Shift Tab(左移)。 代码导航与编辑 快速跳转文件&…...
使用OpenSceneGraph生成3D数据格式文件
OpenSceneGraph (OSG) 提供了多种方式来生成和导出3D数据格式文件。以下是详细的生成方法和示例代码: 一、基本文件生成方法 1. 使用osgDB::writeNodeFile函数 这是最直接的生成方式,支持多种格式: #include <osgDB/WriteFile>osg:…...
网络安全应急响应-系统排查
在网络安全应急响应中,系统排查是快速识别潜在威胁的关键步骤。以下是针对Windows和Linux系统的系统基本信息排查指南,涵盖常用命令及注意事项: 一、Windows系统排查 1. 系统信息工具(msinfo32.exe) 命令执行&#x…...
如何判断JVM中类和其他类是不是同一个类
如何判断JVM中的类是否为同一个类 在Java虚拟机(JVM)中,判断两个类是否相同需要同时满足以下三个条件: 1. 类全限定名必须相同 包括包名类名的完整路径必须完全一致例如:java.lang.String和com.example.String被视为不同类 2. 加载该类的…...
Prolog语言的共识算法
Prolog语言的共识算法 引言 在分布式计算和区块链技术的背景下,共识算法作为确保节点一致性的重要机制,受到了广泛关注。传统的共识算法如PBFT( Practical Byzantine Fault Tolerance )等在许多系统中得到了应用,但随…...
AIDD-深度学习 MetDeeCINE 破译代谢调控机制
深度学习 MetDeeCINE 破译代谢调控机制 目录 使用 FEP/REMD 和 DFT 方法准确预测药物多靶点绝对结合自由能的新途径。Scorpio 框架利用对比学习优化核苷酸序列表示,提升基因组分析效率,尤其在未知序列的分类和泛化能力上表现出色。LPM 模型整合多模态扰…...
pyTorch框架-迁移学习-实现四种天气图片多分类问题
目录 1.导包 2.加载原数据、创建训练与测试目录路径 3.用transforms.Compose、torchvision.datasets.ImageFolder数据预处理 4.加载预训练好的模型 5.固定与修改预训练模型的参数 6.将模型拷到GPU上 7.定义优化器与损失函数 8.定义训练过程 9.测试运行 10.测试结果…...
python1(基础语法输入输出)
输入输出: 输出 print(*objects, sep , end\n, filesys.stdout, flushFalse) objects:这是一个可变参数,意味着你可以传入任意数量的对象。print 函数会将这些对象依次打印出来。在函数内部,这些对象会被转换为字符串形式。 se…...
Linux:页表详解(虚拟地址到物理地址转换过程)
文章目录 前言一、分页式存储管理1.1 虚拟地址和页表的由来1.2 物理内存管理与页表的数据结构 二、 多级页表2.1 页表项2.2 多级页表的组成 总结 前言 在我们之前的学习中,我们对于页表的认识仅限于虚拟地址到物理地址转换的桥梁,然而对于具体的转换实现…...
OpenStack Yoga版安装笔记(十七)安全组笔记
一、安全组与iptables的关系 OpenStack的安全组(Security Group)默认是通过Linux的iptables实现的。以下是其主要实现原理和机制: 安全组与iptables的关系 OpenStack的安全组规则通过iptables的规则链实现。每条安全组规则会被转换为相应的i…...
开源身份和访问管理方案之keycloak(三)keycloak健康检查(k8s)
文章目录 开源身份和访问管理方案之keycloak(三)keycloak健康检查启用运行状况检查 健康检查使用Kubernetes下健康检查Dockerfile 中 HEALTHCHECK 指令 健康检查Docker HEALTHCHECK 和 Kubernetes 探针 开源身份和访问管理方案之keycloak(三&…...
棋盘问题(DFS)
在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。 要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放 kk 个棋子的所有可行的摆放方案数目 C…...
verilog学习--1、语言要素
先看一个例子 /*This is first Verilog progaram*/ timescale 1ns/1ns module HalfAdder(A,B,Sum,Carry);input A,B;output Sum, Carry; /**/assign #2 SumA^B;assign #5 CarryA&B; endmodule; Verilog以module为单位编写,每个文件一个module&#…...
from fastmcp import FastMCP和from mcp.server.fastmcp import FastMCP的区别是什么?
文章目录 困惑以方式一开启一个mcp server,并用cline进行调用mcp install server.py修改配置文件以方式二开启MCP server困惑 一直比较困惑的是,好像用python实现mcp server有两种实现方式。 一是使用: https://github.com/modelcontextprotocol/python-sdk 二是使用: …...
QT工程建立
打开软件新建一个工程 选择chose 工程命名,选择保存路径,可以自己选择,但是不要有中文路径 默认的直接下一步 任意选一个下一步 点击完成 之后是这个界面,点击右下角的绿色三角形编译一下 实验内容 添加类 第一个是建立cpp和.h文件…...
Day82 | 灵神 | 快慢指针 重排链表
Day82 | 灵神 | 快慢指针 重排链表 143.重排链表 143. 重排链表 - 力扣(LeetCode) 思路: 笔者直接给跪了,这个难度真是mid吗 直接去看灵神的视频 环形链表II【基础算法精讲 07】_哔哩哔哩_bilibili 1.简单来说就是…...
TCN-LSTM时间卷积长短期记忆神经网络多变量时间序列预测(Matlab完整源码和数据)
目录 效果一览基本介绍程序设计参考资料 效果一览 基本介绍 1.TCN-LSTM时间卷积长短期记忆神经网络多变量时间序列预测(Matlab完整源码和数据) 2.运行环境为Matlab2023b; 3.data为数据集,输入多个特征,输出单个变量&a…...
语法: lcd_load( buffer_pointer, offset, length);
LCD_LOAD() 语法: lcd_load( buffer_pointer, offset, length); 参数: buffer_pointer指向发送给LCD的用户数据; offset是用来将该数据写入LCD,用作进入LCD segment memory的偏移量; length是传送的字节数. 要求: 没有. 功能: 该函数将从CPU的buffer_pointer存储区…...
分治(8题)
目录 一、快排 1.颜色分类 2.排序数组 3.数组中的第k个最大元素 4.最小的K个数 二、归并 1. 排序数组 2.数组中的逆序对 3.计算右侧小于当前元素的个数 4.翻转对 一、快排 1.颜色分类 75. 颜色分类 - 力扣(LeetCode) left和right,初…...
【9】数据结构的串篇章
目录标题 串的定义顺序串的实现初始化赋值打印串求串的长度复制串判断两个串长度是否相等连接两个串比较两个串内容是否相等插入操作删除操作调试与代码合集 串的模式匹配算法朴素的模式匹配算法KMP算法实现模式匹配 串的定义 定义:由0个或多个字符组成的有限序列&…...
Linux file命令
目录 一. file命令简介二. -b 输出结果不显示文件名三. --mime 输出文件的MIME类型字符串四. 批量确认文件类型4.1 -f 从指定的文件中读取文件路径,显示其文件类型4.2 配合find命令查找确认 一. file命令简介 由于Linux系统并不是像Windows系统那样通过扩展名来定义…...
ARM-UART
时钟选择PLCK,超时3ms自动发送,设置发送8位的缓冲区,且发送中断 设置触发深度,达到8字节将缓冲区数据发憷 中断处理函数...
AFT3 Engine传奇世界AFT3代引擎源码
此AFT3代引擎源码,不是老AFT0330版本,应该是WeiAFT的源码 本源码为新AFT3引擎源码,直接电脑打包出来, 现在市面上使用的AFT3引擎都是用的此款,下载编译即用 链接: https://pan.baidu.com/s/1Zxa64AQ7MUsdV2iIrqiTEg 提…...
[ 3分钟算法 ] | 递归搜索题目 : 翻转链表(递归版)
目录 1. 题目链接: 2. 思路分析: 思路一:从宏观上看 思路二:将链表看成一颗树 3. 代码 1. 题目链接: LCR 024. 反转链表 2. 思路分析: 思路一:从宏观上看 让当前节点后面的链表先逆置&…...
左值与右值,空间与数据
左值是空间,右值是数据 编程总是对“数据”,对"存放数据的空间"操作 a返回一个当前的数据,存放到一个临时空间中,自身的空间中的数据再进行运算 a直接对自身空间中的数据进行运算 其余知识: 1.变量名的意…...
线程池/内存池/mysql连接池
线程池介绍 ①线程池定义: 维持和管理固定数量线程的结构,用于解决资源频繁创建和销毁的问题。 ②线程池组成: 固定数量的线程、队列、任务状态管理。 ④线程池的作用: 避免频繁创建和销毁线程,管理线程状态&…...
图解AUTOSAR_SWS_FlexRayARTransportLayer
FlexRay AUTOSAR 传输层 (FrArTp) 分析 1. AUTOSAR FlexRay 传输层架构 1.1 FlexRay AUTOSAR 传输层在AUTOSAR架构中的位置 AUTOSAR分层架构中,FlexRay AUTOSAR 传输层(FrArTp)位于通信抽象层,其上方是PDU路由器,下方是FlexRay接口。FrArTp的主要功能是实现FlexRay网络上的…...
【百日精通JAVA | SQL篇 | 第四篇】约束
SQL这一块没什么难度,主要是一个熟练度,稍微上点难度的地方,其实在于查,比较复杂,涉及到很多问题。 指定列插入 使用指定列插入的时候,未被指定的列使用默认值进行存储,默认值为空。 默认值设置…...
QEMU源码全解析 —— 块设备虚拟化(16)
接前一篇文章:QEMU源码全解析 —— 块设备虚拟化(15) 本文内容参考: 《趣谈Linux操作系统》 —— 刘超,极客时间 《QEMU/KVM源码解析与应用》 —— 李强,机械工业出版社 《KVM实战 —— 原理、进阶与性能调优》—— 任永杰 程舟,机械工业出版社...
实验:IS-IS认证。
一、IS-IS认证的定义与作用分析 IS-IS认证是什么? IS-IS(Intermediate System to Intermediate System)协议是用于自治系统内部的路由协议,其认证机制主要用于保障路由信息交换的安全性,包括邻居关系建立和…...
11-产品经理-创建产品
在“产品”-“仪表盘”内,可以查看系统中关于产品及相关需求的统计。 在“产品”-“产品列表”页面,可以按项目集、项目查看其关联产品。还可以添加产品、编辑产品线、或者导出产品列表。 产品看板,通过看板方式查看产品、产品计划和产品下的…...
玄机-应急响应-入侵排查
靶机排查目标: 1.web目录存在木马,请找到木马的密码提交 查看/var/www/html。 使用find命令查找 find ./ -type f -name "*.php | xargs grep "eval("查看到1.php里面存在无条件一句话木马。 2.服务器疑似存在不死马,请找…...
MySQL基础知识(通俗版)
MySQL基础知识(通俗版) 一、MySQL基础概念 1.1 MySQL简介 想象MySQL就像一个超级大的Excel表格,但它比Excel更强大: 可以同时处理成千上万的数据可以保证数据的安全性和一致性可以支持多人同时操作可以自动备份和恢复数据 1.…...
python逆向:喜马拉雅登录案例
网址:登录 1. 点击到网页主页 先随便输入电话号码和密码 打开开发者工具,点击网络清空,然后点击登录发起网络请求 (出现一个请求包,我们发现不是我们所需要的) 我们进行验证滑块,就又出来请求…...
windows AndroidStudio上传maven中央仓库
一、插件地址:https://github.com/vanniktech/gradle-maven-publish-plugin?tabreadme-ov-file 二、Maven中心:https://vanniktech.github.io/gradle-maven-publish-plugin/central/ 2.1、中央门户帐户,用github账号登陆:gh122…...
嵌入式学习(35)-STM32F103 TXE 和TC
在USART的发送端有2个寄存器,一个是程序可以看到的USART_DR寄存器,另一个是程序看不到的移位寄存器,对应USART数据发送有两个标志,一个是TXE发送数据寄存器空,另一个是TC发送结束。 当USART_DR中的数据传送到移位寄存器后,TXE被设…...
linux Gitkraken 破解
ubuntu 安装 Gitkraken 9.x Pro 版本_gitcracken.git-CSDN博客...
Qwen-Agent框架的文件相关操作:从Assistant到BasicDocQA
在前面的几篇文章如《针对Qwen-Agent框架的Function Call及ReAct的源码阅读与解析:Agent基类篇》 、《基于Qwen-Agent框架的Function Call及ReAct方式调用自定义工具》、 《针对Qwen-Agent框架的源码阅读与解析:FnCallAgent与ReActChat篇》中,…...
2025年3月15日(5mw)
根据《NREL/TP-500-38060技术报告》,NREL 5-MW参考风力机的各部件质量及总体质量数据如下: 各部件质量数据 叶片(Blades) 单叶片质量:17,740 kg(见表2-2)总数:3片总质量:…...
docker mysql 笔记250406
docker mysql 笔记250406 以下是使用 Docker 运行 MySQL 的完整指南,包含常见配置和最佳实践: 1. 快速启动 MySQL 容器 docker run -d \--name mysql_db \-e MYSQL_ROOT_PASSWORDmy-secret-pw \-p 3306:3306 \mysql:8.02. 关键配置说明 2.1 环境变量&…...
ceph集群架构阐述
ceph集群架构阐述 首先,ceph集群也是分为客户端和服务端的,是一种高效的分布式存储系统,我们将其拆分为这两个部分来进行分析。 我大致的将服务端分为API类型、逻辑层、OSD层三个层面进行分析;将客户端按三种API类型挂载、…...