美美的圣诞树画出来-CoCube

news2024/9/27 15:24:55

2022年圣诞节到来啦,很高兴这次我们又能一起度过~
CSDN诚邀各位技术er分享关于圣诞节的各种技术创意,展现你与众不同的精彩!参与本次投稿即可获得【话题达人】勋章+【圣诞快乐】定制勋章(1年1次,错过要等下一年喔)!

你可以从以下几个方面着手(不强制),或者根据自己对话题主题的理解创作,参考如下:

提醒:在发布作品前请把不用的内容删掉

本可以蓝桥ROS云课复现,后续补充。

一组cocube绘制圣诞树

 

之前,有绘制各类优美曲线的博客,但是一个机器人绘制效率肯定是有限的,那么一组机器人效果一定就是倍数关系啦。

优美的曲线(含蝴蝶线)-CoCube 

如何将数学曲线变为机器人轨迹-花式show爱心代码-turtlesim篇 

一、前言

提示:可简单介绍此次创意背景。

Turtlesim修改为CoCube,使用sketch工具包绘制出圣诞树。

 

需要用到的功能包:

  • turtlesim
  • sketch 

二、创意名

提示:可介绍本篇文章要实现的圣诞节相关技术创意。

绘制各类圣诞树随心所欲哦。

 

这个功能包有个啥子小问题呢。

就是绘制过程中,各个小机器人分配任务不均衡。

经常出现一人绘制,万人围观的场面呢。

只剩一个绘制了。

绘制完成后。

 

三、效果展示

提示:可展示本篇文章要实现的圣诞节相关技术创意最终效果。

需要绘制的圣诞树越复杂需要的机器人数量越多。

一号圣诞树:

 

二号圣诞树:

换个颜色:

 

完成后:

 

 

四、实现步骤

提示:可详细介绍实现相关创意的操作步骤。

需要ROS+Turtlesim+Sketch。

配置好Project: Turtle-Sketch。

在终端输入:

roslaunch sketch sketcher.launch

ros@ros:~/RobCode/sketch$ roslaunch sketch sketcher.launch 
... logging to /home/ros/.ros/log/0c537ad0-890a-11ed-a964-4789d50e4dcc/roslaunch-ros-278770.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ros:34897/

SUMMARY
========

PARAMETERS
 * /rosdistro: noetic
 * /rosversion: 1.15.15

NODES
  /
    CannyThresholding (image_thresholding/server.py)
    ImagePath (image_thresholding/import_server.py)
    Sketch (sketch/sketcher.py)
    rqt_reconfigure (rqt_reconfigure/rqt_reconfigure)
    sim (turtlesim/turtlesim_node)

auto-starting new master
process[master]: started with pid [278778]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 0c537ad0-890a-11ed-a964-4789d50e4dcc
process[rosout-1]: started with pid [278788]
started core service [/rosout]
process[rqt_reconfigure-2]: started with pid [278791]
process[CannyThresholding-3]: started with pid [278792]
process[ImagePath-4]: started with pid [278797]
process[sim-5]: started with pid [278798]
process[Sketch-6]: started with pid [278799]
Max =  120 	Min =  50
[INFO] [1672491199.756063]: Address selected
[INFO] [1672491199.760637]: Image Loaded
[INFO] [1672491199.761917]: Select minimum and maximum threshold
Max =  120 	Min =  50
[INFO] [1672491203.376289]: Spawning an army of turtles to sketch your image
[INFO] [1672491205.530128]: Sketching ....
[INFO] [1672491292.705367]: Press Ctrl+C to terminate the program

导入具体圣诞树图片:

/home/ros/RobCode/sketch/src/sketch/scripts/c1.jpeg

等待绘制完成即可。

 

五、编码实现

提示:可详细展示实现相关创意的代码。

绘制核心代码Python版本。

具体可参考:

Program to sketch the contours in a turtle-sim
Author: Shilpaj Bhalerao
Date: Aug 30, 2020

#!/usr/bin/env python3.8
"""
Program to sketch the contours in a turtle-sim
Author: Shilpaj Bhalerao
Date: Aug 30, 2020
"""

import rospy
import numpy as np
import math
import sys
import time
import multiprocessing
import cv2
import matplotlib.pyplot as plt
from geometry_msgs.msg import Twist
from turtlesim.msg import Pose
from turtlesim.srv import *
from std_srvs.srv import Empty
from Turtle import *
# from sketch.msg import points, groups, segments
# from sketch.srv import test
import itertools

