当前位置: 首页 > news >正文

11 月 25 日 ROS 学习笔记——3D 建模与仿真

文章目录

  • 前言
  • 一、在 ROS 中自定义机器人的3D模型
    • 1. 在 rviz 里查看3D模型
    • 2. xacro
  • 二、Gazebo
    • 1. urdf 集成 gazebo
    • 2. 综合应用
      • 1). 运动控制及里程计
      • 2). 雷达仿真
      • 3). 摄像头信息仿真
      • 4). kinect 深度相机仿真
      • 5). 点云


前言

本文为11 月 25 日 ROS 学习笔记——3D 建模与仿真,分为两个章节:

  • 在 ROS 中自定义机器人的3D模型,
  • Gazebo

一、在 ROS 中自定义机器人的3D模型

<robot name="Robot1"><link name="base_link"><visual><geometry><box size="0.2 .3 .1" /></geometry><origin rpy="0 0 0" xyz="0 0 0.05" /><material name="white"><color rgba="1 1 1 1" /></material></visual></link><link name="wheel_1"><visual><geometry><cylinder length="0.05" radius="0.05" /></geometry><origin rpy="0 1.5 0" xyz="0.1 0.1 0" /><material name="black"><color rgba="0 0 0 1" /></material></visual></link><link name="wheel_2"><visual><geometry><cylinder length="0.05" radius="0.05" /></geometry><origin rpy="0 1.5 0" xyz="-0.1 0.1 0" /><material name="black" /></visual></link><link name="wheel_3"><visual><geometry><cylinder length="0.05" radius="0.05" /></geometry><origin rpy="0 1.5 0" xyz="0.1 -0.1 0" /><material name="black" /></visual></link><link name="wheel_4"><visual><geometry><cylinder length="0.05" radius="0.05" /></geometry><origin rpy="0 1.5 0" xyz="-0.1 -0.1 0" /><material name="black" /></visual></link><joint name="base_to_wheel1" type="fixed"><parent link="base_link" /><child link="wheel_1" /><origin xyz="0 0 0" /></joint><joint name="base_to_wheel2" type="fixed"><parent link="base_link" /><child link="wheel_2" /><origin xyz="0 0 0" /></joint><joint name="base_to_wheel3" type="fixed"><parent link="base_link" /><child link="wheel_3" /><origin xyz="0 0 0" /></joint><joint name="base_to_wheel4" type="fixed"><parent link="base_link" /><child link="wheel_4" /><origin xyz="0 0 0" /></joint>
</robot>
  • 检查书写的语法是否正确和配置是否有误
check_urdf robot1.urdf 
>>> robot name is: Robot1---------- Successfully Parsed XML ---------------root Link: base_link has 4 child(ren)child(1):  wheel_1child(2):  wheel_2child(3):  wheel_3child(4):  wheel_4
  • 以图形的方式来查看
urdf_to_graphiz robot1.urdf 
>>> Created file Robot1.gvCreated file Robot1.pdfevince Robot1.pdf

在这里插入图片描述

1. 在 rviz 里查看3D模型

  • 创建 .launch 文件
<launch><arg name="model" /><arg name="gui" default="False" /><param name="robot_description" textfile="$(arg model)" /><param name="use_gui" value="$(arg gui)" /><node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" /><node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />
</launch>
  • 启动命令
roslaunch robot1_description display.launch model:="$(rospack find robot1_description)/urdf/robot1.urdf"

请添加图片描述

  • 添加一些组件
