通过slam同步建图程序看ros2节点参数传递生效顺序

news2024/10/8 11:36:20

缘起:

ros2 节点参数可以通过启动节点添加,也可以通过launch文件添加,还可以通过配置文件.yaml文件添加,或者是几种方式套用添加,给初学者带来很大的困惑具体是哪个生效了呢,我们拿slam_toolbox  包的online_sync_launch.py来剖析。

程序安装参考这里

(SLAM) 建图时导航 — Navigation 2 1.0.0 文档

我们这里采用源码编译安装,方便随时修改代码编译运行看效果

源码下载地址:https://github.com/SteveMacenski/slam_toolbox/tree/foxy-develicon-default.png?t=N7T8https://github.com/SteveMacenski/slam_toolbox/tree/foxy-devel

 文件目录结构

 online_sync_launch.py  # 同步建图launch文件源码

import os

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, LogInfo
from launch.conditions import UnlessCondition
from launch.substitutions import LaunchConfiguration, PythonExpression
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory
from nav2_common.launch import HasNodeParams


def generate_launch_description():
    use_sim_time = LaunchConfiguration('use_sim_time')
    params_file = LaunchConfiguration('params_file')
    default_params_file = os.path.join(get_package_share_directory("slam_toolbox"),
                                       'config', 'mapper_params_online_sync.yaml')

    declare_use_sim_time_argument = DeclareLaunchArgument(
        'use_sim_time',
        default_value='true',
        description='Use simulation/Gazebo clock')
    declare_params_file_cmd = DeclareLaunchArgument(
        'params_file',
        default_value=default_params_file,
        description='Full path to the ROS2 parameters file to use for the slam_toolbox node')

    # If the provided param file doesn't have slam_toolbox params, we must pass the
    # default_params_file instead. This could happen due to automatic propagation of
    # LaunchArguments. See:
    # https://github.com/ros-planning/navigation2/pull/2243#issuecomment-800479866
    has_node_params = HasNodeParams(source_file=params_file,
                                    node_name='slam_toolbox')

    actual_params_file = PythonExpression(['"', params_file, '" if ', has_node_params,
                                           ' else "', default_params_file, '"'])

    log_param_change = LogInfo(msg=['provided params_file ',  params_file,
                                    ' does not contain slam_toolbox parameters. Using default: ',
                                    default_params_file],
                               condition=UnlessCondition(has_node_params))

    start_sync_slam_toolbox_node = Node(
        parameters=[
          actual_params_file,
          {'use_sim_time': use_sim_time}
        ],
        package='slam_toolbox',
        executable='sync_slam_toolbox_node',
        name='slam_toolbox',
        output='screen')

    ld = LaunchDescription()

    ld.add_action(declare_use_sim_time_argument)
    ld.add_action(declare_params_file_cmd)
    ld.add_action(log_param_change)
    ld.add_action(start_sync_slam_toolbox_node)

    return ld

这里我们只看节点配置部分

 start_sync_slam_toolbox_node = Node(
        parameters=[
          actual_params_file,
          {'use_sim_time': use_sim_time}
        ],
        package='slam_toolbox',
        executable='sync_slam_toolbox_node',
        name='slam_toolbox',
        output='screen')

lanuch文件节点参数传递语句:

parameters=[

actual_params_file,

{'use_sim_time': use_sim_time}

],

这里我们只拿最常用的一个参数use_sim_time举例,看看是哪一步的设置生效了,其他参数逻辑是一样的。

启动这个节点

ros2 launch slam_toolbox online_sync_launch.py

[INFO] [launch]: All log files can be found below /home/m/.ros/log/2023-09-06-01-39-24-649989-ubun-44795
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [sync_slam_toolbox_node-1]: process started with pid [44797]
[sync_slam_toolbox_node-1] [INFO] [1693935564.841328831] [slam_toolbox]: Node using stack size 40000000
[sync_slam_toolbox_node-1] [INFO] [1693935564.869237603] [slam_toolbox]: Using solver plugin solver_plugins::CeresSolver
[sync_slam_toolbox_node-1] [INFO] [1693935564.869558263] [slam_toolbox]: CeresSolver: Using SCHUR_JACOBI preconditioner.


查看节点下载参数