INTERNAL = False


class Robot:
    def __init__(self, parallel=1):
        self.count = 1
        self.list = []
        self.processes = []
        self.PARALLEL = parallel
        self.start = False
        self.image = None
        self.activate = True
        self.draw_contour = False

        # Variables to access contours data
        self.collection_points = []
        self.collection_segments = []
        self.collection_groups = []

        # Initialize sketcher node
        rospy.init_node('sketcher', anonymous=False)

        # Publisher
        self.pub = rospy.Publisher('/turtle1/cmd_vel', Twist, queue_size=10)

        # Subscriber
        # rospy.Subscriber('contours', segments, self.callback)

        # Rate to control frequency of operation of node
        self.rate = rospy.Rate(1)  # 10hz

        # Reset the turtle-sim simulator
        reset_sim()

        time.sleep(2)  # Delay to make sure dynamic reconfigure is ready

        while not rospy.is_shutdown():
            if INTERNAL:  # Test the code without the data exchange from outside node
                center = [5.54, 5.54]
                origin = [4.0, 4.0]
                l_top = [4.0, 9.0]
                r_top = [9.0, 9.0]
                l_bottom = [4.0, 4.0]
                r_bottom = [9.0, 4.0]

                self.start = True
                self.contours = [[(1, 1), (4, 2), (3, 3,), (4, 9), origin],
                                 [(9, 1), (1, 2), (1, 3,), (9, 9), (9, 4), origin],
                                 [center, l_top, r_top, r_bottom, l_bottom, center]]
                self.numbers = len(self.contours)

            elif not INTERNAL:  # Test the code with other nodes data
                # Wait for user to select image from a path or capture an image using camera
                if self.activate and not self.draw_contour:
                    self.load_img()

                # After selecting image, start drawing contours and adjust the threshold
                if self.activate and rospy.get_param('ImagePath/Capture'):
                    self.find_contours()

            # After finalizing contours, spawn an army of turtles and start sketching
            if self.start:
                # Spawn turtle at the first point of the contours
                self.spawn_source()

                if self.PARALLEL == 0:  # If sequential implementation mode is selected
                    self.trace()
                elif self.PARALLEL == 1:  # If parallel implementation mode is selected
                    rospy.loginfo("Sketching ....")

                    # Code for Multi-processing
                    for i in range(self.numbers):
                        p = multiprocessing.Process(target=self.trace_parallel, args=[i])
                        p.start()
                        self.processes.append(p)
                    for process in self.processes:
                        process.join()

                # Remove the turtles after sketching is done
                self.kill_destination()
                rospy.loginfo("Press Ctrl+C to terminate the program")
                rospy.spin()
            else:
                pass

    # ------------------------------- Functions related to image processing ----------------------------
    def load_img(self):
        """
        Load image using either:
        - Path of an image
        - Using a camera
        """
        while self.image is None:
            types = rospy.get_param('ImagePath/CaptureType')  # Check either camera or path is selected

            # If image path is selected
            if types == 0:
                image_path = rospy.get_param('ImagePath/img_path')  # Read the path
                self.image = cv2.imread(image_path)  # Load an image from the path

                # If image is loaded properly, start finding edges
                if self.image is not None:
                    rospy.loginfo("Address selected")
                    self.draw_contour = True
                    break

            # If camera is selected
            elif types == 1:
                cap = cv2.VideoCapture(0)
                while True:
                    # Check if frame is selected
                    condition = rospy.get_param('ImagePath/Capture')

                    # Capture frame-by-frame
                    ret, frame = cap.read()

                    # Display the resulting frame
                    cv2.imshow('Capture Image to Sketch', frame)
                    cv2.waitKey(1)

                    # If frame is selected properly, start finding edges
                    if condition:
                        self.image = frame
                        cv2.destroyWindow('Capture Image to Sketch')
                        self.draw_contour = True
                        break

        # Resize image since turtle-sim dimensions are 500 x 500
        self.image = cv2.resize(self.image, (500, 500))
        rospy.loginfo("Image Loaded")
        rospy.loginfo("Select minimum and maximum threshold")

    def find_contours(self):
        """
        Find edges and contours in an image
        """
        # Grayscale
        gray = cv2.cvtColor(self.image, cv2.COLOR_BGR2GRAY)

        # Find Canny edges using threshold inputs
        gains = rospy.get_param('/Thresholds')
        min_val = gains[0]
        max_val = gains[1]
        edged = cv2.Canny(gray, min_val, max_val)

        cv2.imshow("Select Threshold Values", edged)
        cv2.waitKey(1)

        # If edges are selected, start drawing sketch
        start = rospy.get_param('/Activate')

        if start:
            # Find contours
            contours, hierarchy = cv2.findContours(edged, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)

            # Convert contours to accessible data format
            self.contour_to_accessible_format(contours)

            # Draw all contours on a blank image
            blank = np.zeros(shape=[500, 500, 3], dtype=np.uint8)
            cv2.drawContours(blank, contours, -1, (255, 255, 255), 1)

    def contour_to_accessible_format(self, contours):
        """
        Function to convert the opencv contours to accessible data format
        - Collection of x,y coordinates is a point
        - Collection of points is a segment
        - Collection of segments is a group
        - Collection of groups is a contour
        :param contours: Extracted contours from the image
        :type contours: opencv contours
        """
        for i in range(len(contours)):  # For all the contours
            if len(contours[i]) > 10:  # If they have more than 10 points
                for j in range(len(contours[i])):  # Find the x,y coordinates of all the points
                    x_cord = (contours[i][j][0][0] * 11) / 500  # Convert points within (11, 11) i.e. size of turtle-sim
                    y_cord = (contours[i][j][0][1] * 11) / 500

                    # Save these coordinates in a list named collection_points and subtract y from 11 to make upright
                    # image
                    self.collection_points.append((x_cord, 11.0 - y_cord))

                # Collect all line segments in collection_segments list
                self.collection_segments.append(self.collection_points)
                self.collection_points = []

            # Collect all groups in collection_groups list
            self.collection_groups.append(self.collection_segments)

        # Collection of all contours in contours
        self.contours = self.collection_segments

        # Total number of contours
        self.numbers = len(self.contours)

        # Reset and code flow
        self.collection_segments = []
        self.activate = False
        self.start = True

    # ------------------------------- Functions related to sketching turtle path ----------------------------
    def trace_parallel(self, j):
        """
        Function to trace the contours using multi-processing
        :param j: Number of multi-processes
        :type j: Int
        """
        # Take x,y coord. of next point in contour and teleport turtle to that point(for all contours simultaneously)
        for k in range(len(self.contours[j])):
            self.list[j].teleport(self.contours[j][k][0], self.contours[j][k][1], 0.0)

    def trace(self):
        """
        Function to trace the contours using sequential programming
        """
        # Take x,y coord. of next point in contour and teleport turtle to that point(for one contour at a time)
        for j in range(self.numbers):
            for k in range(len(self.contours[j])):
                self.list[j].teleport(self.contours[j][k][0], self.contours[j][k][1], 0.0)

    # ------------------------------- Functions related to turtle actions ----------------------------
    def spawn_source(self):
        """
        Spawn multiple turtles on the first point of each contour
        """
        rospy.loginfo("Spawning an army of turtles to sketch your image")
        for i in range(self.numbers):
            self.list.append(Turtle(i + 1))
            if i == 0:
                self.list[0].set_pen(0)
                self.list[0].teleport(self.contours[i][0][0], self.contours[i][0][1], 0.0)
                self.list[0].set_pen(1)
            else:
                self.list[i].spawn(self.contours[i][0][0], self.contours[i][0][1], 0.0)

    def kill_destination(self):
        """
        Remove the turtles from simulation at the end of sketching
        """
        for i in range(self.numbers):
            self.list[i].kill_turtle()