</joint><link name="arm_base">
<visual>
<geometry>
<box size="0.1 .1 .1"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0.1"/>
<material name="white">
<color rgba="1 1 1 1"/>
</material>
</visual><collision>
<geometry>
<box size="0.1 .1 .1"/>
</geometry>
</collision><inertial>
<mass value="1"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link><joint name="base_to_arm_base" type="continuous">
<parent link="base_link"/>
<child link="arm_base"/>
<axis xyz="0 0 1"/>
<origin xyz="0 0 0"/>
</joint><link name="arm_1">
<visual>
<geometry>
<box size="0.05 .05 0.5"/>
</geometry>
<origin rpy="0 0 0" xyz="0 0 0.25"/>
<material name="white">
<color rgba="1 1 1 1"/>
</material>
</visual>
<collision>
<geometry>
<box size="0.05 .05 0.5"/>
</geometry>
</collision>
<inertial>
<mass value="1"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link><joint name="arm_1_to_arm_base" type="revolute">
<parent link="arm_base"/>
<child link="arm_1"/>
<axis xyz="1 0 0"/>
<origin xyz="0 0 0.15"/>
<limit effort ="1000.0" lower="-1.0" upper="1.0" velocity="0.5"/>
</joint>
<link name="arm_2">
<visual>
<geometry>
<box size="0.05 0.05 0.5"/>
</geometry>
<origin rpy="0 0 0" xyz="0.06 0 0.15"/>
<material name="white">
<color rgba="1 1 1 1"/>
</material>
</visual>
<collision>
<geometry>
<box size="0.05 .05 0.5"/>
</geometry>
</collision>
<inertial>
<mass value="1"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link>
<joint name="arm_2_to_arm_1" type="revolute">
<parent link="arm_1"/>
<child link="arm_2"/>
<axis xyz="1 0 0"/>
<origin xyz="0.0 0 0.45"/>
<limit effort ="1000.0" lower="-2.5" upper="2.5" velocity="0.5"/>
</joint>
<joint name="left_gripper_joint" type="revolute">
<axis xyz="0 0 1"/>
<limit effort="1000.0" lower="0.0" upper="0.548" velocity="0.5"/>
<origin rpy="0 -1.57 0" xyz="0.06 0 0.4"/>
<parent link="arm_2"/>
<child link="left_gripper"/>
</joint>
<link name="left_gripper">
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<mesh filename="package://pr2_description/meshes/gripper_v0/l_finger.dae"/>
</geometry>
</visual>
<collision>
<geometry>
<box size="0.1 .1 .1"/>
</geometry>
</collision>
<inertial>
<mass value="1"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link>
<joint name="left_tip_joint" type="fixed">
<parent link="left_gripper"/>
<child link="left_tip"/>
</joint>
<link name="left_tip">
<visual>
<origin rpy="0.0 0 0" xyz="0.09137 0.00495 0"/>
<geometry>
<mesh filename="package://pr2_description/meshes/gripper_v0/l_finger_tip.dae"/>
</geometry>
</visual>
<collision>
<geometry>
<box size="0.1 .1 .1"/>
</geometry>
</collision>
<inertial>
<mass value="1"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link>
<joint name="right_gripper_joint" type="revolute">
<axis xyz="0 0 -1"/>
<limit effort="1000.0" lower="0.0" upper="0.548" velocity="0.5"/>
<origin rpy="0 -1.57 0" xyz="0.06 0 0.4"/>
<parent link="arm_2"/>
<child link="right_gripper"/>
</joint>
<link name="right_gripper">
<visual>
<origin rpy="-3.1415 0 0" xyz="0 0 0"/>
<geometry>
<mesh filename="package://pr2_description/meshes/gripper_v0/l_finger.dae"/>
</geometry>
</visual>
<collision>
<geometry>
<box size="0.1 .1 .1"/>
</geometry>
</collision>
<inertial>
<mass value="1"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link>
<joint name="right_tip_joint" type="fixed">
<parent link="right_gripper"/>
<child link="right_tip"/>
</joint>
<link name="right_tip">
<visual>
<origin rpy="-3.1415 0 0" xyz="0.09137 0.00495 0"/>
<geometry>
<mesh filename="package://pr2_description/meshes/gripper_v0/l_finger_tip.dae"/>
</geometry>
</visual>
<collision>
<geometry>
<box size="0.1 .1 .1"/>
</geometry>
</collision>
<inertial>
<mass value="1"/>
<inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1.0" iyz="0.0" izz="1.0"/>
</inertial>
</link>

请添加图片描述

  • 旋转关节
<joint name="arm_1_to_arm_base" type="revolute"><parent link="arm_base"/><child link="arm_1"/><axis xyz="1 0 0"/><origin xyz="0 0 0.15"/><limit effort ="1000.0" lower="-1.0" upper="1.0" velocity="0.5"/>
</joint>

2. xacro

Xacro 可帮助我们压缩 URDF 文件的大小, 增加文件的可读性和可维护性。它还允许我们创建模型并复用这些模型以创建相同的结构,如更多的手臂和腿.

  • 使用 xacro 声明常量,避免在很多行重复定义同一个 数值