m@ubun:~/ros2_ws$ ros2 node list
/slam_toolbox
/transform_listener_impl_563889db4b50
m@ubun:~/ros2_ws$ ros2 param dump slam_toolbox
Saving to:  ./slam_toolbox.yaml

下载的slam_toolbox节点参数详情

/slam_toolbox:
  ros__parameters:
    angle_variance_penalty: 1.0
    base_frame: base_footprint
    ceres_dogleg_type: TRADITIONAL_DOGLEG
    ceres_linear_solver: SPARSE_NORMAL_CHOLESKY
    ceres_loss_function: None
    ceres_preconditioner: SCHUR_JACOBI
    ceres_trust_strategy: LEVENBERG_MARQUARDT
    coarse_angle_resolution: 0.0349
    coarse_search_angle_offset: 0.349
    correlation_search_space_dimension: 0.5
    correlation_search_space_resolution: 0.01
    correlation_search_space_smear_deviation: 0.1
    debug_logging: false
    distance_variance_penalty: 0.5
    do_loop_closing: true
    enable_interactive_mode: true
    fine_search_angle_offset: 0.00349
    interactive_mode: false
    link_match_minimum_response_fine: 0.1
    link_scan_maximum_distance: 1.5
    loop_match_maximum_variance_coarse: 3.0
    loop_match_minimum_chain_size: 10
    loop_match_minimum_response_coarse: 0.35
    loop_match_minimum_response_fine: 0.45
    loop_search_maximum_distance: 3.0
    loop_search_space_dimension: 8.0
    loop_search_space_resolution: 0.05
    loop_search_space_smear_deviation: 0.03
    map_file_name: ''
    map_frame: map
    map_name: /map
    map_start_at_dock: null
    map_start_pose: null
    map_update_interval: 5.0
    minimum_angle_penalty: 0.9
    minimum_distance_penalty: 0.5
    minimum_time_interval: 0.5
    minimum_travel_distance: 0.5
    minimum_travel_heading: 0.5
    mode: mapping
    odom_frame: odom
    paused_new_measurements: false
    paused_processing: false
    resolution: 0.05
    scan_buffer_maximum_scan_distance: 10.0
    scan_buffer_size: 10
    scan_topic: /scan
    solver_plugin: solver_plugins::CeresSolver
    tf_buffer_duration: 30.0
    throttle_scans: 1
    transform_publish_period: 0.02
    transform_timeout: 0.2
    use_response_expansion: true
    use_scan_barycenter: true
    use_scan_matching: true
    use_sim_time: true

看最后一项:

use_sim_time: true

launch文件默认设置:

 declare_use_sim_time_argument = DeclareLaunchArgument(
        'use_sim_time',
        default_value='true',
        description='Use simulation/Gazebo clock')

如果我们启动这个launch文件加上参数

 m@ubun:~/ros2_ws$ ros2 launch slam_toolbox online_sync_launch.py use_sim_time:=false


[INFO] [launch]: All log files can be found below /home/m/.ros/log/2023-09-06-01-48-36-038660-ubun-45408
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [sync_slam_toolbox_node-1]: process started with pid [45410]
[sync_slam_toolbox_node-1] [INFO] [1693936116.286793795] [slam_toolbox]: Node using stack size 40000000
[sync_slam_toolbox_node-1] [INFO] [1693936116.307085638] [slam_toolbox]: Using solver plugin solver_plugins::CeresSolver
[sync_slam_toolbox_node-1] [INFO] [1693936116.307325365] [slam_toolbox]: CeresSolver: Using SCHUR_JACOBI preconditioner.

再次下载参数配置文件

m@ubun:~/ros2_ws$ ros2 param dump slam_toolbox
Saving to:  ./slam_toolbox.yaml