def reset_sim():
    """
    Function to reset the simulator
    """
    try:
        reset_serv = rospy.ServiceProxy('/reset', Empty)
        reset_serv()
    except rospy.ServiceException as e:
        rospy.loginfo("Service execution failed: %s" + str(e))


if __name__ == '__main__':
    try:
        turtle = Robot(int(sys.argv[1]))
    except KeyboardInterrupt:
        exit()


原作品机器翻译如下:

#项目:海龟素描
##概述
-在这个项目中,左边的图像作为输入,右边的图像作为输出,使用turtlesim
-左侧的图像可以使用其路径选择,也可以直接从相机拍摄
-以下视频显示了该项目的实际情况

---
##使用的概念
以下是本项目使用的概念:
-**动态重新配置**
-使用路径导入图像
-使用相机导入图像
-设置Canny边缘检测的阈值
-**ROS参数**
-设置阈值参数的值
-获取阈值参数的值
-**ROS服务**
-产卵海龟
-传送海龟
-将笔的状态设置为-ON/OFF
-完成草图后移除海龟
-**OpenCV**
-导入图像的步骤
-使用Canny边缘检测查找边缘
-查找轮廓的步骤
-**多处理**
-为了画草图而生下一群海龟
---
##目录结构
-该目录包含3个包:
-“草图`
-`动态重新配置`
-`image_thresholding`
-草图目录结构
```
  ├── CMakeLists.txt
  ├── docs                                 # Supported files for documentation
  │   ├── Contours.png
  │   ├── done.png
  │   ├── dynamic reconfigure.png
  │   ├── edges.png
  │   ├── Output.png
  │   ├── rosgraph.png
  │   ├── test.png
  │   └── turtles.png
  ├── include
  │   └── sketch
  ├── launch                                # Launch Files
  │   └── sketcher.launch
  ├── package.xml
  ├── README.md
  ├── nodes                                 # ROS Nodes
  │   ├── ironman.jpeg
  │   ├── sketcher.py
  │   └── Turtle.py
  └── TODO.md                               # TO DO for next version