<xacro:property name="length_wheel" value="0.05" />
<xacro:property name="radius_wheel" value="0.05" />
  • 使用常量
${name_of_variable}:
<cylinder length="${length_wheel}" radius="${radius_wheel}" />
  • 将 .xacro 转换为 .urdf
rosrun xacro xacro demo01_helloworld.urdf.xacro
>>> <robot name="mycar"><link name="left_wheel"><visual><geometry><cylinder length="0.0015" radius="0.0325"/></geometry><origin rpy="1.57079635 0 0" xyz="0 0 0"/><material name="wheel_color"><color rgba="0 0 0 0.3"/></material></visual></link><!-- 3-2.joint --><joint name="left2link" type="continuous"><parent link="base_link"/><child link="left_wheel"/><!-- x 无偏移y 车体半径z z= 车体高度 / 2 + 离地间距 - 车轮半径--><origin rpy="0 0 0" xyz="0 0.1 -0.0225"/><axis xyz="0 1 0"/></joint><link name="right_wheel"><visual><geometry><cylinder length="0.0015" radius="0.0325"/></geometry><origin rpy="1.57079635 0 0" xyz="0 0 0"/><material name="wheel_color"><color rgba="0 0 0 0.3"/></material></visual></link><!-- 3-2.joint --><joint name="right2link" type="continuous"><parent link="base_link"/><child link="right_wheel"/><!-- x 无偏移y 车体半径z z= 车体高度 / 2 + 离地间距 - 车轮半径--><origin rpy="0 0 0" xyz="0 -0.1 -0.0225"/><axis xyz="0 1 0"/></joint></robot>
rosrun xacro xacro demo01_helloworld.urdf.xacro > demo01_helloworld.urdf
  • 属性与运算
<xacro:property name="PI" value="3.1415927" />
<xacro:property name="radius" value="0.03" /><!-- 属性调用 -->
<myUsePropertyxxx name="${PI}" />
<myUsePropertyxxx name="${radius}" />rosrun xacro xacro demo02_field.urdf.xacro
>>> <robot name="mycar"><!-- 属性调用 --><myUsePropertyxxx name="3.1415927"/><myUsePropertyxxx name="0.03"/><!-- 数学运算 --></robot><!-- 数学运算 -->
<myUsePropertyyy result="${PI / 2}" />rosrun xacro xacro demo02_field.urdf.xacro
>>> <robot name="mycar"><!-- 属性调用 --><myUsePropertyxxx name="3.1415927"/><myUsePropertyxxx name="0.03"/><!-- 数学运算 --><myUsePropertyyy result="1.57079635"/></robot>
<!-- 宏定义 -->
<xacro:macro name="getSum" params="num1 num2"><result value="${num1 + num2}" />
</xacro:macro><!-- 宏调用 -->
<xacro:getSum num1="1" num2="5" />>>> rosrun xacro xacro demo03_macro.urdf.xacro
<robot name="mycar"><result value="6"/>
</robot>
  • 文件包含
<xacro:include filename="demo02_field.urdf.xacro" />
<xacro:include filename="demo03_macro.urdf.xacro" />rosrun xacro xacro demo04_sum.urdf.xacro
>>> <robot name="mycar"><!-- 属性调用 --><myUsePropertyxxx name="3.1415927"/><myUsePropertyxxx name="0.03"/><!-- 数学运算 --><myUsePropertyyy result="1.57079635"/><result value="6"/></robot>
  • xacro 集成 rviz
<param name="robot_description" command="$(find xacro)/xacro $(find urdf01_rviz)/urdf/xacro/demo05_car_base.urdf.xacro" />
  • 控制移动机器人做圆周运动
<launch><!-- 载入 urdf 至参数服务器 --><!-- <param name="robot_description" textfile="$(find urdf01_rviz)/urdf/xacro/demo05_car_base.urdf" /> --><param name="robot_description" command="$(find xacro)/xacro $(find urdf01_rviz)/urdf/xacro/car.urdf.xacro" /><!-- 启动 rviz --><node pkg="rviz" type="rviz" name="rviz" args="-d $(find urdf01_rviz)/config/show_mycar.rviz" /><!-- 添加关节状态发布节点 --><node pkg="joint_state_publisher" type="joint_state_publisher" name="joint_state_publisher" /><!-- 机器人状态发布节点 --><node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" /><!-- 集成 arbotix 运动控制节点 --><node pkg="arbotix_python" type="arbotix_driver" name="driver" output="screen"><rosparam command="load" file="$(find urdf01_rviz)/config/control.yaml" /><param name="sim" value="true" /></node>
</launch>
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist "linear:x: 1.0y: 0.0z: 0.0
angular:x: 0.0y: 0.0z: 1.0"

