Blog
Swift Learning (8) - Functions (Improved Code Version)
A function is an independent code segment that completes a specific task. You can identify a function’s purpose by its name, which can be used to “call” the function whenever you need it to perform its task. Swift’s unified function syntax is very flexible and can represent any function, from the simplest C-style functions without parameter names to complex Objective-C-style functions with local and external parameter names. Parameters can provide default values to simplify function calls. Parameters can also be used as both input and output parameters, meaning that once the function finishes executing, the values of the input parameters may be modified.
August 22, 2021
Swift Learning (7) - Control Flow (Improved Code Version)
Swift provides a variety of control flow structures, including while loops for executing tasks multiple times, if, guard, and switch statements for selecting different code branches based on specific conditions, as well as break and continue statements for jumping to other locations in the code. Swift also offers the for-in loop, which makes it easier to iterate over arrays, dictionaries, ranges, strings, and other sequence types. The switch statement in Swift is more powerful than in many C-like languages. case can match many different patterns, including range matching, tuples, and specific type matching. The values matched in a switch statement’s case can be declared as temporary constants or variables for use within the scope of the case, and can also be combined with where to describe more complex matching conditions.
August 21, 2021
Swift Learning (6) - Collection Types (Code Enhanced Version)
The Swift language provides three basic collection types to store collection data: arrays (Array), sets (Set), and dictionaries (Dictionary). Arrays are ordered collections of data. Sets are unordered collections with no duplicate data. Dictionaries are unordered collections of key-value pairs. In Swift, arrays, sets, and dictionaries must explicitly specify the types of keys and values they store, which helps prevent inserting values of the wrong type. Similarly, you can be assured that the type of the value you retrieve is correct.
August 20, 2021
Multi-Label Peach RGB-D Dataset
Multi-Label Peach RGB-D Dataset (Including RGB Images, Depth Images, and Infrared Images) Authors: Yuan Rao / Qing Luo / Peilin Huo / Yipu Li / Jingyao Zhang The ML Peach RGB-D Dataset consists of 2,050 multimodal peach tree images captured using the Microsoft Azure Kinect DK. Each image includes 3 different modalities: RGB images, depth images, and infrared images. All images are aligned with the RGB images and manually labeled into 4 categories: unoccluded, occluded by leaves, occluded by branches, and occluded by fruit.
August 17, 2021
Swift Learning (5) - Strings and Characters (Improved Code Version)
A string is a collection of characters, such as “Hello, world” or “albatross”. In Swift, strings are represented by the String type. There are multiple ways to access the contents of a String, such as as a collection of Character values. The String and Character types in Swift provide a fast and Unicode-compliant way to handle text in your code. The syntax for creating and manipulating strings is similar to string operations in C, being lightweight and readable. Concatenating two strings is as simple as using the + operator. As with other values in Swift, whether a string can be modified depends on whether it is defined as a constant or a variable.
August 13, 2021
Swift Learning (4) - Advanced Operators (Code Enhanced Version)
In addition to the basic operators introduced earlier, Swift also provides several advanced operators for performing complex operations on values. These include bitwise and shift operators, which are already familiar to those who have used C and Objective-C. When defining custom structs, classes, and enums, it can be very useful to provide implementations for standard Swift operators. In Swift, providing custom implementations for these operators is straightforward, and the operators will use the appropriate implementation for each type.
August 12, 2021
Swift Learning (3) - Basic Operators (Fully Ver.)
Operators are special symbols or phrases used to check, change, or combine values. For example, the plus sign + adds two numbers (like let i = 1 + 2). More complex examples include the logical AND operator && (such as if enteredDoorCode && passedRetinaScan). The operators supported by Swift may already be familiar to you from other languages like C. However, Swift has made some improvements to reduce common coding errors. For example, the assignment operator = no longer returns a value, which eliminates the common mistake of writing = instead of == in conditional statements.
August 10, 2021
Swift Learning (2) - The Basics (Fully Ver.)
Swift includes all the basic data types from C and Objective-C. Int represents integer values; Double and Float represent floating-point values; Bool is for boolean values; String is for text data. Swift also provides three basic collection types: Array, Set, and Dictionary. Just like in C, Swift uses variables to store values and associates them with variable names. In Swift, constants—variables whose values cannot be changed—are widely used, and they are even more powerful than constants in C. If the value you are working with does not need to change, using a constant makes your code safer and more clearly expresses your intent.
August 7, 2021
Swift Learning (1) - First Encounter (Code Enhanced Version)
Introduction to Swift Swift is a programming language launched by Apple Inc., specifically designed for application development on Apple’s desktop operating system macOS and mobile operating systems iOS, iPadOS, as well as watchOS and tvOS. Swift surpasses Objective-C in many aspects, with fewer complex symbols and expressions. At the same time, Swift is faster, more convenient, efficient, and safer. In addition, the new Swift language remains compatible with Objective-C. (For more information about Swift, visit the official website)
August 4, 2021
Installing ROS on an Ubuntu 18.04
0. Pre-installation Notes The official ROS project releases multiple versions, which correspond to specific Ubuntu versions as shown below: ROS Version Ubuntu Version ROS Kinetic Kame Ubuntu 16.04 ROS Melodic Morenia Ubuntu 18.04 ROS Noetic Ninjemys Ubuntu 20.04 This guide introduces the installation method for ROS Melodic Morenia, which matches Ubuntu 18.04. The ROS official website provides precompiled software packages for Ubuntu and source code (not recommended). It is recommended to directly download the official precompiled packages.
May 25, 2021