```
-Image_thresholding目录结构
```
  .
  ├── cfg                                    # Configuration file for GUI
  │   ├── import.cfg                         # GUI params related to image import
  │   └── thresholds.cfg                     # GUI params related to image thresholding
  ├── CMakeLists.txt
  ├── include
  │   └── dynamic_parameters
  ├── launch                                 # Launch files 
  │   └── canny_thresholding.launch            # Launch - GUI for Canny edge detection
  ├── nodes                                  # ROS Nodes
  │   ├── get_values.py
  │   ├── import_server.py                   # Import Image import parameters in python node
  │   └── server.py                          # Import thresholding parameters in python node
  └── package.xml
```
---
##编码风格指南-PEP8
---
##依赖关系
-“动态重新配置”包
-`OpenCV`
---
##安装和运行
要在本地系统上运行项目,请执行以下步骤:
-下载软件包“sketch”、“image_thresholding”和“dynamic-reconfigure noetic-devel”`
-将这些包复制到ROS工作区,即`~/ROS_ws/src/`
-构建工作区
-`$cd~/ROS_ws/`
-`$catkin_make`
-打开新终端并获取ROS工作区的源代码-`source~/ROS_ws/devel/setup.bash`
-运行命令-`$roslaunch sketcher.raunch`
-此命令将打开此项目的turtlesim和GUI
![](./sketch/docs/test.png)
![](./sketch/docs/dynamic_reconfig.png)
-您可以为`CaptureType选择图像**地址(0)**或**照相机(1)**选项`
-如果选择*Address(0)*,请在“img_path”部分中插入系统上图像的路径
-然后单击`Capture前面的复选框`
-如果您选择*照相机(0)*,照相机窗口将弹出,您可以在获得所需帧后单击“捕获”前面的复选框
-这将打开一个窗口,其中包含选定帧中的边
![](./sketch/docs/edges.png)
-现在,使用GUI设置最小和最大阈值以获得所需的轮廓
-单击“开始”前面的复选框,产生一支海龟大军,它将为您绘制这些轮廓
![](./sketch/docs/turtles.png)
-草图完成后,海龟会消失
![](./sketch/docs/done.png)
**注:**
-如果要将方法从并行更改为顺序,请执行以下步骤:
1.在此目录中打开启动文件`~/ROS_ws/sketch/launch/`
2.sketcher节点的“arg”标记的值为1
3.将此值更改为`0`
-这里,0=顺序执行,1=并行执行


可扩展部分:

#要执行的操作:
参考-turtle_actionlib
##项目1:绘制等高线
##下一版本的任务
-[]为等高线数据传输创建自定义消息
-[]在主题上传输等高线数据
-[]通过服务传输等高线数据
-[]使用ROS参数传输等高线数据
-[]添加加权原始图像,为GitHub配置文件创建一个漂亮的.gif文件
-[]使用GUI窗口上的按钮
-[]创建插件
-[]SRS文件
-[]编码结构图
-[x]导入图像
-[x]查找轮廓
-[x]在代码中添加自定义阈值
-[x]使用套头衫绘制芋头
-[x]将乌龟从一点移动到另一点
-[x]繁殖多只海龟
-[x]将繁殖的海龟传送到轮廓的第一个点
-[x]顺序轮廓绘制
-[x]同时绘制多个轮廓的多重处理
-[x]用于捕获图像或加载图像并显示输出的GUI
-[x]使用ROS1 Noetic
-[]用于生产的ROS2端口
-[]遵循编码样式
-[]创建文档
-[]优化代码
-[]使用PyCUDA在GPU上运行代码
-[x]文档
-依赖关系
-环境文件
-[]包装和出版
-[]日志记录模块
-[x]README文件
-[]包括使用的概念和与概念的良好资源链接
---
##项目2:如果可以,请抓住我
-[]动议
-[]动态配置
-[]PID的自定义消息
-[x]用于精确控制的PID控制器类代码
-[]实现PID调节的动态重新配置
---
##项目3:
-[]TF合作伙伴
-[]在turtlesim中创建另一个坐标系
-[]将海龟移到某个位置,并显示相对于另一个原点的坐标