请添加图片描述


二、Gazebo

1. urdf 集成 gazebo

  • 创建机器人模型
<robot name="mycar"><link name="base_link"><visual><geometry><box size="0.5 0.2 0.1" /></geometry><origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" /><material name="yellow"><color rgba="0.5 0.3 0.0 1" /></material></visual><collision><geometry><box size="0.5 0.2 0.1" /></geometry><origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" /></collision><inertial><origin xyz="0 0 0" /><mass value="6" /><inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1" /></inertial></link><gazebo reference="base_link"><material>Gazebo/Red</material></gazebo></robot>
  • 创建 .launch 文件
<launch><!-- 载入 urdf 至参数服务器 --><param name="robot_description" textfile="$(find urdf02_gazebo)/urdf/demo01_helloworld.urdf" /><!-- 启动 Gazebo --><include file="$(find gazebo_ros)/launch/empty_world.launch" /><!-- 添加机器人模型 --><node pkg="gazebo_ros" type="spawn_model" name="spawn_model" args="-urdf -model mycar -param robot_description" />
</launch>

请添加图片描述

  • 仿真环境集成
<launch><!-- 载入 urdf 至参数服务器 --><param name="robot_description" command="$(find xacro)/xacro $(find urdf02_gazebo)/urdf/car.urdf.xacro" /><!-- 启动 Gazebo --><include file="$(find gazebo_ros)/launch/empty_world.launch"><arg name="world_name" value="${find urdf02_gazebo}/worlds/box_house.world" /></include><!-- 添加机器人模型 --><node pkg="gazebo_ros" type="spawn_model" name="spawn_model" args="-urdf -model mycar -param robot_description" />
</launch>

请添加图片描述

2. 综合应用

1). 运动控制及里程计

  • 在 gazebo 中运动控制
<robot name="my_car_move" xmlns:xacro="http://wiki.ros.org/xacro"><!-- 传动实现:用于连接控制器与关节 --><xacro:macro name="joint_trans" params="joint_name"><!-- Transmission is important to link the joints and the controller --><transmission name="${joint_name}_trans"><type>transmission_interface/SimpleTransmission</type><joint name="${joint_name}"><hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface></joint><actuator name="${joint_name}_motor"><hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface><mechanicalReduction>1</mechanicalReduction></actuator></transmission></xacro:macro><!-- 每一个驱动轮都需要配置传动装置 --><xacro:joint_trans joint_name="base_l_wheel_joint" /><xacro:joint_trans joint_name="base_r_wheel_joint" /><!-- 控制器 --><gazebo><plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so"><rosDebugLevel>Debug</rosDebugLevel><publishWheelTF>true</publishWheelTF><robotNamespace>/</robotNamespace><publishTf>1</publishTf><publishWheelJointState>true</publishWheelJointState><alwaysOn>true</alwaysOn><updateRate>100.0</updateRate><legacyMode>true</legacyMode><leftJoint>base_l_wheel_joint</leftJoint> <!-- 左轮 --><rightJoint>base_r_wheel_joint</rightJoint> <!-- 右轮 --><wheelSeparation>${base_radius * 2}</wheelSeparation> <!-- 车轮间距 --><wheelDiameter>${wheel_radius * 2}</wheelDiameter> <!-- 车轮直径 --><broadcastTF>1</broadcastTF><wheelTorque>30</wheelTorque><wheelAcceleration>1.8</wheelAcceleration><commandTopic>cmd_vel</commandTopic> <!-- 运动控制话题 --><odometryFrame>odom</odometryFrame> <odometryTopic>odom</odometryTopic> <!-- 里程计话题 --><robotBaseFrame>base_footprint</robotBaseFrame> <!-- 根坐标系 --></plugin></gazebo></robot>
rostopic pub -r 10 /cmd_vel geometry_msgs/Twist "linear:x: 1.0y: 0.0z: 0.0
angular:x: 0.0y: 0.0z: 1.0"

