再看3B1B的线代引发的思考

规划个行程:

3B1B 的线代视频真的是”惊为天人”,”降维打击”, 仿佛打开了新世界的大门, 对比起来那些之前学的不联系几何不联系空间变换的线代简直就是味同嚼蜡,极其死板片面.

  • 3B1B 的线代”先进”/“好”在哪里?

    • 个人认为,建立了”直观” 和 联系/映射到”实物” 是它”先进”的核心
  • 其它的数学或领域能不能也这样”先进”?

利用好AI

规划个行程:


辅助写个代码注释:

之前

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/// enumerations of gyro measuring range
pub const GyroRange = enum(u8) {
/// -2000dps ~ +2000dps ; 0.0610dps/LSB
_2000DPS = 0,
_1000DPS = 1,
_500DPS = 2,
_250DPS = 3,
_125DPS = 4,
};

/// enumerations of gyro output-data-rate + bandwidth
pub const GyroODRBW = enum(u8) {
/// ODR:2000Hz Filter-Bandwidth:532Hz
ODR_2000_BW_532 = 0x00,
ODR_2000_BW_230 = 0x01,
ODR_1000_BW_116 = 0x02,
ODR_400_BW_47 = 0x03,
ODR_200_BW_64 = 0x06,
ODR_200_BW_23 = 0x04,
ODR_100_BW_32 = 0x07,
ODR_100_BW_12 = 0x05,
};

pub const VTable = struct {
/// read a register
read_reg: *const fn (ctx: *anyopaque, sen: Sen, reg: u8, data: *u8) anyerror!void,
/// burst read
///
/// `sen` indicate which sensor
read_regs: *const fn (ctx: *anyopaque, sen: Sen, reg: u8, data: []u8) anyerror!void,
/// write a register
///
/// `sen` indicate which sensor
write_reg: *const fn (ctx: *anyopaque, sen: Sen, reg: u8, data: u8) anyerror!void,
/// `level` will be one of ['V','D','I','W','E']
log: *const fn (ctx: *anyopaque, level: u8, msg: []const u8) void,

/// wait for x ms
waitms: *const fn (ms: u16) void,
};

之后

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/// Enumerations defining the measurement ranges for gyroscope
pub const GyroRange = enum(u8) {
/// Range: -2000dps to +2000dps; Sensitivity: 0.0610dps/LSB
_2000DPS = 0,
/// Range: -1000dps to +1000dps; Sensitivity: 0.0305dps/LSB
_1000DPS = 1,
/// Range: -500dps to +500dps; Sensitivity: 0.0153dps/LSB
_500DPS = 2,
/// Range: -250dps to +250dps; Sensitivity: 0.0076dps/LSB
_250DPS = 3,
/// Range: -125dps to +125dps; Sensitivity: 0.0038dps/LSB
_125DPS = 4,
};
/// enumerations of gyro output-data-rate + bandwidth
pub const GyroODRBW = enum(u8) {
/// ODR:2000Hz Filter-Bandwidth:532Hz
ODR_2000_BW_532 = 0x00,
/// ODR:2000Hz Filter-Bandwidth:230Hz
ODR_2000_BW_230 = 0x01,
/// ODR:1000Hz Filter-Bandwidth:116Hz
ODR_1000_BW_116 = 0x02,
/// ODR:400Hz Filter-Bandwidth:47Hz
ODR_400_BW_47 = 0x03,
/// ODR:200Hz Filter-Bandwidth:64Hz
ODR_200_BW_64 = 0x06,
/// ODR:200Hz Filter-Bandwidth:23Hz
ODR_200_BW_23 = 0x04,
/// ODR:100Hz Filter-Bandwidth:32Hz
ODR_100_BW_32 = 0x07,
/// ODR:100Hz Filter-Bandwidth:12Hz
ODR_100_BW_12 = 0x05,
};

pub const VTable = struct {
/// Reads a single register from the specified sensor.
///
/// - `ctx`: Operation context, usually points to instance-specific data.
/// - `sen`: Sensor type (`Acc` or `Gyro`).
/// - `reg`: Register address to read.
/// - `data`: Pointer to store read data.
///
/// return void if success otherwise an error
read_reg: *const fn (ctx: *anyopaque, sen: Sen, reg: u8, data: *u8) anyerror!void,
/// Reads multiple registers into a slice starting at a given address.
///
/// - `ctx`: Operation context.
/// - `sen`: Sensor type.
/// - `reg`: Start register address.
/// - `data`: Slice to receive data.
read_regs: *const fn (*anyopaque, Sen, u8, []u8) anyerror!void,
/// Writes a value to a sensor register.
write_reg: *const fn (ctx: *anyopaque, sen: Sen, reg: u8, data: u8) anyerror!void,
/// Logs a message at a specified level.
///
/// - `level`: Log level ('V', 'D', 'I', 'W', 'E').
/// - `msg`: Message to log.
log: *const fn (ctx: *anyopaque, level: u8, msg: []const u8) void,
/// Waits for a specified number of milliseconds.
waitms: *const fn (ms: u16) void,
};

真的很有用!