提醒:在发布作品前请把不用的内容删掉

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

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

相关文章

尚医通-上传医院接口实现(十八)

目录&#xff1a; &#xff08;1&#xff09;上传医院接口-基础类的创建 &#xff08;2&#xff09;数据接口-上传医院接口-初步实现 &#xff08;3&#xff09;上传医院接口-最终实现 &#xff08;1&#xff09;上传医院接口-基础类的创建 复制相关的工具类&#xff1a;这…

Redis Windows版安装和使用

下载地址&#xff0c;亲已测试可放心使用 https://github.com/tporadowski/redis/releases Redis安装和基本使用&#xff08;windows版&#xff09; 1.Redis简介 完全开源免费的高性能的key-value的数据库 支持数据的持久化&#xff0c;可以将内存中的数据保存在磁盘中&…

【函数】一篇文章带你看懂控制流、递归、高阶函数

目录 控制流 条件语句 迭代语句 示例&#xff1a;质因数分解 递归 示例&#xff1a;阶乘 示例&#xff1a;斐波那契数列 示例&#xff1a;判断奇偶数 高阶函数 lambda 表达式 设计函数 示例&#xff1a;累加计算 示例&#xff1a;柯里化 Lab 1: Functions, Control …

个人能用的短信平台有哪些?看这一篇就够了

对于程序员个人来说&#xff0c;在做开发或者是接项目的时候&#xff0c;常常会用到发送短信功能模块&#xff0c;而自己写这个模块会要相当多的精力和时间&#xff0c;去找短信平台来解决问题&#xff0c;已经成了不少程序员的共识。 但市面上的短信平台确实很杂&#xff0c;鱼…

服务注册与发现原理

一、什么是服务注册与发现&#xff1f; 服务注册与发现就是一套管理微服务的组件&#xff0c;方便各拆分的服务平滑上线和下线&#xff0c;以及某个服务出现故障自动剔除。其实质就是维护一张记录各在线服务的表。让消费服知道服务在线可以请求。。。。。。 二、服务注册与发现…

SQL限制

SQL限制目录概述需求&#xff1a;设计思路实现思路分析1.URL管理参考资料和推荐阅读Survive by day and develop by night. talk for import biz , show your perfect code,full busy&#xff0c;skip hardness,make a better result,wait for change,challenge Survive. happy…

PLL实验

PLL实验 开发板上面只有一个200MHz时钟输入&#xff0c;对于其它频率的时钟怎么办&#xff1f; 介绍 其实在很多 FPGA 芯片内部都集成了 PLL &#xff0c;其他厂商可能不叫 PLL &#xff0c;但是也有类似的功能模块&#xff0c;通过 PLL 可以倍频分频&#xff0c;产生其他很…

pytorch搭建yolov3网络

yolov3的整体网络结构 主要包含了两个部分。左边的Darknet-53主干特征提取网络主要用于提取特征。右边是一个FPN金字塔结构。 主干特征提取网络&#xff08;提取特征&#xff09; import math from collections import OrderedDict import torch.nn as nn#------------------…

MySQL事务相关知识

实践阅读&#xff1a;一文彻底读懂MySQL事务的四大隔离级别 1、什么是事务&#xff1f; 数据库事务&#xff08;简称&#xff1a;事务&#xff09;&#xff0c;是数据库管理系统执行过程中的一个逻辑单位&#xff0c;由一个有限的数据库操作序列构成&#xff0c;这些操作要么全…

AcWing 4645. 选数异或(预处理小区间 + 二分优化找)