请添加图片描述

  • 在 rviz 中查看里程计消息
<launch><!-- 启动 rviz --><node pkg="rviz" type="rviz" name="rviz" args="-d $(find urdf01_rviz)/config/show_mycar.rviz" /><!-- 添加关节状态发布节点 --><!-- <node pkg="joint_state_publisher" type="joint_state_publisher" name="joint_state_publisher" /> --><!-- 机器人状态发布节点 --><node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" /></launch>

请添加图片描述

2). 雷达仿真

<robot name="my_sensors" xmlns:xacro="http://wiki.ros.org/xacro"><!-- 雷达 --><gazebo reference="laser"><sensor type="ray" name="rplidar"><pose>0 0 0 0 0 0</pose><visualize>true</visualize><update_rate>5.5</update_rate><ray><scan><horizontal><samples>360</samples><resolution>1</resolution><min_angle>-3</min_angle><max_angle>3</max_angle></horizontal></scan><range><min>0.10</min><max>30.0</max><resolution>0.01</resolution></range><noise><type>gaussian</type><mean>0.0</mean><stddev>0.01</stddev></noise></ray><plugin name="gazebo_rplidar" filename="libgazebo_ros_laser.so"><topicName>/scan</topicName><frameName>laser</frameName></plugin></sensor></gazebo></robot>

请添加图片描述

3). 摄像头信息仿真

<robot name="my_sensors" xmlns:xacro="http://wiki.ros.org/xacro"><!-- 被引用的link --><gazebo reference="camera"><!-- 类型设置为 camara --><sensor type="camera" name="camera_node"><update_rate>30.0</update_rate> <!-- 更新频率 --><!-- 摄像头基本信息设置 --><camera name="head"><horizontal_fov>1.3962634</horizontal_fov><image><width>1280</width><height>720</height><format>R8G8B8</format></image><clip><near>0.02</near><far>300</far></clip><noise><type>gaussian</type><mean>0.0</mean><stddev>0.007</stddev></noise></camera><!-- 核心插件 --><plugin name="gazebo_camera" filename="libgazebo_ros_camera.so"><alwaysOn>true</alwaysOn><updateRate>0.0</updateRate><cameraName>/camera</cameraName><imageTopicName>image_raw</imageTopicName><cameraInfoTopicName>camera_info</cameraInfoTopicName><frameName>camera</frameName><hackBaseline>0.07</hackBaseline><distortionK1>0.0</distortionK1><distortionK2>0.0</distortionK2><distortionK3>0.0</distortionK3><distortionT1>0.0</distortionT1><distortionT2>0.0</distortionT2></plugin></sensor></gazebo></robot>

请添加图片描述

4). kinect 深度相机仿真

<robot name="my_sensors" xmlns:xacro="http://wiki.ros.org/xacro"><gazebo reference="support">  <sensor type="depth" name="camera"><always_on>true</always_on><update_rate>20.0</update_rate><camera><horizontal_fov>${60.0*PI/180.0}</horizontal_fov><image><format>R8G8B8</format><width>640</width><height>480</height></image><clip><near>0.05</near><far>8.0</far></clip></camera><plugin name="kinect_camera_controller" filename="libgazebo_ros_openni_kinect.so"><cameraName>camera</cameraName><alwaysOn>true</alwaysOn><updateRate>10</updateRate><imageTopicName>rgb/image_raw</imageTopicName><depthImageTopicName>depth/image_raw</depthImageTopicName><pointCloudTopicName>depth/points</pointCloudTopicName><cameraInfoTopicName>rgb/camera_info</cameraInfoTopicName><depthImageCameraInfoTopicName>depth/camera_info</depthImageCameraInfoTopicName><frameName>support</frameName><baseline>0.1</baseline><distortion_k1>0.0</distortion_k1><distortion_k2>0.0</distortion_k2><distortion_k3>0.0</distortion_k3><distortion_t1>0.0</distortion_t1><distortion_t2>0.0</distortion_t2><pointCloudCutoff>0.4</pointCloudCutoff></plugin></sensor></gazebo></robot>

请添加图片描述

5). 点云

  • 修改配置文件的 FrameName 标签并添加坐标变换关系