/slam_toolbox:
  ros__parameters:
    angle_variance_penalty: 1.0
    base_frame: base_footprint
    ceres_dogleg_type: TRADITIONAL_DOGLEG
    ceres_linear_solver: SPARSE_NORMAL_CHOLESKY
    ceres_loss_function: None
    ceres_preconditioner: SCHUR_JACOBI
    ceres_trust_strategy: LEVENBERG_MARQUARDT
    coarse_angle_resolution: 0.0349
    coarse_search_angle_offset: 0.349
    correlation_search_space_dimension: 0.5
    correlation_search_space_resolution: 0.01
    correlation_search_space_smear_deviation: 0.1
    debug_logging: false
    distance_variance_penalty: 0.5
    do_loop_closing: true
    enable_interactive_mode: true
    fine_search_angle_offset: 0.00349
    interactive_mode: false
    link_match_minimum_response_fine: 0.1
    link_scan_maximum_distance: 1.5
    loop_match_maximum_variance_coarse: 3.0
    loop_match_minimum_chain_size: 10
    loop_match_minimum_response_coarse: 0.35
    loop_match_minimum_response_fine: 0.45
    loop_search_maximum_distance: 3.0
    loop_search_space_dimension: 8.0
    loop_search_space_resolution: 0.05
    loop_search_space_smear_deviation: 0.03
    map_file_name: ''
    map_frame: map
    map_name: /map
    map_start_at_dock: null
    map_start_pose: null
    map_update_interval: 5.0
    minimum_angle_penalty: 0.9
    minimum_distance_penalty: 0.5
    minimum_time_interval: 0.5
    minimum_travel_distance: 0.5
    minimum_travel_heading: 0.5
    mode: mapping
    odom_frame: odom
    paused_new_measurements: false
    paused_processing: false
    resolution: 0.05
    scan_buffer_maximum_scan_distance: 10.0
    scan_buffer_size: 10
    scan_topic: /scan
    solver_plugin: solver_plugins::CeresSolver
    tf_buffer_duration: 30.0
    throttle_scans: 1
    transform_publish_period: 0.02
    transform_timeout: 0.2
    use_response_expansion: true
    use_scan_barycenter: true
    use_scan_matching: true
    use_sim_time: false

use_sim_time: false   

重新修改参数启动节点

m@ubun:~/ros2_ws$ ros2 launch slam_toolbox online_sync_launch.py use_sim_time:=true

再次下载配置文件

use_sim_time: true 

这里可以看出use_sim_time 的值生效顺序ros2 launch slam_toolbox online_sync_launch.py use_sim_time:=true 或者use_sim_time:=false 是大于launch内的默认配置的。所以我们可以不管launch内的默认配置,直接在启动launch文件时在后面加上参数配置。