题目如下&#xff1a; 题解 or 思路 在 [l,r][l, r][l,r] 区间内找到两个数 a,ba, ba,b 使得 a ^ b x 通过异或的性质&#xff1a; a ^ b ^ b x ^ b > a x ^ b 我们可以通过 b 可以迅速找到 a, a x ^ b 我们可以现预处理出所有小区间(大区间可以不需要&#xff0c;因为…

win11怎么分回c盘空间

有网友反映自己的win11系统有多个分区&#xff0c;c盘分区的空间比较小&#xff0c;便想通过win11分盘功能&#xff0c;将临近的磁盘空间分给c盘。那么win11怎么分回c盘空间&#xff1f;下面就教下大家win11将其他盘空间分回c盘的方法步骤。 工具/原料&#xff1a; 系统版本&am…

最近几年-基于深度学习自然语言处理的推荐系统-必读论文整理分享

基于内容的推荐&#xff08;Content-based Recommendation&#xff09;是信息过滤技术的延续与发展&#xff0c;它是建立在项目的内容信息上作出推荐的&#xff0c;而不需要依据用户对项目的评价意见&#xff0c;更多地需要用机器学习的方法从关于内容的特征描述的事例中得到用…

02-JVM堆里面的分区:Eden,survival (from+ to),老年代,各自的特点?

1.模型 堆里面分为新生代和老生代&#xff08;java8 取消了永久代&#xff0c;采用了 Metaspace&#xff09;&#xff0c;新生代包含 EdenSurvivor 区&#xff0c;survivor 区里面分为 from 和 to 区. 内存回收时&#xff0c;如果用的是复制算法&#xff0c;从 from 复制到 to…

项目实战之旅游网(十三)前台产品详情 前台收藏

目录 一.前台产品详情 1.查询产品 2.收藏按钮 二.前台收藏 本章的代码会统一放到最后。 一.前台产品详情 1.查询产品 即点击“查看详情”即可得到这个产品的详细描述。 并且项目运行起来之后&#xff0c;可以在后台新建新的产品&#xff0c;在前台可以实时查询到。 2.…

C工程与寄存器封装

目录 一、C语言工程简介 二、启动代码分析 三、C语言实现LED 四、寄存器的封装方式 五、寄存器操作的标准化 六、流水灯 一、C语言工程简介 先将工程模板解压 include里是.h文件 src里是.c文件 start里面是.s启动文件 ## NAME interface CROSS_COMPILE arm-no…

Fusion360 外壳开孔零件居中对齐的方法

DIY时需要根据从市场上采购的成品盒子进行开孔&#xff0c;通过3维软件进行开孔设计是比较方便的。Solidworks由于版权问题不易采用&#xff0c;Fusion360的个人版由于软件差异不像Solidworks方便约束定位。我通过尝试找到了适用方法。 先看成果。在一块板上居中位置开孔以便安…

电子学会2020年9月青少年软件编程(图形化)等级考试试卷(三级)答案解析

目录 一、单选题&#xff08;共25题&#xff0c;每题2分&#xff0c;共50分&#xff09; 二、判断题&#xff08;共10题&#xff0c;每题2分&#xff0c;共20分&#xff09; 三、编程题【该题由测评师线下评分】&#xff08;共3题&#xff0c;共30分&#xff09; 青少年软件…

阶段性回顾(4)与四道题目

TIPS 1. 当创建数组的时候&#xff0c;如果没有指定数组的元素个数也没关系&#xff0c;编译器会根据你初始化的内容来自行确定。 2. 在逻辑表达式当中&#xff0c;如果为真&#xff0c;就以1作为结果&#xff0c;如果为假&#xff0c;就以0作为结果。 3. 输入字符串的时候&…

VUE实例的组件的生命周期和数据共享和ref的使用方法(建议直接看ref)

目录VUE实例的组件的生命周期和数据共享组件间的数据共享ref的使用方法使用ref操作dom使用ref引用组件this.$nextTick(cb)方法的使用VUE实例的组件的生命周期和数据共享 生命周期和生命周期函数 这个是我学校vue书籍阿里云盘地址,有需要可以点击看看 生命周期&#xff08;Life…

对Java中异常的认识

文章目录一、异常的概念与体系结构1.异常的概念2.异常的体系结构3.异常的分类二、异常的处理1.防御式编程2. 异常的抛出3.异常的捕获4.异常处理流程总结三、自定义异常类一、异常的概念与体系结构 1.异常的概念 在生活中&#xff0c;当我们发现朋友表现出不舒服的情况&#x…