<frameName>support_depth</frameName><!-- 点云坐标系到 kinect 连杆坐标系的变换 -->
<node pkg="tf2_ros" name="static_transform_publisher" type="static_transform_publisher" args="0 0 0 -1.57 0 -1.57 /support /support_depth" />

请添加图片描述


相关文章:

11 月 25 日 ROS 学习笔记——3D 建模与仿真

文章目录 前言一、在 ROS 中自定义机器人的3D模型1. 在 rviz 里查看3D模型2. xacro 二、Gazebo1. urdf 集成 gazebo2. 综合应用1). 运动控制及里程计2). 雷达仿真3). 摄像头信息仿真4). kinect 深度相机仿真5). 点云 前言 本文为11 月 25 日 ROS 学习笔记——3D 建模与仿真&am…...

MidJourney笔记(3)-Prompts

MidJourney的Prompts介绍 MidJourney的Prompts是MidJourney的核心之一,这也是我们后续使用MidJourney过程中最重要的工作内容,根据生成的图片,不断的优化我们的Prompts内容。 那Prompts的中文意思是提示的意思。 Prompts的提示语有很多,最基础的用法就是: /imagine prompt…...

贪心 D. Least Cost Bracket Sequence

Problem - D - Codeforces 题目大意&#xff1a;给一个只包含(&#xff0c;)&#xff0c;?三个字符的字符串。每个?可以转为(或者)&#xff0c;对于第 i i i个?转为(需要花费 a i a_i ai​&#xff0c;转为)需要花费 b i b_i bi​。现在问能否让该字符串转为合法的括号匹配…...

iOS APP包分析工具 | 京东云技术团队

介绍 分享一款用于分析iOSipa包的脚本工具&#xff0c;使用此工具可以自动扫描发现可修复的包体积问题&#xff0c;同时可以生成包体积数据用于查看。这块工具我们团队内部已经使用很长一段时间&#xff0c;希望可以帮助到更多的开发同学更加效率的优化包体积问题。 工具下载…...

在 VSCode 中使用 GDB 进行 C/C++ 程序调试(图文版)

(꒪ꇴ꒪ )&#xff0c;Hello我是祐言QAQ我的博客主页&#xff1a;C/C语言&#xff0c;数据结构&#xff0c;Linux基础&#xff0c;ARM开发板&#xff0c;网络编程等领域UP&#x1f30d;快上&#x1f698;&#xff0c;一起学习&#xff0c;让我们成为一个强大的攻城狮&#xff0…...

任意文件读取漏洞理解

任意文件读取漏洞理解 1. 漏洞描述&#xff1a; 任意文件读取漏洞是指攻击者可以利用漏洞读取系统上的任意文件&#xff0c;包括敏感信息的配置文件、用户数据甚至系统文件&#xff0c;从而获取未经授权的访问权限。 2. 漏洞原理&#xff1a; 这种漏洞通常是由程序处理用户输入…...

linux 安装yum

问题1&#xff1a;File "/usr/libexec/urlgrabber-ext-down", line 28 except OSError, e: ^ 问题2&#xff1a;yum File "/usr/bin/yum", line 30 except KeyboardInterrupt, e: ^ vim /usr/…...

数学启发式

学习资料&#xff1a; 优化求解器 | Gurobi 数学启发式算法&#xff1a;参数类型与案例实现 数学启发式算法 | 可行性泵 (Feasibility Pump)算法精讲&#xff1a;一份让您满意的【理论介绍编程实现数值实验】学习笔记(PythonGurobi实现) 大佬到底是大佬&#xff01;这些资料太…...

Win10/Win11 使用Wsl的Ubuntu 子系统搭建CGO环境,相当于Ubuntu下开发。GO环境CGO搭建,支持交叉编译

背景&#xff1a; 之前是使用Mac 开发&#xff0c;最近切换到win11下面。发现使用cgo编译有问题。 下面记载了我的使用方法。 环境&#xff1a; win11&#xff08;win10理论一样&#xff09; win11 安装了wsl2的环境&#xff0c;并且安装了ubuntu系统。 在win11 上面安装了g…...

CSS新特性(2-2)