这里还有另外一种情况,launch内导入了配置文件的.yaml文件,我们还拿use_sim_time举例。

 start_sync_slam_toolbox_node = Node(
        parameters=[
          actual_params_file,
          {'use_sim_time': use_sim_time}
        ],

actual_params_file其实就是导入的下面的文件

default_params_file = os.path.join(get_package_share_directory("slam_toolbox"),

'config', 'mapper_params_online_sync.yaml')

mapper_params_online_sync.yaml

slam_toolbox:
  ros__parameters:

    # Plugin params
    solver_plugin: solver_plugins::CeresSolver
    ceres_linear_solver: SPARSE_NORMAL_CHOLESKY
    ceres_preconditioner: SCHUR_JACOBI
    ceres_trust_strategy: LEVENBERG_MARQUARDT
    ceres_dogleg_type: TRADITIONAL_DOGLEG
    ceres_loss_function: None

    # ROS Parameters
    odom_frame: odom
    map_frame: map
    base_frame: base_footprint
    scan_topic: /scan
    mode: mapping #localization

    # if you'd like to immediately start continuing a map at a given pose
    # or at the dock, but they are mutually exclusive, if pose is given
    # will use pose
    #map_file_name: test_steve
    #map_start_pose: [0.0, 0.0, 0.0]
    #map_start_at_dock: true

    debug_logging: false
    throttle_scans: 1
    transform_publish_period: 0.02 #if 0 never publishes odometry
    map_update_interval: 5.0
    resolution: 0.05
    max_laser_range: 20.0 #for rastering images
    minimum_time_interval: 0.5
    transform_timeout: 0.2
    tf_buffer_duration: 30.
    stack_size_to_use: 40000000 #// program needs a larger stack size to serialize large maps
    enable_interactive_mode: true

    # General Parameters
    use_scan_matching: true
    use_scan_barycenter: true
    minimum_travel_distance: 0.5
    minimum_travel_heading: 0.5
    scan_buffer_size: 10
    scan_buffer_maximum_scan_distance: 10.0
    link_match_minimum_response_fine: 0.1  
    link_scan_maximum_distance: 1.5
    loop_search_maximum_distance: 3.0
    do_loop_closing: true 
    loop_match_minimum_chain_size: 10           
    loop_match_maximum_variance_coarse: 3.0  
    loop_match_minimum_response_coarse: 0.35    
    loop_match_minimum_response_fine: 0.45

    # Correlation Parameters - Correlation Parameters
    correlation_search_space_dimension: 0.5
    correlation_search_space_resolution: 0.01
    correlation_search_space_smear_deviation: 0.1 

    # Correlation Parameters - Loop Closure Parameters
    loop_search_space_dimension: 8.0
    loop_search_space_resolution: 0.05
    loop_search_space_smear_deviation: 0.03

    # Scan Matcher Parameters
    distance_variance_penalty: 0.5      
    angle_variance_penalty: 1.0    

    fine_search_angle_offset: 0.00349     
    coarse_search_angle_offset: 0.349   
    coarse_angle_resolution: 0.0349        
    minimum_angle_penalty: 0.9
    minimum_distance_penalty: 0.5
    use_response_expansion: true
    #临时在下面添加的参数
    use_sim_time: true

我们在.yaml后面添加了use_sim_time: true

再次启动节点

ros2 launch slam_toolbox online_sync_launch.py use_sim_time:=true 或者use_sim_time:=false

下载参数

ros2 param dump slam_toolbox
Saving to:  ./slam_toolbox.yaml 

/slam_toolbox:
  ros__parameters:
    angle_variance_penalty: 1.0
    base_frame: base_footprint
    ceres_dogleg_type: TRADITIONAL_DOGLEG
    ceres_linear_solver: SPARSE_NORMAL_CHOLESKY
    ceres_loss_function: None
    ceres_preconditioner: SCHUR_JACOBI
    ceres_trust_strategy: LEVENBERG_MARQUARDT
    coarse_angle_resolution: 0.0349
    coarse_search_angle_offset: 0.349
    correlation_search_space_dimension: 0.5
    correlation_search_space_resolution: 0.01
    correlation_search_space_smear_deviation: 0.1
    debug_logging: false
    distance_variance_penalty: 0.5
    do_loop_closing: true
    enable_interactive_mode: true
    fine_search_angle_offset: 0.00349
    interactive_mode: false
    link_match_minimum_response_fine: 0.1
    link_scan_maximum_distance: 1.5
    loop_match_maximum_variance_coarse: 3.0
    loop_match_minimum_chain_size: 10
    loop_match_minimum_response_coarse: 0.35
    loop_match_minimum_response_fine: 0.45
    loop_search_maximum_distance: 3.0
    loop_search_space_dimension: 8.0
    loop_search_space_resolution: 0.05
    loop_search_space_smear_deviation: 0.03
    map_file_name: ''
    map_frame: map
    map_name: /map
    map_start_at_dock: null
    map_start_pose: null
    map_update_interval: 5.0
    minimum_angle_penalty: 0.9
    minimum_distance_penalty: 0.5
    minimum_time_interval: 0.5
    minimum_travel_distance: 0.5
    minimum_travel_heading: 0.5
    mode: mapping
    odom_frame: odom
    paused_new_measurements: false
    paused_processing: false
    resolution: 0.05
    scan_buffer_maximum_scan_distance: 10.0
    scan_buffer_size: 10
    scan_topic: /scan
    solver_plugin: solver_plugins::CeresSolver
    tf_buffer_duration: 30.0
    throttle_scans: 1
    transform_publish_period: 0.02
    transform_timeout: 0.2
    use_response_expansion: true
    use_scan_barycenter: true
    use_scan_matching: true
    use_sim_time: true

不管怎么修改launch的启动参数,use_sim_time: true不变,说明launch文件内加载的.yaml 的权重是大于launch文件后面的启动参数的。

注意我们每次修改完程序都需要重新编译,要不然修改是不生效的。

我们这么反复测试只是为了验证参数在传递过程中哪里生效了,因为launch文件经过层层套娃,一个参数传递了好多次。

参数生效顺序 launch内的.yaml文件大于 ros2 launch slam_toolbox online_sync_launch.py use_sim_time:=true  大于launch文件内的默认参数配置

declare_use_sim_time_argument = DeclareLaunchArgument(

'use_sim_time',

default_value='true',

description='Use simulation/Gazebo clock')

虽然yaml文件的权重最大,但是yaml文件可以在launch文件内进行替换,

 # Create our own temporary YAML files that include substitutions
 # 创建我们自己的临时YAML文件,其中包括替换
    param_substitutions = {
        'use_sim_time': use_sim_time,
        'yaml_filename': map_yaml_file}

    configured_params = RewrittenYaml(
        source_file=params_file,
        root_key=namespace,
        param_rewrites=param_substitutions,
        convert_types=True)

经过这样替换yaml文件的某些参数,使yaml文件的某些参数权重不再是最大。而变成

ros2 launch slam_toolbox online_sync_launch.py use_sim_time:=true  这样的后缀参数权重最大。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/977985.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

shell脚本介绍

当你进入Linux世界的大门时,就会遇到一个强大而又神奇的工具——Shell。Shell是一种命令行解释器,为你在Linux系统中与计算机进行互动提供了无限的可能性。 学习Shell可以让你获得强大的自动化和脚本编程能力,让你更高效地处理文件和目录、管…

【力扣周赛】第 357 场周赛(⭐反悔贪心)

文章目录 竞赛链接Q1:6925. 故障键盘解法1——直接模拟解法2——双端队列 Q2:6953. 判断是否能拆分数组(贪心)Q3:2812. 找出最安全路径⭐解法1——多源BFS瓶颈路模型?解法2——多源BFS 倒序枚举答案 并查…

Vue + Element UI 实现权限管理系统 前端篇(四):优化登录流程

完善登录流程 1. 丰富登录界面 1.1 从 Element 指南中选择组件模板丰富登录界面&#xff0c;放置一个登录界面表单&#xff0c;包含账号密码输入框和登录重置按钮。 <template><el-form :model"loginForm" :rules"fieldRules" ref"loginFo…

数字图像处理:亮度对比度-几何变换-噪声处理

文章目录 数字图像增强亮度与对比度转换几何变换图像裁剪尺寸变换图像旋转 噪声处理添加噪声处理噪声 数字图像增强 亮度与对比度转换 图像变换可分为以下两种&#xff1a; 点算子&#xff1a;基于像素变换&#xff0c;在这一类图像变换中&#xff0c;仅仅根据输入像素值计算…

真随机数生成器TRNG外设模块详解

真随机数生成器TRNG外设模块详解 文章目录 真随机数生成器TRNG外设模块详解简介原理与机制应用要点时钟源中断源初始化数据 软件支持 简介 国产车规微控制器原厂云途半导体设计和发售的YTM32ME微控制器上集成的真随机数生成器TRNG&#xff08;True Random Number Generator&am…

01_TMS320F28004x系列MCU介绍和资料搜集

1. TI C2000 实时微控制器 TI公司在处理器方面的产品线有&#xff1a;基于ARM内核的微控制器/微处理器、MSP430微控制器、C2000系列实时微控制器、还有数字信号处理器&#xff08;DSP&#xff09;。 其中&#xff0c;C2000是TI公司专门针对实时控制推出的32位微控制器。TI公司…

继承(个人学习笔记黑马学习)

1、基本语法 #include <iostream> using namespace std; #include <string>//普通实现页面//Java页面 //class Java { //public: // void header() { // cout << "首页、公开课、登录、注册...(公共头部)" << endl; // } // void footer() …

IDEA爪哇操作数据库

少小离家老大回,乡音无改鬓毛衰 ⒈.IDEA2018设置使用主题颜色 IDEA2018主题颜色分为三种&#xff1a;idea原始颜色&#xff0c;高亮色&#xff0c;黑色 设置方法&#xff1a;Settings–Appearance&Behavior–Appearance ⒉.mysql中&#xff0c;没有my.ini&#xff0c;只有…

计算机视觉中的自监督学习

如何只使用少量标记示例来训练模型&#xff1f; 到目前为止&#xff0c;人工智能所提供的大部分价值都来自于在日益庞大的数据集上训练的监督模型。其中许多数据集都是由人类标记的&#xff0c;这是一项枯燥、耗时、容易出错&#xff0c;有时还很昂贵的工作。自监督学习&#x…

JVM基础面试题

JDK、JRE、JVM的关系 JVM Java虚拟机&#xff0c;它只识别.class类型文件&#xff0c;它能将class文件中的字节码指令进行识别并调用操作系统向上的API完成动作。 JRE Java运行时环境。它主要包含两部分&#xff1a;Jvm的标准实现和Java的一些基本类库。相对于JVM来说,JRE多出来…

【狂神】SpringMVC笔记(一)之详细版

1.Restful 风格 概念&#xff1a; 实现方式&#xff1a; 使用PathVariable 在url相同的情况下&#xff0c;会根据请求方式的不同来执行不同的方法。 使用RestFull风格的好处&#xff1a;简洁、高效、安全 2、接受请求参数及数据回显 2.1、请求参数 方式一&#xff1a;这里…

无涯教程-JavaScript - TIME函数

描述 TIME函数返回特定时间的十进制数。如果在输入功能之前单元格格式为"常规",则输出格式为日期。 TIME返回的十进制数是一个介于0(零)到0.99988426之间的值,代表从0:00:00(12:00:00 AM)到23:59:59(11:59:59 P.M.)的时间。 语法 TIME (hour, minute, second)争论…

Android studio 调整jar包顺序

第一步&#xff1a;编译jar包&#xff0c;放入lib路径下&#xff1a;如&#xff1a; 第二步&#xff1a;app 目录下build.gradle 中添加 compileOnly files(libs/classes.jar) 第三步&#xff1a;project目录下build.gradle 中添加 allprojects {gradle.projectsEvaluated {t…

十四、MySQL(DCL)如何实现用户的简单管理?配置用户?

1、DCL语句&#xff1a; 要学习DCL语言&#xff0c;就要清楚DCL语言是用来干什么的&#xff0c;首先DCL语言英文全称是Data Control Language&#xff0c;是数据控制语言&#xff0c;主要用来管理数据库用户、控制数据库的访问权限/ 2、DCL的基础语法&#xff1a; &#xff08;…

SpringBoot项目启动时预加载

SpringBoot项目启动时预加载 Spring Boot是一种流行的Java开发框架&#xff0c;它提供了许多方便的功能来简化应用程序的开发和部署。其中一个常见的需求是在Spring Boot应用程序启动时预加载一些数据或执行一些初始化操作。 1. CommandLineRunner 和 ApplicationRunner Spri…

垃圾回收 - 标记压缩算法

压缩算法是将标记清除算法与复制算法相结合的产物。 1、什么是标记压缩算法 标记压缩算法是由标记阶段和压缩阶段构成。 首先&#xff0c;这里的标记阶段和标记清除算法时提到的标记阶段完全一样。 接下来我们要搜索数次堆来进行压缩。压缩阶段通过数次搜索堆来重新填充活动对…

mtbatisplus

title: mybatis_plus date: 2023-09-03 21:06:27 tags: mybatis_plusreviews 约定大于配置 默认 当我们要使用mybatisplus的时候 我们需要去集成mp提供的BaseMapper public interface UserMapper extends BaseMapper 关于mybatisplus常用注解 注解到类上 TableName(“表…

【c++】只出现一次的数字I II III(三个版本:三道题)

注&#xff1a;看这篇文章之前你需要了解& | ^ << >> 这五个运算符&#xff0c;此外&#xff0c;代码均经过测试运行通过 目录 1、只出现一次的数字I&#xff08;难度&#xff1a;简单&#xff09; 2、只出现一次的数字II&#xff08;难度&#xff1a;中等&a…

Ubuntu之apt-get系列--apt-get安装软件的方法/教程

原文网址&#xff1a;Ubuntu之apt-get系列--apt-get安装软件的方法/教程_IT利刃出鞘的博客-CSDN博客 简介 本文介绍Ubuntu使用apt-get安装软件的方法。 安装软件 先更新列表 sudo apt-get update 安装软件 sudo apt-get install <package name>[<version>]…

importlib的使用、9个视图子类、视图集、drf之路由、drf之请求响应回顾、GenericViewSet相关流程图

一 drf之请求响应回顾 # 1 drf请求-请求对象&#xff1a;data&#xff0c;query_params&#xff0c;其他跟之前一样&#xff0c;FILES-默认&#xff1a;支持三种编码-局部配置&#xff1a;视图类中-from rest_framework.parsers import JSONParser, FormParser, MultiPartPars…