CSS新特性&#xff08;2-2&#xff09; 前言box相关box-shadow background背景rgba颜色与透明度transform:rotate(Xdeg) 2D旋转transform:tranlate 平移 前言 本文继续讲解CSS3其他的新特性&#xff0c;想看之前新特性点击这里&#xff0c;那么好本文正式开始。 box相关 box…...

为什么,word文件在只读模式下,仍然能编辑?

Word文档设置了只读模式&#xff0c;是可以编辑的&#xff0c;但是当我们进行保存的时候就会发现&#xff0c;word提示需要重命名并选择新路径才能够保存。 这种操作&#xff0c;即使可以编辑文字&#xff0c;但是原文件是不会受到影响的&#xff0c;编辑之后的word文件会保存到…...

29 - 装饰器模式:如何优化电商系统中复杂的商品价格策略?

开始今天的学习之前&#xff0c;我想先请你思考一个问题。假设现在有这样一个需求&#xff0c;让你设计一个装修功能&#xff0c;用户可以动态选择不同的装修功能来装饰自己的房子。例如&#xff0c;水电装修、天花板以及粉刷墙等属于基本功能&#xff0c;而设计窗帘装饰窗户、…...

逆矩阵相关性质与例题

1.方阵的行列式&#xff1a;就是将方阵中的每一个元素转换至行列式中。 1.性质一&#xff1a;转置方阵的行列式等于转置前的行列式。&#xff08;对标性质&#xff1a;行列式与它的转置行列式相等&#xff09; 2.性质二&#xff1a;|ka||a|*k的n次方&#xff0c;n为方阵阶数。 …...

Ruoyi项目传List到后台并使用Excel模板下载数据的方法以及遇到的各种前后端数据交互问题

import { download } from @/utils/requestconst app = createApp(App)// 全局方法挂载 app.config.globalProperties.download = download 首先因为ruoyi-ui中的main.js有配置如上全局注册: 因此只需要在vue中定义一个方法直接使用this.download调用下载即可: (download的3…...

区块链技术将如何影响未来的数字营销?

你是否听腻了区块链和数字营销等流行语&#xff0c;却不明白它们对未来意味着什么&#xff1f;那么&#xff0c;准备好系好安全带吧&#xff0c;因为区块链技术将彻底改变我们对数字营销的看法。从建立消费者信任到提高透明度和效率&#xff0c;其可能性是无限的。 让我们来探…...

小程序wx:if和hidden的区别?

wx:if&#xff1a;wx:if 是一个完整的条件渲染指令&#xff0c;当它的表达式为真时&#xff0c;才会渲染该指令所在的元素。如果表达式的值为假&#xff0c;则不会渲染该元素。这意味着在表达式为假时&#xff0c;该元素及其子元素都不会被渲染&#xff0c;就像它们从未存在过一…...

分布式幂等

分布式幂等 在分布式系统、网络通信和数据库操作中&#xff0c;幂等性是一个非常重要的概念&#xff0c;特别是在面对可能发生网络故障、消息重复、或者系统崩溃等情况时。 举个简单的例子&#xff0c;考虑一个银行转账的操作。如果转账操作是幂等的&#xff0c;那么无论你执…...

大数据 DataX-Web 详细安装教程

目录 一、DataX-Web 介绍 1.1 DataX-Web 是什么 1.2 DataX-Web 架构 二、DataX-Web 安装部署 2.1 环境要求 2.2 安装 2.3 部署 2.4 数据库初始化 2.5 配置 2.6 启动服务 2.6.1 一键启动所有服务 2.6.2 一键取消所有服务 2.7 查看服务&#xff08;注意&#xff01…...

CSS3媒体查询实现不同宽度的下不同内容的展示

文章目录 前言CSS3 多媒体查询实例520 到 699px 宽度 - 添加邮箱图标700 到 1000px - 添加文本前缀信息大于 1001px 宽度 - 添加邮件地址大于 1151px 宽度 - 添加图标代码后言 前言 hello world欢迎来到前端的新世界 &#x1f61c;当前文章系列专栏&#xff1a;CSS &#x1f43…...

使用 STM32 读取和解析 NTC 热敏电阻的数值

本文介绍了如何利用 STM32 微控制器读取和解析 NTC&#xff08;Negative Temperature Coefficient&#xff09;热敏电阻的数值。首先&#xff0c;我们将简要介绍 NTC 热敏电阻的原理和特性。接下来&#xff0c;我们将详细讨论如何设计电路连接和采用合适的 STM32 外设进行数值读…...

MPNet:旋转机械轻量化故障诊断模型详解python代码复现

目录 一、问题背景与挑战 二、MPNet核心架构 2.1 多分支特征融合模块(MBFM) 2.2 残差注意力金字塔模块(RAPM) 2.2.1 空间金字塔注意力(SPA) 2.2.2 金字塔残差块(PRBlock) 2.3 分类器设计 三、关键技术突破 3.1 多尺度特征融合 3.2 轻量化设计策略 3.3 抗噪声…...

XCTF-web-easyupload

试了试php&#xff0c;php7&#xff0c;pht&#xff0c;phtml等&#xff0c;都没有用 尝试.user.ini 抓包修改将.user.ini修改为jpg图片 在上传一个123.jpg 用蚁剑连接&#xff0c;得到flag...

大型活动交通拥堵治理的视觉算法应用

大型活动下智慧交通的视觉分析应用 一、背景与挑战 大型活动&#xff08;如演唱会、马拉松赛事、高考中考等&#xff09;期间&#xff0c;城市交通面临瞬时人流车流激增、传统摄像头模糊、交通拥堵识别滞后等问题。以演唱会为例&#xff0c;暖城商圈曾因观众集中离场导致周边…...

AtCoder 第409​场初级竞赛 A~E题解

A Conflict 【题目链接】 原题链接&#xff1a;A - Conflict 【考点】 枚举 【题目大意】 找到是否有两人都想要的物品。 【解析】 遍历两端字符串&#xff0c;只有在同时为 o 时输出 Yes 并结束程序&#xff0c;否则输出 No。 【难度】 GESP三级 【代码参考】 #i…...

Go 语言接口详解

Go 语言接口详解 核心概念 接口定义 在 Go 语言中&#xff0c;接口是一种抽象类型&#xff0c;它定义了一组方法的集合&#xff1a; // 定义接口 type Shape interface {Area() float64Perimeter() float64 } 接口实现 Go 接口的实现是隐式的&#xff1a; // 矩形结构体…...

系统设计 --- MongoDB亿级数据查询优化策略

系统设计 --- MongoDB亿级数据查询分表策略 背景Solution --- 分表 背景 使用audit log实现Audi Trail功能 Audit Trail范围: 六个月数据量: 每秒5-7条audi log&#xff0c;共计7千万 – 1亿条数据需要实现全文检索按照时间倒序因为license问题&#xff0c;不能使用ELK只能使用…...

Qwen3-Embedding-0.6B深度解析:多语言语义检索的轻量级利器

第一章 引言&#xff1a;语义表示的新时代挑战与Qwen3的破局之路 1.1 文本嵌入的核心价值与技术演进 在人工智能领域&#xff0c;文本嵌入技术如同连接自然语言与机器理解的“神经突触”——它将人类语言转化为计算机可计算的语义向量&#xff0c;支撑着搜索引擎、推荐系统、…...

深入解析C++中的extern关键字:跨文件共享变量与函数的终极指南

&#x1f680; C extern 关键字深度解析&#xff1a;跨文件编程的终极指南 &#x1f4c5; 更新时间&#xff1a;2025年6月5日 &#x1f3f7;️ 标签&#xff1a;C | extern关键字 | 多文件编程 | 链接与声明 | 现代C 文章目录 前言&#x1f525;一、extern 是什么&#xff1f;&…...

A2A JS SDK 完整教程:快速入门指南

目录 什么是 A2A JS SDK?A2A JS 安装与设置A2A JS 核心概念创建你的第一个 A2A JS 代理A2A JS 服务端开发A2A JS 客户端使用A2A JS 高级特性A2A JS 最佳实践A2A JS 故障排除 什么是 A2A JS SDK? A2A JS SDK 是一个专为 JavaScript/TypeScript 开发者设计的强大库&#xff…...

人机融合智能 | “人智交互”跨学科新领域

本文系统地提出基于“以人为中心AI(HCAI)”理念的人-人工智能交互(人智交互)这一跨学科新领域及框架,定义人智交互领域的理念、基本理论和关键问题、方法、开发流程和参与团队等,阐述提出人智交互新领域的意义。然后,提出人智交互研究的三种新范式取向以及它们的意义。最后,总结…...