活动介绍

UG后处理构造器中set curr_x $mom_pos(0) set curr_y $mom_pos(1) set curr_z $mom_pos(2) set curr_r $mom_cycle_rapid_to_pos($mom_cycle_spindle_axis) set curr_f $feed 获取到当前的值,帮我写个把这个当前的值与下一个值比较,当有变化的就添加进set changed_list [list]里面

时间: 2025-08-31 11:06:38 AIGC 浏览: 10
<think>好的,用户的问题是关于如何在UG后处理构造器中比较当前值与下一个值,并在变化时添加到changed_list列表中。首先,我需要理解UG后处理构造器的环境。通常,这类构造器可能使用特定的脚本语言,比如TCL或自定义的宏语言。不过,用户提供的引用中有Python生成器的例子,可能用户对Python比较熟悉,或者构造器支持Python脚本? 接下来,用户的需求是比较连续变量的当前值和下一个值,当值变化时记录。这需要维护一个变量列表,并在每次迭代时检查当前值与下一个值。可能需要考虑初始状态的处理,比如第一个值是否需要添加到列表中,或者只有在变化时才添加。 然后,我需要参考用户提供的引用。引用1中的生成器函数可能对处理连续值有帮助,但用户的问题更侧重于比较相邻值的变化。引用2中的流输出运算符重载示例展示了遍历和访问元素的方法,这可能涉及到如何遍历变量列表。引用4中的unique_ptr管理数组,可能和变量存储有关,但具体到当前问题可能不直接相关。引用5提到了增删改查操作,这可能涉及到列表的动态管理。 可能的解决方案步骤: 1. 初始化一个变量列表,包含curr_x、curr_y等变量。 2. 在循环中遍历这些变量,比较当前值和下一个值。 3. 当检测到变化时,将变化的值添加到changed_list。 4. 需要考虑如何获取下一个值,可能是在处理过程中动态获取,比如从某个数据流或数组中读取。 需要注意的问题包括变量的更新时机,如何存储下一个值,以及如何处理不同变量之间的同步比较。可能需要使用循环结构,逐个变量检查,或者同时检查所有变量的变化。 另外,用户提供的示例代码中有生成器的使用,可能在UG构造器中需要类似的结构来持续监控变量。或者可能需要使用事件监听机制,当变量变化时触发添加操作。但根据用户的问题描述,更可能是在后处理过程中遍历数据点进行比较。 可能的Python实现思路: - 使用一个列表或字典保存当前变量的值。 - 遍历每个数据点,比较当前变量值与保存的上一个值。 - 如果不同,则记录到changed_list,并更新保存的值。 需要处理初始状态,比如第一个数据点是否需要比较。可能用户希望只有在变化时记录,所以初始值可以直接加入列表,或者在第一次比较时跳过。 需要确保变量在每次循环后更新,以便下一次比较正确。同时,可能需要处理多个变量同时变化的情况,比如curr_x和curr_y同时变化,是否需要分别记录还是合并处理。 最后,根据引用中的代码示例,用户可能更倾向于Python风格的解决方案,所以提供Python代码可能更合适。但需要确认UG后处理构造器是否支持Python脚本,或者是否需要使用其他语言。</think>在UG后处理构造器中实现连续值比较,可通过以下步骤实现: ### 解决方法 1. **初始化变量缓存** 使用字典存储当前各轴坐标和进给率: ```python prev_values = { 'x': curr_x, 'y': curr_y, 'z': curr_z, 'r': curr_r, 'f': curr_f } ``` 2. **创建变化检测函数** 通过循环比较当前值与缓存值的差异: ```python def check_changes(current_vals): changed = [] for axis in ['x', 'y', 'z', 'r', 'f']: if current_vals[axis] != prev_values[axis]: changed.append( (axis, prev_values[axis], current_vals[axis]) ) prev_values[axis] = current_vals[axis] # 更新缓存值 return changed ``` 3. **主循环处理逻辑** 在程序主循环中调用检测函数: ```python while has_next_block(): # 假设存在判断是否有后续代码块的函数 current_vals = get_current_values() # 获取当前坐标值[^2] changed_entries = check_changes(current_vals) if changed_entries: changed_list.extend(changed_entries) move_to_next_block() ``` ### 技术要点 - **差异检测**:通过字典键值对实现坐标轴的快速索引和比较[^4] - **状态保存**:使用prev_values字典保存前一刻状态,实现连续比较 - **数据封装**:将变化记录为元组`(轴名称, 旧值, 新值)`,增强可读性 ### 示例应用 假设在刀具路径中出现Z轴高度调整: ```python # 初始值 prev_values = {'x':0, 'y':0, 'z':10, 'r':0, 'f':100} # 当前值发生变化 current_vals = {'x':0, 'y':0, 'z':8, 'r':0, 'f':100} # 检测到变化后输出: changed_list = [('z', 10, 8)] ``` ### 优化建议 1. **阈值过滤**:添加最小变化量判断,避免微小浮动 ```python if abs(current_vals[axis] - prev_values[axis]) > tolerance: ``` 2. **时间戳记录**:添加变化发生的时刻信息[^5] 3. **批量更新**:对同时变化的多个轴进行合并记录
阅读全文

相关推荐

function audio_pitch_correction_t3 % 创建主GUI界面 fig = uifigure('Name', '音频音准矫正系统', 'Position', [100 100 900 700]); % 创建音频选择区域 uilabel(fig, 'Position', [50 680 300 20], 'Text', '待矫正音频来源:', 'FontWeight', 'bold'); % 创建录音选项按钮组 source_btn_group = uibuttongroup(fig, 'Position', [50 630 300 40], 'Title', ''); uibutton(source_btn_group, 'Position', [10 10 130 30], 'Text', '导入音频文件', ... 'ButtonPushedFcn', @(btn,event) select_audio(fig, 'source')); uibutton(source_btn_group, 'Position', [160 10 130 30], 'Text', '录制音频', ... 'ButtonPushedFcn', @(btn,event) record_audio(fig)); % 创建参考音频选择按钮 uilabel(fig, 'Position', [400 680 300 20], 'Text', '参考音频来源:', 'FontWeight', 'bold'); uibutton(fig, 'Position', [400 630 150 30], 'Text', '导入参考音频', ... 'ButtonPushedFcn', @(btn,event) select_audio(fig, 'reference')); % 创建处理按钮 process_btn = uibutton(fig, 'Position', [600 630 150 30], ... 'Text', '开始矫正', 'Enable', 'off', ... 'ButtonPushedFcn', @(btn,event) process_audio(fig)); % 创建播放和保存按钮 uibutton(fig, 'Position', [50 580 150 30], 'Text', '播放原始音频', ... 'ButtonPushedFcn', @(btn,event) play_audio(fig, 'source')); uibutton(fig, 'Position', [250 580 150 30], 'Text', '播放矫正音频', ... 'ButtonPushedFcn', @(btn,event) play_audio(fig, 'corrected')); uibutton(fig, 'Position', [450 580 150 30], 'Text', '保存矫正音频', ... 'ButtonPushedFcn', @(btn,event) save_audio(fig)); % 创建录音状态显示 recording_label = uilabel(fig, 'Position', [650 580 200 30], ... 'Text', '准备录音', 'FontColor', [0 0.5 0]); % 创建波形显示区域 ax_source = uiaxes(fig, 'Position', [50 350 800 150]); title(ax_source, '待矫正音频波形'); ax_reference = uiaxes(fig, 'Position', [50 180 800 150]); title(ax_reference, '参考音频波形'); ax_corrected = uiaxes(fig, 'Position', [50 10 800 150]); title(ax_corrected, '矫正后音频波形'); % 存储数据 fig.UserData.source_audio = []; fig.UserData.reference_audio = []; fig.UserData.corrected_audio = []; fig.UserData.fs = 44100; % 默认采样率 fig.UserData.process_btn = process_btn; fig.UserData.axes = struct('source', ax_source, 'reference', ax_reference, 'corrected', ax_corrected); fig.UserData.recording_label = recording_label; fig.UserData.recorder = []; % 录音器对象 fig.UserData.timer = []; % 计时器对象 end function select_audio(fig, audio_type) [file, path] = uigetfile({'*.wav;*.mp3;*.ogg;*.flac;*.mat', ... '音频文件 (*.wav,*.mp3,*.ogg,*.flac,*.mat)'}); if isequal(file, 0), return; end filename = fullfile(path, file); [~, ~, ext] = fileparts(filename); if strcmpi(ext, '.mat') % 加载MAT文件 data = load(filename); % 检查必需字段 if isfield(data, 'corrected_audio') && isfield(data, 'f0_corrected') && ... isfield(data, 'time_source') && isfield(data, 'fs') % 存储数据 fig.UserData.corrected_audio = data.corrected_audio; fig.UserData.f0_corrected = data.f0_corrected; fig.UserData.time_source = data.time_source; fig.UserData.fs = data.fs; % 更新波形显示 ax = fig.UserData.axes.corrected; cla(ax); yyaxis(ax, 'left'); plot(ax, (1:length(data.corrected_audio))/data.fs, data.corrected_audio); ylabel(ax, '幅度'); yyaxis(ax, 'right'); plot(ax, data.time_source, data.f0_corrected, 'Color', [1 0.5 0], 'LineWidth', 2); ylabel(ax, '频率 (Hz)'); title(ax, '矫正后音频波形与音高'); grid(ax, 'on'); return; else errordlg('MAT文件缺少必需的音高数据字段!', '加载错误'); return; end end % 常规音频文件处理 [audio, fs] = audioread(filename); % 处理立体声:转换为单声道 if size(audio, 2) > 1 audio = mean(audio, 2); end % 截取前20秒 max_samples = min(20*fs, length(audio)); audio = audio(1:max_samples); % 存储数据 fig.UserData.([audio_type '_audio']) = audio; fig.UserData.fs = fs; % 更新波形显示 ax = fig.UserData.axes.(audio_type); cla(ax); plot(ax, (1:length(audio))/fs, audio); xlabel(ax, '时间 (s)'); ylabel(ax, '幅度'); % 如果是矫正音频,尝试读取元数据中的音高信息 if strcmp(audio_type, 'corrected') try info = audioinfo(filename); if isfield(info, 'Comment') && ~isempty(info.Comment) metadata = jsondecode(info.Comment); if isfield(metadata, 'f0_corrected') fig.UserData.f0_corrected = metadata.f0_corrected; fig.UserData.time_source = metadata.time_source; % 添加音高曲线 yyaxis(ax, 'left'); plot(ax, (1:length(audio))/fs, audio); ylabel(ax, '幅度'); yyaxis(ax, 'right'); plot(ax, metadata.time_source, metadata.f0_corrected, 'r', 'LineWidth', 1.5); ylabel(ax, '频率 (Hz)'); title(ax, '矫正后音频波形与音高'); grid(ax, 'on'); end end catch % 忽略元数据读取错误 end end % 启用处理按钮 if ~isempty(fig.UserData.source_audio) && ~isempty(fig.UserData.reference_audio) fig.UserData.process_btn.Enable = 'on'; end end function record_audio(fig) % 创建录音界面 record_fig = uifigure('Name', '音频录制', 'Position', [300 300 400 200]); % 录音时长设置 uilabel(record_fig, 'Position', [50 150 100 20], 'Text', '录音时长 (秒):'); duration_edit = uieditfield(record_fig, 'numeric', ... 'Position', [160 150 100 20], 'Value', 5, 'Limits', [1 30]); % 采样率设置 uilabel(record_fig, 'Position', [50 120 100 20], 'Text', '采样率:'); fs_dropdown = uidropdown(record_fig, ... 'Position', [160 120 100 20], ... 'Items', {'8000', '16000', '44100', '48000'}, ... 'Value', '44100'); % 控制按钮 record_btn = uibutton(record_fig, 'Position', [50 70 100 30], ... 'Text', '开始录音', ... 'ButtonPushedFcn', @(btn,event) start_recording(fig, duration_edit.Value, str2double(fs_dropdown.Value))); uibutton(record_fig, 'Position', [160 70 100 30], ... 'Text', '停止录音', ... 'ButtonPushedFcn', @(btn,event) stop_recording(fig)); uibutton(record_fig, 'Position', [270 70 100 30], ... 'Text', '关闭', ... 'ButtonPushedFcn', @(btn,event) close(record_fig)); end function start_recording(fig, duration, fs) % 更新状态 fig.UserData.recording_label.Text = '录音中...'; fig.UserData.recording_label.FontColor = [1 0 0]; drawnow; % 创建录音器对象 recorder = audiorecorder(fs, 16, 1); % 16-bit, 单声道 % 设置录音时长 fig.UserData.recorder = recorder; fig.UserData.fs = fs; % 开始录音 record(recorder, duration); % 创建计时器显示剩余时间 t = timer('ExecutionMode', 'fixedRate', 'Period', 1, ... 'TasksToExecute', duration, ... 'TimerFcn', @(t,~) update_recording_timer(fig, t, duration)); start(t); % 存储计时器 fig.UserData.timer = t; end function update_recording_timer(fig, t, total_duration) elapsed = t.TasksExecuted; remaining = total_duration - elapsed; fig.UserData.recording_label.Text = sprintf('录音中: %d秒', remaining); % 录音结束时自动停止 if remaining <= 0 stop_recording(fig); end end function stop_recording(fig) if ~isempty(fig.UserData.recorder) && isrecording(fig.UserData.recorder) stop(fig.UserData.recorder); end % 停止计时器 if ~isempty(fig.UserData.timer) && isvalid(fig.UserData.timer) stop(fig.UserData.timer); delete(fig.UserData.timer); fig.UserData.timer = []; end % 获取录音数据 audio = getaudiodata(fig.UserData.recorder); fs = fig.UserData.fs; % 更新状态 fig.UserData.recording_label.Text = '录音完成!'; fig.UserData.recording_label.FontColor = [0 0.5 0]; % 存储为待矫正音频 fig.UserData.source_audio = audio; % 更新波形显示 ax = fig.UserData.axes.source; plot(ax, (1:length(audio))/fs, audio); title(ax, '录制音频波形'); xlabel(ax, '时间 (s)'); ylabel(ax, '幅度'); % 启用处理按钮 if ~isempty(fig.UserData.reference_audio) fig.UserData.process_btn.Enable = 'on'; end end function process_audio(fig) source = fig.UserData.source_audio; reference = fig.UserData.reference_audio; fs = fig.UserData.fs; % 确保主图窗存在 if ~isvalid(fig) errordlg('主窗口已关闭,无法处理音频!', '处理错误'); return; end % 创建处理进度对话框 h = uiprogressdlg(fig, 'Title', '处理中', 'Message', '音频对齐...', 'Indeterminate', 'on'); % === 关键修复1: 统一帧参数 === frame_len = round(0.05 * fs); % 50ms帧长 hop_size = round(0.025 * fs); % 25ms跳跃 % 步骤1:音频对齐 try [aligned_source, aligned_ref] = improved_align_audio(source, reference, fs); catch ME close(h); errordlg(['音频对齐失败: ' ME.message], '处理错误'); return; end % 步骤2:基频提取(使用统一帧参数) h.Message = '提取音高...'; try [f0_source, time_source] = extract_pitch(aligned_source, fs, frame_len, hop_size); [f0_ref, time_ref] = extract_pitch(aligned_ref, fs, frame_len, hop_size); % === 关键修复2: 确保时间序列长度一致 === min_time_len = min(length(time_source), length(time_ref)); time_source = time_source(1:min_time_len); time_ref = time_ref(1:min_time_len); f0_source = f0_source(1:min_time_len); f0_ref = f0_ref(1:min_time_len); catch ME close(h); errordlg(['音高提取失败: ' ME.message], '处理错误'); return; end % 步骤3:音调矫正 h.Message = '矫正音调...'; try [corrected, f0_corrected] = correct_pitch(fig, aligned_source, fs, f0_source, f0_ref, time_source, time_ref); catch ME close(h); errordlg(['音高校正失败: ' ME.message], '处理错误'); return; end % 关闭进度对话框 close(h); % 存储矫正结果 fig.UserData.corrected_audio = corrected; % 更新播放按钮状态 play_btn = findobj(fig, 'Text', '播放矫正音频'); if ~isempty(play_btn) play_btn.Enable = 'on'; end % 更新原始音频波形图 ax_src = fig.UserData.axes.source; cla(ax_src); yyaxis(ax_src, 'left'); plot(ax_src, (1:length(aligned_source))/fs, aligned_source, 'b'); ylabel(ax_src, '幅度'); yyaxis(ax_src, 'right'); plot(ax_src, time_source, f0_source, 'r', 'LineWidth', 1.5); ylabel(ax_src, '频率 (Hz)'); title(ax_src, '原始音频波形与音高'); grid(ax_src, 'on'); % 更新参考音频波形图 ax_ref = fig.UserData.axes.reference; cla(ax_ref); yyaxis(ax_ref, 'left'); plot(ax_ref, (1:length(aligned_ref))/fs, aligned_ref, 'g'); ylabel(ax_ref, '幅度'); yyaxis(ax_ref, 'right'); plot(ax_ref, time_ref, f0_ref, 'm', 'LineWidth', 1.5); ylabel(ax_ref, '频率 (Hz)'); title(ax_ref, '参考音频波形与音高'); grid(ax_ref, 'on'); % 更新矫正后音频波形图 ax_corr = fig.UserData.axes.corrected; cla(ax_corr); yyaxis(ax_corr, 'left'); plot(ax_corr, (1:length(corrected))/fs, corrected, 'Color', [0.5 0 0.5]); ylabel(ax_corr, '幅度'); yyaxis(ax_corr, 'right'); plot(ax_corr, time_source, f0_corrected, 'Color', [1 0.5 0], 'LineWidth', 2); ylabel(ax_corr, '频率 (Hz)'); title(ax_corr, '矫正后音频波形与音高'); grid(ax_corr, 'on'); % 存储所有关键数据 fig.UserData.f0_corrected = f0_corrected; fig.UserData.time_source = time_source; fig.UserData.original_fs = fs; % 绘制综合音高对比图 plot_pitch_comparison(time_source, f0_source, time_ref, f0_ref, f0_corrected,... aligned_source, aligned_ref, corrected, fs); end function [aligned_src, aligned_ref] = improved_align_audio(src, ref, fs) % 改进的音频对齐方法:使用频谱互相关 win_size = round(0.1 * fs); % 100ms窗口 hop_size = round(0.05 * fs); % 50ms跳跃 % 计算源音频的频谱图 [S_src, ~, t_src] = spectrogram(src, win_size, win_size-hop_size, win_size, fs); % 计算参考音频的频谱图 [S_ref, ~, t_ref] = spectrogram(ref, win_size, win_size-hop_size, win_size, fs); % 计算互相关 n_frames = min(length(t_src), length(t_ref)); corr_vals = zeros(1, n_frames); for i = 1:n_frames spec_src = abs(S_src(:, i)); spec_ref = abs(S_ref(:, i)); corr_vals(i) = dot(spec_src, spec_ref) / (norm(spec_src) * norm(spec_ref)); end % 找到最大相关帧 [~, max_idx] = max(corr_vals); time_diff = t_src(max_idx) - t_ref(max_idx); sample_diff = round(time_diff * fs); % 对齐音频 if sample_diff > 0 aligned_src = src(1:end-sample_diff); aligned_ref = ref(sample_diff+1:end); else aligned_src = src(-sample_diff+1:end); aligned_ref = ref(1:end+sample_diff); end % 确保等长 min_len = min(length(aligned_src), length(aligned_ref)); aligned_src = aligned_src(1:min_len); aligned_ref = aligned_ref(1:min_len); end function mfcc = mfcc_feature(audio, fs, frame_size, hop_size) % 参数验证 if nargin < 4 hop_size = round(frame_size/2); % 默认50%重叠 end % 预处理:预加重 audio = filter([1 -0.97], 1, audio); % 分帧处理 frames = buffer(audio, frame_size, frame_size - hop_size, 'nodelay'); num_frames = size(frames, 2); % 加窗(汉明窗) window = hamming(frame_size); windowed_frames = frames .* repmat(window, 1, num_frames); % 计算功率谱 nfft = 2^nextpow2(frame_size); mag_frames = abs(fft(windowed_frames, nfft)); power_frames = (mag_frames(1:nfft/2+1, :)).^2; % 设计梅尔滤波器组 num_filters = 26; % 滤波器数量 mel_min = 0; % 最小Mel频率 mel_max = 2595 * log10(1 + (fs/2)/700); % 最大Mel频率 % 创建等间隔的Mel频率点 mel_points = linspace(mel_min, mel_max, num_filters + 2); % 将Mel频率转换为线性频率 hz_points = 700 * (10.^(mel_points/2595) - 1); % 转换为FFT bin索引 bin_indices = floor((nfft+1) * hz_points / fs); % 创建梅尔滤波器组 filter_bank = zeros(num_filters, nfft/2+1); for m = 2:num_filters+1 left = bin_indices(m-1); center = bin_indices(m); right = bin_indices(m+1); % 左侧斜坡 for k = left:center-1 filter_bank(m-1, k+1) = (k - left) / (center - left); end % 右侧斜坡 for k = center:right filter_bank(m-1, k+1) = (right - k) / (right - center); end end % 应用梅尔滤波器组 mel_spectrum = filter_bank * power_frames; % 取对数 log_mel = log(mel_spectrum + eps); % 计算DCT得到MFCC系数 mfcc = dct(log_mel); % 保留前13个系数(含能量系数) mfcc = mfcc(1:13, :); % 可选:添加能量特征 energy = log(sum(power_frames) + eps); mfcc(1, :) = energy; % 替换第0阶MFCC为对数能量 % 应用倒谱均值归一化 (CMN) mfcc = mfcc - mean(mfcc, 2); end function [f0, time] = extract_pitch(audio, fs, frame_len, hop_size) % 参数验证与默认值设置 if nargin < 3 frame_len = round(0.05 * fs); % 默认50ms帧长 end if nargin < 4 hop_size = round(0.025 * fs); % 默认25ms跳跃 end % === 关键修复: 确保所有尺寸参数为整数 === frame_len = round(frame_len); hop_size = round(hop_size); % 安全计算帧数 n_frames = floor((length(audio) - frame_len) / hop_size) + 1; % 基频提取参数 f0_min = 80; % 最低基频(Hz) f0_max = 1000; % 最高基频(Hz) tau_min = max(1, round(fs/f0_max)); % 确保至少为1 tau_max = max(tau_min+1, round(fs/f0_min)); % 确保大于tau_min % 预分配输出 f0 = zeros(1, n_frames); time = zeros(1, n_frames); % 预处理:带通滤波去除噪声 if fs > 2000 % 确保采样率足够高 [b, a] = butter(4, [80, 1000]/(fs/2), 'bandpass'); audio = filtfilt(b, a, audio); end for i = 1:n_frames start_idx = (i-1)*hop_size + 1; end_idx = min(start_idx + frame_len - 1, length(audio)); frame = audio(start_idx:end_idx); % 确保帧长度有效 if length(frame) < 10 f0(i) = 0; time(i) = (start_idx + frame_len/2) / fs; continue; end % === 修复1: 确保tau在有效范围内 === tau_min_valid = max(1, tau_min); tau_max_valid = min(tau_max, length(frame)-1); if tau_max_valid <= tau_min_valid f0(i) = 0; time(i) = (start_idx + frame_len/2) / fs; continue; end % === 改进的YIN算法 === % 自相关函数计算 autocorr = xcorr(frame, 'biased'); autocorr = autocorr(length(frame):end); % 取正延迟部分 % 差分函数计算 diff = zeros(1, tau_max_valid); for tau = tau_min_valid:tau_max_valid diff(tau) = autocorr(1) - 2*autocorr(tau+1) + autocorr(1); end % 累积均值归一化 (CMND) cmnd = diff; cmnd(1) = 1; sum_val = diff(1); for tau = 2:tau_max_valid sum_val = sum_val + diff(tau); cmnd(tau) = diff(tau) * tau / sum_val; end % 寻找全局最小值 [min_val, min_idx] = min(cmnd(tau_min_valid:tau_max_valid)); tau_int = min_idx + tau_min_valid - 1; % 抛物线插值精炼 if tau_int > 1 && tau_int < tau_max_valid if cmnd(tau_int-1) < cmnd(tau_int+1) num = cmnd(tau_int-1) - cmnd(tau_int); denom = cmnd(tau_int-1) - 2*cmnd(tau_int) + cmnd(tau_int+1); delta = num / denom; else num = cmnd(tau_int+1) - cmnd(tau_int); denom = cmnd(tau_int-1) - 2*cmnd(tau_int) + cmnd(tau_int+1); delta = -num / denom; end tau_true = tau_int + delta; f0(i) = fs / tau_true; else f0(i) = fs / tau_int; end time(i) = (start_idx + frame_len/2) / fs; end % === 增强的平滑处理 === % 1. 异常值检测和替换 med_f0 = medfilt1(f0, 5); % 5点中值滤波 diff_ratio = abs(f0 - med_f0) ./ med_f0; outlier_idx = diff_ratio > 0.2; % 20%偏差视为异常 % 2. 三次样条插值替代线性插值 f0(outlier_idx) = NaN; valid_idx = find(~isnan(f0)); if length(valid_idx) > 3 f0 = interp1(time(valid_idx), f0(valid_idx), time, 'spline'); else f0 = fillmissing(f0, 'linear'); end % 3. 自适应高斯平滑 win_size = min(15, floor(length(f0)/10)); % 动态窗口大小 if win_size > 2 gauss_filter = gausswin(win_size); gauss_filter = gauss_filter / sum(gauss_filter); f0 = conv(f0, gauss_filter, 'same'); end % 确保输出长度 if length(f0) > n_frames f0 = f0(1:n_frames); time = time(1:n_frames); end end function [corrected, f0_corrected] = correct_pitch(fig, audio, fs, f0_src, f0_ref, time_src, time_ref) % === 关键修复1: 统一帧参数 === frame_len = round(0.05 * fs); % 50ms帧长 hop_size = round(0.025 * fs); % 25ms跳跃 % === 关键修复2: 安全计算帧数 === n_frames_src = length(f0_src); n_frames_audio = floor((length(audio)-frame_len)/hop_size) + 1; n_frames = min(n_frames_src, n_frames_audio); % 取最小值确保不超限 % 调试信息 fprintf('[DEBUG] 音频帧数: %d, 基频帧数: %d, 使用帧数: %d\n', ... n_frames_audio, n_frames_src, n_frames); % 预分配输出 corrected = zeros(ceil(length(audio)*1.2), 1); f0_corrected = zeros(1, n_frames); % 使用相位声码器 pv = PhaseVocoder(fs, frame_len, hop_size); % 创建参考音高插值函数 (使用平滑后的参考基频) valid_ref = f0_ref > 50; if sum(valid_ref) > 3 % 对参考基频进行额外平滑 smooth_f0_ref = smooth_pitch(f0_ref, 7); ref_interp = @(t) interp1(time_ref(valid_ref), smooth_f0_ref(valid_ref), t, 'pchip', 'extrap'); else ref_interp = @(t) 0; end % 创建相位声码器实例 pv = PhaseVocoder(fs, frame_len, hop_size); for i = 1:n_frames % ... [帧提取部分不变] ... % 安全获取基频值 if i <= length(f0_src) src_f0 = f0_src(i); else src_f0 = f0_src(end); end t_frame = (start_idx + frame_len/2) / fs; target_f0 = ref_interp(t_frame); % === 智能矫正逻辑 === if ~isnan(src_f0) && src_f0 > 50 && target_f0 > 50 % 计算半音差 semitone_diff = 12 * log2(target_f0 / src_f0); % 动态范围限制 max_diff = min(24, 6 + 0.2*abs(semitone_diff)); % 自适应阈值 semitone_diff = max(-max_diff, min(max_diff, semitone_diff)); % 使用相位声码器处理 corrected_frame = pv.process(frame, semitone_diff); f0_corrected(i) = src_f0 * 2^(semitone_diff/12); % 实际应用后的频率 else % 不进行矫正的区域 corrected_frame = frame; f0_corrected(i) = src_f0; end % === 改进的OLA合成 === output_start = (i-1)*hop_size + 1; output_end = output_start + length(corrected_frame) - 1; % 扩展输出数组 if output_end > length(corrected) corrected(output_end) = 0; end % 应用双向渐变的汉宁窗 win = hann(length(corrected_frame)); % 重叠区域特殊处理 overlap_start = max(1, output_start - hop_size + 1); overlap_end = min(output_end, output_start + hop_size - 1); overlap_len = overlap_end - overlap_start + 1; if overlap_len > 0 % 创建渐变混合窗 blend_win = linspace(0, 1, overlap_len)'; prev_win = blend_win; curr_win = 1 - blend_win; % 应用混合 overlap_idx = overlap_start:overlap_end; corrected(overlap_idx) = corrected(overlap_idx).*prev_win + ... corrected_frame(1:overlap_len).*curr_win; % 处理非重叠部分 if output_start < overlap_start start_idx_new = output_start:(overlap_start-1); corrected(start_idx_new) = corrected(start_idx_new); end if output_end > overlap_end end_idx_new = (overlap_end+1):output_end; corrected(end_idx_new) = corrected_frame((overlap_len+1):end) .* ... win((overlap_len+1):end); end else % 无重叠区域 corrected(output_start:output_end) = corrected(output_start:output_end) + ... corrected_frame .* win; end end % === 关键修复5: 安全裁剪输出 === last_sample = find(corrected ~= 0, 1, 'last'); if ~isempty(last_sample) corrected = corrected(1:last_sample); else corrected = zeros(1, 0); % 返回空数组 end % 归一化 if ~isempty(corrected) max_val = max(abs(corrected)); if max_val > 0 corrected = corrected / max_val; end end % === 关键修复6: 确保f0_corrected长度正确 === if length(f0_corrected) > n_frames f0_corrected = f0_corrected(1:n_frames); end end function smoothed = smooth_pitch(pitch, window_size) % 自适应中值-高斯混合滤波 % 步骤1:中值滤波去除尖峰 med_smoothed = medfilt1(pitch, window_size, 'omitnan', 'truncate'); % 步骤2:计算局部方差 local_var = movvar(med_smoothed, window_size); avg_var = mean(local_var, 'omitnan'); % 步骤3:自适应高斯滤波 gauss_window = window_size * 2 - 1; % 更大的高斯窗口 gauss_filter = gausswin(gauss_window); gauss_filter = gauss_filter / sum(gauss_filter); % 扩展边界处理 padded = [repmat(med_smoothed(1), 1, window_size-1), med_smoothed, ... repmat(med_smoothed(end), 1, window_size-1)]; % 应用卷积 conv_result = conv(padded, gauss_filter, 'same'); smoothed = conv_result(window_size:end-window_size+1); % 步骤4:基于方差的平滑强度调整 high_var_idx = local_var > 2*avg_var; if any(high_var_idx) % 在高方差区域应用额外平滑 extra_smooth = movmean(smoothed, 5); smoothed(high_var_idx) = extra_smooth(high_var_idx); end % 确保长度一致 smoothed = smoothed(1:length(pitch)); end % 长度受控的相位声码器 function y = controlled_phase_vocoder(x, den, num, expected_len) % 基本参数 n = 1024; % FFT大小 hop_in = round(n * 0.25); % 输入跳跃(25%重叠) hop_out = round(hop_in * den/num); % 输出跳跃 % 初始化 y = zeros(expected_len, 1, 'like', x); theta = zeros(n,1); y_pos = 1; % 处理所有帧 for start = 1:hop_in:length(x)-n % 当前帧 frame = x(start:start+n-1); X = fft(frame .* hamming(n)); % 相位处理 mag = abs(X); phase_diff = angle(X) - theta; theta = angle(X); % 相位累积 delta_phi = 2*pi*hop_in*(0:n-1)'/n; phase_diff = phase_diff - delta_phi; phase_diff = wrapToPi(phase_diff); % 频率估计 omega = (phase_diff + delta_phi) / hop_in; % 相位传播 theta = theta + hop_out * omega; % 重建帧 y_frame = real(ifft(mag .* exp(1i*theta))); % 安全写入 end_pos = min(y_pos+n-1, expected_len); valid_len = end_pos - y_pos + 1; if valid_len > 0 y(y_pos:end_pos) = y(y_pos:end_pos) + y_frame(1:valid_len) .* hamming(valid_len); end % 更新位置 y_pos = y_pos + hop_out; end end % 安全帧提取函数 function [frame, valid] = safe_frame(x, start, len) if start < 1 || start+len-1 > length(x) frame = zeros(len, 1); if start < 1 valid_part = x(1:min(len+start-1, length(x))); frame(1-start+1:end) = valid_part; else valid_part = x(start:min(start+len-1, length(x))); frame(1:length(valid_part)) = valid_part; end valid = false; else frame = x(start:start+len-1); valid = true; end end % function [corrected, f0_corrected] = correct_pitch(fig, audio, fs, f0_src, f0_ref, time_src, time_ref) % % 创建进度条 % h = uiprogressdlg(fig, 'Title', '处理中', 'Message', '音高校正...'); % % frame_len = round(0.05 * fs); % 50ms帧长 % hop_size = round(0.025 * fs); % 25ms跳跃 % n_frames = floor((length(audio)-frame_len)/hop_size) + 1; % corrected = zeros(size(audio)); % f0_corrected = zeros(1, n_frames); % % % 创建参考音高插值函数 % valid_ref = f0_ref > 0; % if any(valid_ref) % ref_interp = @(t) interp1(time_ref(valid_ref), f0_ref(valid_ref), t, 'linear', 'extrap'); % else % ref_interp = @(t) 0; % end % % for i = 1:n_frames % % 计算当前帧位置 % start_idx = (i-1)*hop_size + 1; % end_idx = start_idx + frame_len - 1; % frame = audio(start_idx:end_idx); % % % 查找当前帧对应的目标音高 % t_frame = (start_idx + frame_len/2) / fs; % target_f0 = ref_interp(t_frame); % % if f0_src(i) > 0 && target_f0 > 0 % % 使用对数比例(音乐音高是几何级数) % semitone_diff = 12 * log2(target_f0 / f0_src(i)); % % % 限制最大校正范围(±12半音) % semitone_diff = max(-12, min(12, semitone_diff)); % % % 转换为频率比例 % target_ratio = 2^(semitone_diff/12); % % % 使用相位声码器 % corrected_frame = phase_vocoder(frame, target_ratio, fs); % % f0_corrected(i) = target_f0; % else % corrected_frame = frame; % f0_corrected(i) = f0_src(i); % end % % % % 重叠相加 % frame_end_idx = start_idx + length(corrected_frame) - 1; % if frame_end_idx <= length(corrected) % corrected(start_idx:frame_end_idx) = ... % corrected(start_idx:frame_end_idx) + corrected_frame .* hamming(length(corrected_frame)); % end % % % 更新进度条 % h.Value = i/n_frames; % h.Message = sprintf('处理进度: %d/%d 帧 (%.1f%%)', i, n_frames, i/n_frames*100); % end % % % === 关键修复 3: 数据格式处理 === % corrected = real(corrected); % 确保实数 % max_amp = max(abs(corrected)); % if max_amp > 0 % corrected = corrected / max_amp; % else % corrected = zeros(size(corrected)); % 处理全零情况 % end % if ~isa(corrected, 'double') % corrected = double(corrected); % end % % % 归一化防止削波 % max_amp = max(abs(corrected)); % if max_amp > 0 % corrected = corrected / max_amp; % end % % close(h); % end function plot_pitch_comparison(time_src, f0_src, time_ref, f0_ref, f0_corrected, src_wave, ref_wave, corr_wave, fs) % 确保所有序列长度一致 min_length = min([length(time_src), length(time_ref), length(f0_corrected)]); time_src = time_src(1:min_length); f0_src = f0_src(1:min_length); time_ref = time_ref(1:min_length); f0_ref = f0_ref(1:min_length); f0_corrected = f0_corrected(1:min_length); % 创建综合音高对比图(包含波形和音高) pitch_fig = figure('Name', '音频波形与音高分析', 'Position', [100 100 900 800]); % 原始音频波形 + 音高 subplot(3,1,1); time_wave_src = (1:length(src_wave)) / fs; yyaxis left; plot(time_wave_src, src_wave, 'Color', [0.7 0.7 1], 'LineWidth', 0.5); ylabel('幅度'); ylim([-1.1 1.1]); % 固定幅度范围 yyaxis right; plot(time_src, f0_src, 'b', 'LineWidth', 1.5); hold on; plot(time_ref, f0_ref, 'r--', 'LineWidth', 1.5); hold off; title('原始音频波形与音高'); xlabel('时间 (s)'); ylabel('频率 (Hz)'); legend('原始波形', '原始音高', '参考音高', 'Location', 'best'); grid on; % 参考音频波形 + 音高 subplot(3,1,2); time_wave_ref = (1:length(ref_wave)) / fs; yyaxis left; plot(time_wave_ref, ref_wave, 'Color', [1 0.7 0.7], 'LineWidth', 0.5); ylabel('幅度'); ylim([-1.1 1.1]); % 固定幅度范围 yyaxis right; plot(time_ref, f0_ref, 'r', 'LineWidth', 1.5); title('参考音频波形与音高'); xlabel('时间 (s)'); ylabel('频率 (Hz)'); legend('参考波形', '参考音高', 'Location', 'best'); grid on; % 矫正后音频波形 + 音高 subplot(3,1,3); time_wave_corr = (1:length(corr_wave)) / fs; yyaxis left; plot(time_wave_corr, corr_wave, 'Color', [0.7 1 0.7], 'LineWidth', 0.5); ylabel('幅度'); ylim([-1.1 1.1]); % 固定幅度范围 yyaxis right; plot(time_src, f0_src, 'b:', 'LineWidth', 1); hold on; plot(time_ref, f0_ref, 'r--', 'LineWidth', 1); plot(time_src, f0_corrected, 'g', 'LineWidth', 2); hold off; title('矫正后音频波形与音高'); xlabel('时间 (s)'); ylabel('频率 (Hz)'); legend('矫正波形', '原始音高', '参考音高', '矫正音高', 'Location', 'best'); grid on; % 添加音高误差分析 valid_idx = (f0_src > 0) & (f0_ref > 0) & (f0_corrected > 0); if any(valid_idx) src_error = mean(abs(f0_src(valid_idx) - f0_ref(valid_idx))); corr_error = mean(abs(f0_corrected(valid_idx) - f0_ref(valid_idx))); annotation(pitch_fig, 'textbox', [0.15 0.05 0.7 0.05], ... 'String', sprintf('原始音高平均误差: %.2f Hz | 矫正后音高平均误差: %.2f Hz | 改进: %.1f%%', ... src_error, corr_error, (src_error - corr_error)/src_error*100), ... 'FitBoxToText', 'on', 'BackgroundColor', [0.9 0.9 0.9], ... 'FontSize', 12, 'HorizontalAlignment', 'center'); end end function play_audio(fig, audio_type) if ~isvalid(fig) errordlg('主窗口无效!', '播放错误'); return; end switch audio_type case 'source' audio = fig.UserData.source_audio; title_text = '播放原始音频'; if isempty(audio) errordlg('未找到原始音频数据!', '播放错误'); return; end case 'corrected' audio = fig.UserData.corrected_audio; title_text = '播放矫正音频'; if isempty(audio) errordlg('请先完成音高校正!', '播放错误'); return; end otherwise return; end fs = fig.UserData.fs; player = audioplayer(audio, fs); % 创建播放控制界面 play_fig = uifigure('Name', title_text, 'Position', [500 500 300 150]); % 播放进度条 ax = uiaxes(play_fig, 'Position', [50 100 200 20]); hold(ax, 'on'); prog_line = plot(ax, [0 0], [0 1], 'b', 'LineWidth', 2); % 垂直范围[0,1] hold(ax, 'off'); xlim(ax, [0 1]); ylim(ax, [0 1]); set(ax, 'XTick', [], 'YTick', []); % 播放时间显示 time_label = uilabel(play_fig, 'Position', [50 80 200 20], ... 'Text', '00:00 / 00:00', 'HorizontalAlignment', 'center'); % 控制按钮 uibutton(play_fig, 'Position', [50 30 60 30], 'Text', '播放', ... 'ButtonPushedFcn', @(btn,event) play(player)); uibutton(play_fig, 'Position', [120 30 60 30], 'Text', '暂停', ... 'ButtonPushedFcn', @(btn,event) pause(player)); uibutton(play_fig, 'Position', [190 30 60 30], 'Text', '停止', ... 'ButtonPushedFcn', @(btn,event) stop(player)); % 总时长计算 total_time = length(audio)/fs; mins = floor(total_time/60); secs = round(total_time - mins*60); total_str = sprintf('%02d:%02d', mins, secs); % 更新播放进度回调 player.TimerFcn = {@update_playback, play_fig, time_label, total_str, prog_line, length(audio)}; player.TimerPeriod = 0.1; % 更新频率(秒) player.StopFcn = @(src,event) stop_playback(src, event, play_fig); end function stop_playback(src, ~, fig) stop(src); if isvalid(fig) close(fig); end end function save_audio(fig) if ~isvalid(fig) || isempty(fig.UserData.corrected_audio) errordlg('无有效音频数据可保存!', '保存错误'); return; end % 获取所有相关数据 corrected_audio = fig.UserData.corrected_audio; f0_corrected = fig.UserData.f0_corrected; time_source = fig.UserData.time_source; fs = fig.UserData.original_fs; % 创建元数据结构 metadata = struct(); metadata.f0_corrected = f0_corrected; metadata.time_source = time_source; metadata.fs = fs; metadata.creation_date = datestr(now); metadata.pitch_correction_info = 'Generated by Audio Pitch Correction System'; % 提示用户保存 [file, path] = uiputfile({'*.wav', 'WAV文件 (*.wav)'; '*.mat', 'MATLAB数据文件 (*.mat)'}, ... '保存矫正音频和音高数据'); if isequal(file, 0), return; end filename = fullfile(path, file); [~, ~, ext] = fileparts(filename); if strcmpi(ext, '.wav') % 保存为WAV文件并嵌入元数据 audiowrite(filename, corrected_audio, fs, ... 'BitsPerSample', 24, ... 'Comment', jsonencode(metadata)); msgbox('音频和音高数据保存成功!', '完成'); elseif strcmpi(ext, '.mat') % 保存为MAT文件 save(filename, 'corrected_audio', 'f0_corrected', 'time_source', 'fs'); msgbox('完整数据保存成功!', '完成'); end end 显示Size输入必须为整数

我现在的代码已经能爬取一个品牌的数据了from DrissionPage import ChromiumPage from datetime import datetime import csv output_filename="A4.csv" filenames=["时间","价格","趋势","天数","价格变化","促销信息"] Pos='https://tool.manmanbuy.com/HistoryLowest.aspx?url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fdetail.tmall.com%2Fitem.htm%3Fdetail_redpacket_pop%3Dtrue%26id%3D559270244089%26ltk2%3D17477065512345huo1bwf9jdb36q0gzr0vj%26ns%3D1%26priceTId%3D2147830817477065254104592e1da0%26query%3D%25E5%25A4%258D%25E5%258D%25B0%25E7%25BA%25B8%26skuId%3D3650969450084%26spm%3Da21n57.1.hoverItem.1%26utparam%3D%257B%2522aplus_abtest%2522%253A%25226c72565727cd5802a7f34f1197aa9ecd%2522%257D%26xxc%3Dad_ztc' api='https://tool.manmanbuy.com/api.ashx' #数据接口 zdh=ChromiumPage() #初始化浏览器 zdh.get(Pos) #目标网页 zdh.listen.start(api) resp=zdh.listen.wait() data = resp.response.body def parse_price_history(data): date_price_str = data['data']['datePrice'].strip('[]"') #去除特殊字符 entries = [e.strip() for e in date_price_str.split('],[')] #分割数据成独立条目 price_history = [] for entry in entries: parts = entry.split(',', 2) # 最多分割2次,保留促销信息 if len(parts) < 2: continue timestamp = int(parts[0].strip(' "\'')) price = float(parts[1].strip(' "\'')) promotion = parts[2].strip(' "\'') if len(parts) > 2 else "" # 提取促销信息 dt = datetime.fromtimestamp(timestamp // 1000).strftime('%Y-%m-%d %H:%M:%S') #转换时间格式 price_history.append((dt, price, promotion)) # 保存促销信息 trends = [] for i in range(1, len(price_history)): prev_dt, prev_price, _ = price_history[i - 1] curr_dt, curr_price, promotion = price_history[i] price_diff = curr_price - prev_price trend = "上涨" if price_diff > 0 else "下跌" # 过滤持平情况 if abs(price_diff) < 0.01: continue # 跳过持平数据 delta = (datetime.strptime(curr_dt, '%Y-%m-%d %H:%M:%S') - datetime.strptime(prev_dt, '%Y-%m-%d %H:%M:%S')) days_diff = delta.days + delta.seconds / (24 * 3600) trends.append({ "时间": curr_dt, "价格": curr_price, "趋势": trend, "天数": round(days_diff, 2), "价格变化": round(price_diff, 2), "促销信息": promotion # 单独显示促销信息 }) return { "trend_analysis": trends, "latest_price": price_history[-1][1] if price_history else None } result = parse_price_history(data) if result and result["trend_analysis"]: print(f"最新价格: {result['latest_price']} 元") print("价格变动记录(过滤持平):") for change in result["trend_analysis"]: promo = f" | 促销: {change['促销信息']}" if change["促销信息"] else "" #若有促销信息则输出,若无则不输出 print( f"时间: {change['时间']} | 价格: {change['价格']} 元 | " f"趋势: {change['趋势']} | 距上次变动: {change['天数']} 天 | " f"变化: {change['价格变化']} 元{promo}" ) else: print("未检测到价格变动或数据异常") with open(output_filename,'w',newline='',encoding='utf-8-sig') as csvfile: csv_writer = csv.writer(csvfile) csv_writer.writerow(["时间","价格","趋势","距上次变动","变化","促销"]) #增加标头 for change in result["trend_analysis"]: data=[ change["时间"], change["价格"], change["趋势"], change["天数"], change["价格变化"], change["促销信息"] ] csv_writer.writerow(data) zdh.close()请帮我在原代码的基础上修改爬取多个品牌的相关数据

timi@timi--R7000P2021:~/PX4-Autopilot$ make px4_sitl gazebo [0/4] Performing build step for 'sitl_gazebo-classic' ninja: no work to do. [3/4] cd /home/timi/PX4-Autopilot/buil...i/PX4-Autopilot/build/px4_sitl_default SITL ARGS sitl_bin: /home/timi/PX4-Autopilot/build/px4_sitl_default/bin/px4 debugger: none model: iris world: none src_path: /home/timi/PX4-Autopilot build_path: /home/timi/PX4-Autopilot/build/px4_sitl_default GAZEBO_PLUGIN_PATH /home/timi/model_editor_models/Plugin_v0/build::/home/timi/PX4-Autopilot/build/px4_sitl_default/build_gazebo-classic GAZEBO_MODEL_PATH :/home/timi/PX4-Autopilot/Tools/sitl_gazebo/models:/home/timi/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models LD_LIBRARY_PATH /home/timi/PX4-Autopilot/build/px4_sitl_default/build_gazebo:/opt/ros/noetic/lib:/home/timi/catkin_ws/devel/lib:/opt/ros/noetic/lib:/opt/ros/noetic/lib/x86_64-linux-gnu:/home/timi/PX4-Autopilot/build/px4_sitl_default/build_gazebo-classic empty world, setting empty.world as default Using: /home/timi/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models/iris/iris.sdf Warning [parser.cc:833] XML Attribute[version] in element[sdf] not defined in SDF, ignoring. gzserver: symbol lookup error: /home/timi/PX4-Autopilot/build/px4_sitl_default/build_gazebo-classic/libgazebo_mavlink_interface.so: undefined symbol: _ZN8mav_msgs4msgs17CommandMotorSpeedC1Ev SITL COMMAND: "/home/timi/PX4-Autopilot/build/px4_sitl_default/bin/px4" "/home/timi/PX4-Autopilot/build/px4_sitl_default"/etc ______ __ __ ___ | ___ \ \ \ / / / | | |_/ / \ V / / /| | | __/ / \ / /_| | | | / /^\ \ \___ | \_| \/ \/ |_/ px4 starting. INFO [px4] startup script: /bin/sh etc/init.d-posix/rcS 0 INFO [init] found model autostart file as SYS_AUTOSTART=10015 INFO [param] selected parameter default file parameters.bson INFO [param] selected parameter backup file parameters_backup.bson SYS_AUTOCONFIG: curr: 0 -> new: 1 SYS_AUTOSTART: curr: 0 -> new: 10015 CAL_ACC0_ID: curr: 0 -> new: 1310988 CAL_GYRO0_ID: curr: 0 -> new: 1310988 CAL_ACC1_ID: curr: 0 -> new: 1310996 CAL_GYRO1_ID: curr: 0 -> new: 1310996 CAL_ACC2_ID: curr: 0 -> new: 1311004 CAL_GYRO2_ID: curr: 0 -> new: 1311004 CAL_MAG0_ID: curr: 0 -> new: 197388 CAL_MAG0_PRIO: curr: -1 -> new: 50 CAL_MAG1_ID: curr: 0 -> new: 197644 CAL_MAG1_PRIO: curr: -1 -> new: 50 SENS_BOARD_X_OFF: curr: 0.0000 -> new: 0.0000 SENS_DPRES_OFF: curr: 0.0000 -> new: 0.0010 INFO [dataman] data manager file './dataman' size is 1208528 bytes INFO [init] PX4_SIM_HOSTNAME: localhost INFO [simulator_mavlink] Waiting for simulator to accept connection on TCP port 4560 Gazebo multi-robot simulator, version 11.15.1 Copyright (C) 2012 Open Source Robotics Foundation. Released under the Apache 2 License. http://gazebosim.org # # ####### ####### ### ##### ####### ## # # # # # # # # # # # # # # # # # # # # # # # # # ##### # # # # # # # # # # ## # # # # # # # # # ####### # ### ##### ####### This version of Gazebo, now called Gazebo classic, reaches end-of-life in January 2025. Users are highly encouraged to migrate to the new Gazebo using our migration guides (https://gazebosim.org/docs/latest/gazebo_classic_migration/) [Msg] Waiting for master. [Err] [ConnectionManager.cc:121] Failed to connect to master in 30 seconds. [Err] [gazebo_shared.cc:106] Unable to initialize transport. [Err] [gazebo_client.cc:56] Unable to setup Gazebo

inline std::string RobotFormat(int level, const char *pformat, ...) { if (level > g_Logger->getLogLevel() || g_Logger->getLogLevel() == 9) { return std::string(""); } va_list argList; va_start(argList, pformat); char strBuf[MAX_LOG_SIZE] = {'\0'}; size_t num_of_chars = vsnprintf(strBuf, MAX_LOG_SIZE - 1, pformat, argList); va_end(argList); if(num_of_chars <= 0) { return std::string(""); } return std::string(strBuf); } #0 strlen () at ../sysdeps/arm/armv6t2/strlen.S:126 #1 0xb662827e in __vfprintf_internal (s=s@entry=0xaa268450, format=format@entry=0xb45291dc "handle time is out range (20*2ms, +)!!! handle_time_us = %ld, m_prev_handle_timestamp_us = %ld, curr_handle_timestamp_us = %ld, m_first_frame_ %s", ap=..., ap@entry=..., mode_flags=mode_flags@entry=0) at vfprintf-internal.c:1688 #2 0xb66339e6 in __vsnprintf_internal (string=0xaa268570 "handle time is out range (20*2ms, +)!!! handle_time_us = 0, m_prev_handle_timestamp_us = 54009, curr_handle_timestamp_us = 0, m_first_frame_ ", maxlen=<optimized out>, format=0xb45291dc "handle time is out range (20*2ms, +)!!! handle_time_us = %ld, m_prev_handle_timestamp_us = %ld, curr_handle_timestamp_us = %ld, m_first_frame_ %s", args=..., mode_flags=mode_flags@entry=0) at vsnprintf.c:114 #3 0xb6633a10 in ___vsnprintf (string=<optimized out>, maxlen=<optimized out>, format=<optimized out>, args=...) at vsnprintf.c:124 #4 0xb45efc94 in RobotFormat[abi:cxx11](int, char const*, ...) () from Plugins/libPeripheral.plg #5 0xb45245cc in communication::CSerialMessageHandle::handleSensorMessage(communication::CRobotPacket*) () from /home/lizewei/source/T10/robot2.0/build_ssd22d/bin/libStm32.so #6 0xb4525364 in communication::CSerialMessageHandle::handleMessage(communication::CRobotPacket*) () from /home/lizewei/source/T10/robot2.0/build_ssd22d/bin/libStm32.so #7 0xb45a0b38 in driver::Stm32Driver::readData() () from /home/lizewei/source/T10/robot2.0/build_ssd22d/bin/libDriver.so #8 0xb680e21a in std::execute_native_thread_routine (__p=0x14ebf08) at /home/meng/toolchain/build/snapshots/gcc.git~gcc-9_1_0-release/libstdc++-v3/src/c++11/thread.cc:80 #9 0xb65b1c00 in start_thread (arg=0x5b2bcd5) at pthread_create.c:479 #10 0xb667e61c in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:73 from /opt/ssd22d/arm-buildroot-linux-gnueabihf/sysroot/lib/libc.so.6

#include <stdio.h> #include<string.h> #include <stdlib.h> // 解决atoi未声明问题 #define MAX_STATES 20 #define MAX_SYMBOLS 10 // 函数原型声明 int get_token(FILE *fp); // 显式声明词法分析器 int char_to_symbol(char c); // 补充字符转换函数声明 // 终结符和非终结符编码 enum Symbol {a, b, c, d, e, S, A, B, END}; // END表示$ // LR(0)分析表结构 typedef struct { char action[MAX_STATES][MAX_SYMBOLS][10]; // ACTION表 int goto_table[MAX_STATES][MAX_SYMBOLS]; // GOTO表 } LRTable; // 产生式结构 typedef struct { int lhs; // 左部符号 int rhs_len; // 右部长度 int rhs[5]; // 右部符号数组 } Production; // 初始化给定文法的分析表[^3][^4] void init_table(LRTable *t) { // ACTION表配置(示例数据需根据实际DFA构造) strcpy(t->action[0][a], "s1"); strcpy(t->action[1][b], "s3"); strcpy(t->action[2][A], "2"); // GOTO状态2 // ...其他状态配置 // GOTO表配置 t->goto_table[0][S] = 5; t->goto_table[1][A] = 6; // ...其他转移配置 } // 产生式配置(示例) Production productions[] = { {S, 5, {a, A, c, B, e}}, // S → aAcBe {A, 1, {b}}, // A → b {A, 2, {A, b}}, // A → Ab {B, 1, {d}} // B → d }; // LR分析核心函数 int parse(FILE *input, LRTable *table) { int state_stack[MAX_STATES] = {0}; int state_top = 0; int lookahead = get_token(input); // 读取第一个词元 while(1) { int curr_state = state_stack[state_top]; char *action = table->action[curr_state][lookahead]; if(!action) return 0; // 错误处理 if(strcmp(action, "acc") == 0) return 1; if(action[0] == 's') { // 移进动作 int new_state = atoi(action+1); state_stack[++state_top] = new_state; lookahead = get_token(input); } else if(action[0] == 'r') { // 规约动作 int prod_num = atoi(action+1); Production p = productions[prod_num]; // 弹出右部长度个状态 state_top -= p.rhs_len; if(state_top < 0) return 0; // GOTO转移 int new_state = table->goto_table[state_stack[state_top]][p.lhs]; state_stack[++state_top] = new_state; } } } // 将字符转换为符号编码 int char_to_symbol(char c) { switch(c) { case 'a': return a; case 'b': return b; // ...其他符号转换 default: return -1; } } // 读取词元流 int get_token(FILE *fp) { char ch; if(fscanf(fp, "%c", &ch) == EOF) return END; return char_to_symbol(ch); } int main() { FILE *input = fopen("input.txt", "r"); FILE *output = fopen("output.txt", "w"); LRTable table; init_table(&table); int result = parse(input, &table); fprintf(output, result ? "true" : "false"); fclose(input); fclose(output); return 0; } 为什么我运行的时候就卡住,运行不了呢

import sys import math import csv import serial import time import numpy as np from typing import List from PyQt5.QtWidgets import (QApplication, QMainWindow, QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLabel, QLineEdit, QTextEdit, QFileDialog) from PyQt5.QtCore import QThread, pyqtSignal, Qt import matplotlib.pyplot as plt from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas 设置Matplotlib中文字体 plt.rcParams[‘font.sans-serif’] = [‘SimHei’] # 使用黑体显示中文 plt.rcParams[‘axes.unicode_minus’] = False # 正确显示负号 class AngleCalibrator: def init(self, com_port: str = ‘COM3’, baudrate: int = 9600): self.serial_config = { ‘port’: com_port, ‘baudrate’: baudrate, ‘timeout’: 1 } self.Kp = 1.0 # 比例系数 self.tolerance = 0.5 # 角度容差(度) def read_expected_angles(self, csv_path: str) -> List[float]: """读取CSV文件中的目标角度数据""" angles = [] try: with open(csv_path, 'r', encoding='utf-8-sig') as f: reader = csv.reader(f) next(reader) # 跳过标题行 for row in reader: if len(row) >= 2: try: angles.append(float(row[1])) except ValueError: print(f"无效数据行:{row}") return angles except Exception as e: print(f"文件读取失败:{str(e)}") return [] def _send_current(self, z: float, x: float) -> bool: """向电源发送电流指令(核心方法)""" try: with serial.Serial(**self.serial_config) as ser: # 设备初始化 ser.write(b'*CLS\n') # 清除状态 ser.write(b':SYST:REM\n') # 设置远程控制 time.sleep(0.1) # 发送电流指令 commands = [ f':SOUR1:CURR {z:.4f}\n'.encode(), f':SOUR2:CURR {x:.4f}\n'.encode(), b':OUTP ON\n' # 开启输出 ] # 执行指令并验证 success = True for cmd in commands: ser.write(cmd) time.sleep(0.1) if ser.in_waiting: response = ser.read(ser.in_waiting).decode() if 'ERROR' in response: print(f"指令错误:{cmd.decode().strip()}") success = False return success except serial.SerialException as e: print(f"串口连接异常:{str(e)}") return False except Exception as e: print(f"意外错误:{str(e)}") return False def _compute_components(self, angle: float) -> tuple: """计算指定角度的电流分量""" rad = math.radians(angle) z = max(-1.0, min(1.0, math.cos(rad))) x = max(-1.0, min(1.0, math.sin(rad))) return z, x class CalibrationThread(QThread): update_signal = pyqtSignal(float, float, float, float, float) # 目标角度,当前角度,误差,Z电流,X电流 status_signal = pyqtSignal(str) finished_signal = pyqtSignal() error_request = pyqtSignal() def __init__(self, calibrator, csv_path): super().__init__() self.calibrator = calibrator self.csv_path = csv_path self.is_paused = False self.is_stopped = False self.current_error = None self.current_target = None def run(self): angles = self.calibrator.read_expected_angles(self.csv_path) if not angles: self.status_signal.emit("无有效角度数据") return for target in angles: if self.is_stopped: break self.current_target = target current_angle = target # 初始理论角度设为目标角度 z, x = self.calibrator._compute_components(current_angle) self.update_signal.emit(target, current_angle, 0, z, x) while not self.is_stopped: if self.is_paused: self.msleep(100) continue # 请求误差输入 self.error_request.emit() while self.current_error is None and not self.is_stopped: self.msleep(100) if self.is_stopped: break error = self.current_error self.current_error = None # 计算实际角度(修正符号错误) actual = current_angle - error # 修改处1:改为加号 self.update_signal.emit(target, actual, error, *self.calibrator._compute_components(current_angle)) # 达标判断 if abs(actual - target) <= self.calibrator.tolerance: self.status_signal.emit(f"角度 {target}° 校准完成") break # 计算新理论角度(修正调整方向) delta = target - actual # 修改处2:计算目标与实际的差值 new_angle = current_angle + self.calibrator.Kp * delta # 修改处3:使用delta调整 z_new, x_new = self.calibrator._compute_components(new_angle) # 发送新电流值 if self.calibrator._send_current(z_new, x_new): current_angle = new_angle self.update_signal.emit(target, current_angle, error, z_new, x_new) self.status_signal.emit(f"调整到新角度:{new_angle:.2f}°") else: self.status_signal.emit("电流调整失败") self.finished_signal.emit() def set_error(self, error): self.current_error = error class CalibrationGUI(QMainWindow): def init(self): super().init() self.calibrator = AngleCalibrator() self.thread = None self.current_csv_path = None self.init_ui() self.init_plot() self.reset_data() def reset_data(self): self.time_data = [] self.target_data = [] self.actual_data = [] def init_ui(self): self.setWindowTitle("角度校准系统") self.setGeometry(100, 100, 1000, 800) main_widget = QWidget() layout = QHBoxLayout() # 控制面板 control_panel = QVBoxLayout() self.btn_start = QPushButton("开始校准") self.btn_restart = QPushButton("重新校准") self.btn_pause = QPushButton("暂停") self.btn_stop = QPushButton("停止") self.btn_start.clicked.connect(self.start_calibration) self.btn_restart.clicked.connect(self.restart_calibration) self.btn_pause.clicked.connect(self.toggle_pause) self.btn_stop.clicked.connect(self.stop_calibration) self.error_input = QLineEdit() self.btn_confirm = QPushButton("提交误差") self.btn_confirm.clicked.connect(self.confirm_error) self.status_display = QTextEdit() self.status_display.setReadOnly(True) control_panel.addWidget(self.btn_start) control_panel.addWidget(self.btn_restart) control_panel.addWidget(self.btn_pause) control_panel.addWidget(self.btn_stop) control_panel.addSpacing(20) control_panel.addWidget(QLabel("输入误差(°):")) control_panel.addWidget(self.error_input) control_panel.addWidget(self.btn_confirm) control_panel.addSpacing(20) control_panel.addWidget(QLabel("状态信息:")) control_panel.addWidget(self.status_display) # 可视化面板 vis_panel = QVBoxLayout() self.figure = plt.figure() self.canvas = FigureCanvas(self.figure) vis_panel.addWidget(self.canvas) # 数值显示 info_layout = QVBoxLayout() self.lbl_target = QLabel("目标角度:--") self.lbl_current = QLabel("当前角度:--") self.lbl_error = QLabel("测量误差:--") self.lbl_current_z = QLabel("Z轴电流:--") self.lbl_current_x = QLabel("X轴电流:--") for widget in [self.lbl_target, self.lbl_current, self.lbl_error, self.lbl_current_z, self.lbl_current_x]: info_layout.addWidget(widget) vis_panel.addLayout(info_layout) layout.addLayout(control_panel, 1) layout.addLayout(vis_panel, 2) main_widget.setLayout(layout) self.setCentralWidget(main_widget) self.btn_pause.setEnabled(False) self.btn_stop.setEnabled(False) self.btn_confirm.setEnabled(False) self.btn_restart.setEnabled(False) def init_plot(self): self.ax = self.figure.add_subplot(111) self.ax.set_title("角度变化趋势") self.ax.set_xlabel("调整次数") self.ax.set_ylabel("角度(°)") self.line_target, = self.ax.plot([], [], 'r-', label='目标角度') self.line_actual, = self.ax.plot([], [], 'b--', label='实际角度') self.ax.legend() self.canvas.draw() def start_calibration(self, path=None): if not path: path, _ = QFileDialog.getOpenFileName(self, "选择CSV文件", "", "CSV文件 (*.csv)") if not path: return self.current_csv_path = path self.reset_data() self.thread = CalibrationThread(self.calibrator, self.current_csv_path) self.thread.update_signal.connect(self.update_display) self.thread.status_signal.connect(self.show_status) self.thread.finished_signal.connect(self.on_finished) self.thread.error_request.connect(self.request_error_input) self.thread.start() self.btn_start.setEnabled(False) self.btn_restart.setEnabled(True) self.btn_pause.setEnabled(True) self.btn_stop.setEnabled(True) self.btn_confirm.setEnabled(False) def restart_calibration(self): if self.current_csv_path: self.stop_calibration() self.start_calibration(self.current_csv_path) def toggle_pause(self): if self.thread: self.thread.is_paused = not self.thread.is_paused self.btn_pause.setText("恢复" if self.thread.is_paused else "暂停") self.show_status("已暂停" if self.thread.is_paused else "已恢复") def stop_calibration(self): if self.thread: self.thread.is_stopped = True self.on_finished() def request_error_input(self): self.btn_confirm.setEnabled(True) self.error_input.setFocus() self.show_status("请测量并输入当前误差") def confirm_error(self): try: error = float(self.error_input.text()) self.thread.set_error(error) self.error_input.clear() self.btn_confirm.setEnabled(False) except ValueError: self.show_status("错误:请输入有效数字") def update_display(self, target, current, error, z, x): self.lbl_target.setText(f"目标角度:{target:.2f}°") self.lbl_current.setText(f"当前角度:{current:.2f}°") self.lbl_error.setText(f"测量误差:{error:.2f}°") self.lbl_current_z.setText(f"Z轴电流:{z:.4f}A") self.lbl_current_x.setText(f"X轴电流:{x:.4f}A") self.time_data.append(len(self.time_data)) self.target_data.append(target) self.actual_data.append(current) self.line_target.set_data(self.time_data, self.target_data) self.line_actual.set_data(self.time_data, self.actual_data) self.ax.relim() self.ax.autoscale_view() self.canvas.draw() def show_status(self, message): self.status_display.append(f"[{time.strftime('%H:%M:%S')}] {message}") def on_finished(self): self.btn_start.setEnabled(True) self.btn_restart.setEnabled(True) self.btn_pause.setEnabled(False) self.btn_stop.setEnabled(False) self.btn_confirm.setEnabled(False) self.show_status("校准过程已完成") if name == “main”: app = QApplication(sys.argv) window = CalibrationGUI() window.show() sys.exit(app.exec_())将上述代码中的P控制修改为PID控制

for (int cubeID = 0; cubeID < 8; ++cubeID) { getShareMCi << < gs, bs, 0, streamCompute >> > (dCacheVoxels, numFrameVoxels, dFrameVoxels, dFrameVoxelProperties, dFrameNeighborIndices, resolution, isovalue, d_point_data, d_voxel_data, d_valVoxelCount, d_triangleCount, d_effectVoxel, d_valtris_nums, MChash_table, cubeID); } MChash_table.clear(); print << <1, 1, 0, streamCompute >> > (d_valtris_nums); //curr_frameVoxelsToIndex.clear(); #ifdef MV_TRIANGLE_MESH_I clock_t t02 = clock(); MC_FUSE_CU_LOG_INFO("%s %d %s", "Average 1 time mc cal: ", t02 - t2, " ms."); #endif cudaStreamSynchronize(streamCompute); cudaMemcpyAsync(&valVoxelCount, d_valVoxelCount, sizeof(unsigned int), cudaMemcpyDeviceToHost, streamCopy); cudaMemcpyAsync(&triangleCount, d_triangleCount, sizeof(unsigned int), cudaMemcpyDeviceToHost, streamCopy); cudaMemcpyAsync(&h_effectVoxel, d_effectVoxel, sizeof(unsigned int), cudaMemcpyDeviceToHost, streamCopy); cudaStreamSynchronize(streamCopy); cudaMemcpyAsync(h_listPoint, d_point_data, triangleCount * 3 * sizeof(ListPoint), cudaMemcpyDeviceToHost, streamCopy); cudaMemcpyAsync(h_VoxelTriangle, d_voxel_data, triangleCount * sizeof(ListVoxel), cudaMemcpyDeviceToHost, streamCopy); cudaMemcpyAsync(h_valtris_nums, d_valtris_nums, valVoxelCount * sizeof(int), cudaMemcpyDeviceToHost, streamCopy); printf("%d %d %d, %d voxel num_points numFrameVoxels. triangleCount %d h_effectVoxel\n", valVoxelCount, triangleCount * 3, numFrameVoxels, triangleCount, h_effectVoxel); d_valtris_nums是有值的,为什么拷贝的h_valtris_nums 打印printf("%d %d %d %f %d %d h_valtris_nums\n", h_valtris_nums[0], h_valtris_nums[1], h_valtris_nums[2]却都是0呢

import sys import math import csv import serial import time from datetime import datetime from PyQt5.QtWidgets import * from PyQt5.QtCore import QThread, pyqtSignal # 将原始AngleCalibrator类直接包含在文件中 class AngleCalibrator: def __init__(self, com_port='COM3', baudrate=9600, Kp=1.0, Ki=0.1, Kd=0.05): self.serial_config = {'port': com_port, 'baudrate': baudrate, 'timeout': 1} self.Kp = Kp self.Ki = Ki self.Kd = Kd self.tolerance = 0.5 self.integral = 0.0 self.last_error = 0.0 self.last_time = None def read_expected_angles(self, csv_path): # 保持原方法实现... angles = [] try: with open(csv_path, 'r', encoding='utf-8-sig') as f: reader = csv.reader(f) next(reader) for row in reader: if len(row) >= 2: try: angles.append(float(row[1])) except ValueError: pass return angles except Exception as e: print(f"文件读取失败:{str(e)}") return [] def _send_current(self, z, x): # 保持原方法实现... try: with serial.Serial(**self.serial_config) as ser: ser.write(b'*CLS\n') ser.write(b':SYST:REM\n') time.sleep(0.1) commands = [ f':SOUR1:CURR {z:.4f}\n'.encode(), f':SOUR2:CURR {x:.4f}\n'.encode(), b':OUTP ON\n' ] for cmd in commands: ser.write(cmd) time.sleep(0.1) return True except Exception: return False def _compute_components(self, angle): # 保持原方法实现... rad = math.radians(angle) z = max(-1.0, min(1.0, math.cos(rad))) x = max(-1.0, min(1.0, math.sin(rad))) return z, x # 保持原来的CalibrationThread和MainWindow类实现... class CalibrationThread(QThread): update_signal = pyqtSignal(float, float, float, float, float) status_signal = pyqtSignal(str) request_input = pyqtSignal() completed = pyqtSignal() def __init__(self, csv_path, Kp, Ki, Kd): super().__init__() self.calibrator = AngleCalibrator(Kp=Kp, Ki=Ki, Kd=Kd) self.csv_path = csv_path self.paused = False self.stopped = False self.current_error = None def run(self): angles = self.calibrator.read_expected_angles(self.csv_path) if not angles: self.status_signal.emit("无有效角度数据") return for target in angles: if self.stopped: break self.status_signal.emit(f"正在处理目标角度: {target:.2f}°") current_angle = target self.calibrator.integral = 0.0 self.calibrator.last_error = 0.0 self.calibrator.last_time = None z, x = self.calibrator._compute_components(current_angle) if self.calibrator._send_current(z, x): self.update_signal.emit(target, current_angle, current_angle, z, x) while not self.stopped: if self.paused: time.sleep(0.5) continue self.request_input.emit() while self.current_error is None and not self.stopped: time.sleep(0.1) if self.stopped: break error = self.current_error self.current_error = None actual = current_angle - error now = datetime.now() dt = (now - self.calibrator.last_time).total_seconds() if self.calibrator.last_time else 0 self.calibrator.last_time = now error_val = target - actual self.calibrator.integral += error_val * dt derivative = (error_val - self.calibrator.last_error) / dt if dt > 0 else 0 adjustment = (self.calibrator.Kp * error_val + self.calibrator.Ki * self.calibrator.integral + self.calibrator.Kd * derivative) self.calibrator.last_error = error_val new_angle = current_angle + adjustment z_new, x_new = self.calibrator._compute_components(new_angle) if self.calibrator._send_current(z_new, x_new): current_angle = new_angle self.update_signal.emit(target, actual, new_angle, z_new, x_new) if abs(actual - target) <= self.calibrator.tolerance: break self.completed.emit() class MainWindow(QMainWindow): # 保持原MainWindow类实现... def __init__(self): super().__init__() self.initUI() self.thread = None def initUI(self): self.setWindowTitle("角度校准控制面板") self.setGeometry(100, 100, 800, 600) main_widget = QWidget() layout = QVBoxLayout() # 控制按钮区域 btn_layout = QHBoxLayout() self.start_btn = QPushButton("开始") self.pause_btn = QPushButton("暂停") self.stop_btn = QPushButton("停止") self.file_btn = QPushButton("选择CSV文件") btn_layout.addWidget(self.file_btn) btn_layout.addWidget(self.start_btn) btn_layout.addWidget(self.pause_btn) btn_layout.addWidget(self.stop_btn) # 数据显示区域 data_layout = QHBoxLayout() self.labels = { 'target': QLabel("目标角度: --"), 'actual': QLabel("实际角度: --"), 'corrected': QLabel("纠正角度: --"), 'z': QLabel("Z轴电流: --"), 'x': QLabel("X轴电流: --") } for label in self.labels.values(): data_layout.addWidget(label) # 输入区域 input_layout = QHBoxLayout() self.error_input = QLineEdit() self.submit_btn = QPushButton("提交误差") input_layout.addWidget(QLabel("测量误差:")) input_layout.addWidget(self.error_input) input_layout.addWidget(self.submit_btn) # 日志区域 self.log = QTextEdit() self.log.setReadOnly(True) layout.addLayout(btn_layout) layout.addLayout(data_layout) layout.addLayout(input_layout) layout.addWidget(self.log) main_widget.setLayout(layout) self.setCentralWidget(main_widget) # 连接信号 self.start_btn.clicked.connect(self.start_calibration) self.pause_btn.clicked.connect(self.toggle_pause) self.stop_btn.clicked.connect(self.stop_calibration) self.file_btn.clicked.connect(self.select_file) self.submit_btn.clicked.connect(self.submit_error) self.pause_btn.setEnabled(False) self.stop_btn.setEnabled(False) self.submit_btn.setEnabled(False) def select_file(self): path, _ = QFileDialog.getOpenFileName(self, "选择CSV文件", "", "CSV文件 (*.csv)") if path: self.csv_path = path self.log.append(f"已选择文件: {path}") def start_calibration(self): if not hasattr(self, 'csv_path'): QMessageBox.warning(self, "警告", "请先选择CSV文件") return self.thread = CalibrationThread( self.csv_path, Kp=1.2, Ki=0.2, Kd=0.1 ) self.thread.update_signal.connect(self.update_display) self.thread.status_signal.connect(self.log.append) self.thread.request_input.connect(self.enable_input) self.thread.completed.connect(self.on_completed) self.start_btn.setEnabled(False) self.pause_btn.setEnabled(True) self.stop_btn.setEnabled(True) self.thread.start() def toggle_pause(self): if self.thread.paused: self.thread.paused = False self.pause_btn.setText("暂停") self.log.append("继续校准...") else: self.thread.paused = True self.pause_btn.setText("继续") self.log.append("校准已暂停") def stop_calibration(self): if self.thread: self.thread.stopped = True self.thread.quit() self.log.append("校准已停止") self.reset_controls() def submit_error(self): try: error = float(self.error_input.text()) self.thread.current_error = error self.error_input.clear() self.submit_btn.setEnabled(False) except ValueError: QMessageBox.warning(self, "输入错误", "请输入有效数字") def enable_input(self): self.submit_btn.setEnabled(True) self.error_input.setFocus() def update_display(self, target, actual, corrected, z, x): self.labels['target'].setText(f"目标角度: {target:.2f}°") self.labels['actual'].setText(f"实际角度: {actual:.2f}°") self.labels['corrected'].setText(f"纠正角度: {corrected:.2f}°") self.labels['z'].setText(f"Z轴电流: {z:.4f}A") self.labels['x'].setText(f"X轴电流: {x:.4f}A") def on_completed(self): self.log.append("全部角度处理完成") self.reset_controls() def reset_controls(self): self.start_btn.setEnabled(True) self.pause_btn.setEnabled(False) self.stop_btn.setEnabled(False) self.submit_btn.setEnabled(False) self.pause_btn.setText("暂停") if __name__ == "__main__": app = QApplication(sys.argv) window = MainWindow() window.show() sys.exit(app.exec_())修改这段代码,将CH1和CH2通道的电压Vset都设置为10V

Line 18: 01-01 19:26:37.692480 1 1 E [ 14.908805]is_fastboot_adb_enabled: is_debuggable|cta|allcommode|aging test version,ingore Line 137: 01-01 19:26:38.165411 132 132 I [ 15.381736]wcd937x_codec wcd937x-codec: wcd_mbhc_start: usbc analog enabled Line 139: 01-01 19:26:38.165581 132 132 E [ 15.381906]wcd_mbhc_start: usbc_insert_pin in dt node is missing Line 462: 01-01 19:26:41.245371 902 902 I [ 18.461696]servicemanager: Caller(pid=2254,uid=0,sid=u:r:usbd:s0) Could not find android.hardware.usb.gadget.IUsbGadget/default in the VINTF manifest. No alternative instances declared in VINTF. Line 462: 01-01 19:26:41.245371 902 902 I [ 18.461696]servicemanager: Caller(pid=2254,uid=0,sid=u:r:usbd:s0) Could not find android.hardware.usb.gadget.IUsbGadget/default in the VINTF manifest. No alternative instances declared in VINTF. Line 462: 01-01 19:26:41.245371 902 902 I [ 18.461696]servicemanager: Caller(pid=2254,uid=0,sid=u:r:usbd:s0) Could not find android.hardware.usb.gadget.IUsbGadget/default in the VINTF manifest. No alternative instances declared in VINTF. Line 471: 01-01 19:26:41.384214 1 1 I [ 18.600539]: setusbconfig toadb Line 471: 01-01 19:26:41.384214 1 1 I [ 18.600539]: setusbconfig toadb Line 474: 01-01 19:26:41.397404 1705 1705 I [ 18.613729]msm-usb-hsphy 1613000.hsphy: Avail curr from USB = 2 Line 474: 01-01 19:26:41.397404 1705 1705 I [ 18.613729]msm-usb-hsphy 1613000.hsphy: Avail curr from USB = 2 Line 529: 01-01 19:26:41.659237 2423 2423 E [ 18.875562]: USB cable not connected Line 808: 01-01 19:26:45.895584 10 10 E [ 23.111909][kworke][0x22b3adb6][11:26:45.893158] wlan: [10:E:WMI] send_action_oui_cmd_tlv: Invalid action id Line 870: 01-01 19:26:51.533277 2386 2386 E [ 28.749602]: USB cable not connected Line 925: 01-01 19:26:55.678229 1 1 I [ 32.894554]init: processing action (vendor.sys.usb.adb.disabled=*) from (/system/etc/init/hw/init.usb.rc:23) Line 925: 01-01 19:26:55.678229 1 1 I [ 32.894554]init: processing action (vendor.sys.usb.adb.disabled=*) from (/system/etc/init/hw/init.usb.rc:23) Line 925: 01-01 19:26:55.678229 1 1 I [ 32.894554]init: processing action (vendor.sys.usb.adb.disabled=*) from (/system/etc/init/hw/init.usb.rc:23) Line 1076: 01-01 19:27:00.344412 3121 3121 W [ 37.560737]: stm_core(E) keyevent_handler(E) qcom_pm8008_regulator(E) ocp2130_bias(E) coresight(E) oplus_bsp_rfcablemonitor(E) oplus_secure_common(OE) oplus_security_keventupload(OE) qcom_vadc_common(E) icc_test(E) hung_task_enhance(E) oplus_mm_kevent(E) qti_battery_debug(E) oplus_bsp_fw_update(E) charger_ulog_glink(E) msm_tsens_driver(E) sps_drv(E) debugcc_sm6115(E) msm_geni_serial(E) usb_f_ccid(E) qcom_va_minidump(E) msm_lmh_dcvs(E) qpnp_lcdb_regulator(E) oplus_bsp_tp_custom(E) oplus_bsp_tp_notify(E) qcom_i2c_pmic(E) oplus_resctrl(E) ucsi_glink(E) oplus_bsp_sensor_feedback(E) init_watchdog(E) olc(E) hung_task_enh(E) pmic_glink_debug(E) oplus_exit_mm_optimize(E) bwmon(E) altmode_glink(E) oplus_bsp_mapped_protect(E) oplus_theia(E) phy_msm_qusb_v2(E) memlat(E) core_hang_detect(E) gpucc_sm6115(E) boot_stats(E) pmic_glink(E) rpm_master_stat(E) debugcc_khaje(E) dispcc_khaje(E) rq_stats(E) glink_pkt(E) cdsprm(E) oplus_bsp_dynamic_readahead(E) msm_gpi(E) cdsp_loader(E) eud(E) Line 1076: 01-01 19:27:00.344412 3121 3121 W [ 37.560737]: stm_core(E) keyevent_handler(E) qcom_pm8008_regulator(E) ocp2130_bias(E) coresight(E) oplus_bsp_rfcablemonitor(E) oplus_secure_common(OE) oplus_security_keventupload(OE) qcom_vadc_common(E) icc_test(E) hung_task_enhance(E) oplus_mm_kevent(E) qti_battery_debug(E) oplus_bsp_fw_update(E) charger_ulog_glink(E) msm_tsens_driver(E) sps_drv(E) debugcc_sm6115(E) msm_geni_serial(E) usb_f_ccid(E) qcom_va_minidump(E) msm_lmh_dcvs(E) qpnp_lcdb_regulator(E) oplus_bsp_tp_custom(E) oplus_bsp_tp_notify(E) qcom_i2c_pmic(E) oplus_resctrl(E) ucsi_glink(E) oplus_bsp_sensor_feedback(E) init_watchdog(E) olc(E) hung_task_enh(E) pmic_glink_debug(E) oplus_exit_mm_optimize(E) bwmon(E) altmode_glink(E) oplus_bsp_mapped_protect(E) oplus_theia(E) phy_msm_qusb_v2(E) memlat(E) core_hang_detect(E) gpucc_sm6115(E) boot_stats(E) pmic_glink(E) rpm_master_stat(E) debugcc_khaje(E) dispcc_khaje(E) rq_stats(E) glink_pkt(E) cdsprm(E) oplus_bsp_dynamic_readahead(E) msm_gpi(E) cdsp_loader(E) eud(E) Line 1078: 01-01 19:27:00.344518 3121 3121 W [ 37.560843]: gcc_khaje(E) oplus_bsp_task_sched(E) gcc_sm6115(E) mem_buf(E) qcom_dma_heaps(E) qseecom_dlkm(OE) oplus_kmsg_wb(E) phy_qcom_ufs_qmp_v3_660(E) phy_qcom_ufs_qrbtc_sdm845(E) phy_qcom_ufs_qmp_v4_khaje(E) qrtr(E) qcom_glink(E) qnoc_bengal(E) qcom_soc_wdt(E) ua_cpu_ioctl(E) smp2p(E) ufshcd_crypto_qti(E) usbpd(E) clk_qcom(E) crypto_qti_common(E) dcc_v2(E) device_info(E) icc_rpm(E) mem_buf_dev(E) oplus_bsp_frame_boost(E) mem_offline(E) memory_dump_v2(E) msm_poweroff(E) oplus_phoenix(E) pinctrl_bengal(E) oplus_schedinfo(E) qcom_iommu_util(E) phy_qcom_ufs(E) oplus_pmicwd(E) pinctrl_khaje(E) qcom_ipc_logging(E) qcom_logbuf_vh(E) rpm_smd_regulator(E) qcom_wdt_core(E) boot_mode(E) gdsc_regulator(E) crypto_qti_tz(E) minidump(E) oplus_bsp_sched_assist(E) oplus_project(E) oplus_mdmfeature(E) oplus_uprobe(E) pinctrl_msm(E) phoenix_reboot_speed(E) qcom_cpufreq_hw(E) qcom_spmi_pmic(E) qcom_smd(E) secure_buffer(E) socinfo(E) rpm_smd(E) qpnp_power_on(E) stub_regulator(E) Line 1079: 01-01 19:27:00.344580 3121 3121 W [ 37.560905]: buildvariant(E) bootloader_log(E) debug_regulator(E) cdt_integrity(E) iommu_logger(E) icc_debug(E) horae_shell_temp(E) kernel_fb(E) msm_dma_iommu_mapping(E) last_boot_reason(E) oplus_bsp_eas_opt(E) nvmem_qcom_spmi_sdam(E) nvmem_qfprom(E) oplus_bsp_midas(E) oplus_bsp_task_cpustats(E) oplus_bsp_mm_osvelte(E) oplus_bsp_task_load(E) oplus_storage_log(E) oplus_fdleak_check(E) oplus_power_notifier(E) oplus_omrg(E) oplus_ftm_mode(E) soc_sleep_stats(E) oplus_mdmrst(E) oplusboot(E) proxy_consumer(E) qcom_apcs_ipc_mailbox(E) smem(E) qcom_dcvs(E) qcom_cpu_vendor_hooks(E) qcom_enhance_watchdog(E) qcom_mpm(E) qcom_pmu_lib(E) qcom_scm(E) qnoc_qos_rpm(E) qrng_dlkm(OE) regmap_spmi(E) qti_regmap_debugfs(E) sdcardfs(E) shutdown_speed(E) spmi_pmic_arb(E) slimbus(E) qcom_hwspinlock(E) Line 1546: 01-01 19:27:22.292131 4918 4918 W [ 59.508456]: Modules linked in: camera(OE) machine_dlkm(OE) wcd937x_dlkm(OE) mbhc_dlkm(OE) fsa4480_i2c(E) oplus_chg_symbol(E) wlan(OE) ipa_clientsm(OE) rndisipam(OE) ipanetm(OE) oplus_chg(E) ipam(OE) rx_macro_dlkm(OE) va_macro_dlkm(OE) tx_macro_dlkm(OE) wcd9xxx_dlkm(OE) pinctrl_lpi_dlkm(OE) adsp_loader_dlkm(OE) audio_pkt_dlkm(OE) swr_ctrl_dlkm(OE) audio_prm_dlkm(OE) bolero_cdc_dlkm(OE) coresight_tmc(E) spf_core_dlkm(OE) gpr_dlkm(OE) usb_f_gsi(E) usb_f_qdss(E) q6_notifier_dlkm(OE) oplus_audio_sipa_tuning(OE) leds_qti_flash(E) oplus_bsp_tp_ft3658u_spi(E) oplus_bsp_tp_ft3419u(E) oplus_bsp_tp_td4377_noflash(E) rmnet_wlan(OE) oplus_bsp_tp_ft3518(E) wcd937x_slave_dlkm(OE) qcom_pon(E) oplus_bsp_tp_ilitek7807s(E) oplus_chg_v2(E) tcpc_rt1711h(E) tcpci_late_sync(E) nxp_nci(OE) oplus_audio_aw87xxx(OE) oplus_bsp_tp_focal_common(E) oplus_network_linkpower_module(OE) bt_fm_slim(OE) coresight_hwevent(E) coresight_tpdm(E) icnss2(OE) nq330(E) dump_reason(E) wsa881x_analog_dlkm(OE) Line 1546: 01-01 19:27:22.292131 4918 4918 W [ 59.508456]: Modules linked in: camera(OE) machine_dlkm(OE) wcd937x_dlkm(OE) mbhc_dlkm(OE) fsa4480_i2c(E) oplus_chg_symbol(E) wlan(OE) ipa_clientsm(OE) rndisipam(OE) ipanetm(OE) oplus_chg(E) ipam(OE) rx_macro_dlkm(OE) va_macro_dlkm(OE) tx_macro_dlkm(OE) wcd9xxx_dlkm(OE) pinctrl_lpi_dlkm(OE) adsp_loader_dlkm(OE) audio_pkt_dlkm(OE) swr_ctrl_dlkm(OE) audio_prm_dlkm(OE) bolero_cdc_dlkm(OE) coresight_tmc(E) spf_core_dlkm(OE) gpr_dlkm(OE) usb_f_gsi(E) usb_f_qdss(E) q6_notifier_dlkm(OE) oplus_audio_sipa_tuning(OE) leds_qti_flash(E) oplus_bsp_tp_ft3658u_spi(E) oplus_bsp_tp_ft3419u(E) oplus_bsp_tp_td4377_noflash(E) rmnet_wlan(OE) oplus_bsp_tp_ft3518(E) wcd937x_slave_dlkm(OE) qcom_pon(E) oplus_bsp_tp_ilitek7807s(E) oplus_chg_v2(E) tcpc_rt1711h(E) tcpci_late_sync(E) nxp_nci(OE) oplus_audio_aw87xxx(OE) oplus_bsp_tp_focal_common(E) oplus_network_linkpower_module(OE) bt_fm_slim(OE) coresight_hwevent(E) coresight_tpdm(E) icnss2(OE) nq330(E) dump_reason(E) wsa881x_analog_dlkm(OE) Line 1548: 01-01 19:27:22.292323 4918 4918 W [ 59.508648]: oplus_networks_tuning(OE) pm8941_pwrkey(E) coresight_remote_etm(E) leds_aw2023(E) qti_qmi_sensor(E) usb_f_diag(E) rt_regmap(E) bcl_soc(E) cpu_hotplug(E) cnss_prealloc(OE) qcom_spmi_temp_alarm(E) oplus_security_guard(OE) qcom_spmi_adc_tm5(E) reboot_mode(E) regulator_cdev(E) i2c_msm_geni(E) qcom_iommu_debug(E) oplus_bsp_tp_ilitek_common(E) qrtr_smd(E) thermal_pause(E) ehset(E) msm_mmrm(OE) leds_qpnp_vibrator_ldo(E) ufcs_class(E) cpufreq_ondemand(E) game_opt(OE) coresight_tgu(E) oplus_data_module(OE) stm_console(E) oplus_audio_pa_manager(OE) qcom_pil_info(E) phy_msm_ssusb_qmp(E) msm_sharedmem(E) oplus_stability_helper(OE) phy_msm_qusb(E) iolimit(E) pmic_monitor(E) spi_msm_geni(E) qcom_spmi_adc5(E) oplus_bsp_memleak_detect(OE) ipa_fmwk(E) msm_qmp(E) oplus_bsp_ir_core(E) qfprom_sys(E) cx_ipeak(E) oplus_bsp_dfr_ubt(E) guestvm_loader(E) qcom_cpufreq_hw_debug(E) rpm_smd_debug(E) leds_qpnp_flash_v2(E) tz_log_dlkm(OE) oplus_game_first(OE) shutdown_detect(E) Line 1548: 01-01 19:27:22.292323 4918 4918 W [ 59.508648]: oplus_networks_tuning(OE) pm8941_pwrkey(E) coresight_remote_etm(E) leds_aw2023(E) qti_qmi_sensor(E) usb_f_diag(E) rt_regmap(E) bcl_soc(E) cpu_hotplug(E) cnss_prealloc(OE) qcom_spmi_temp_alarm(E) oplus_security_guard(OE) qcom_spmi_adc_tm5(E) reboot_mode(E) regulator_cdev(E) i2c_msm_geni(E) qcom_iommu_debug(E) oplus_bsp_tp_ilitek_common(E) qrtr_smd(E) thermal_pause(E) ehset(E) msm_mmrm(OE) leds_qpnp_vibrator_ldo(E) ufcs_class(E) cpufreq_ondemand(E) game_opt(OE) coresight_tgu(E) oplus_data_module(OE) stm_console(E) oplus_audio_pa_manager(OE) qcom_pil_info(E) phy_msm_ssusb_qmp(E) msm_sharedmem(E) oplus_stability_helper(OE) phy_msm_qusb(E) iolimit(E) pmic_monitor(E) spi_msm_geni(E) qcom_spmi_adc5(E) oplus_bsp_memleak_detect(OE) ipa_fmwk(E) msm_qmp(E) oplus_bsp_ir_core(E) qfprom_sys(E) cx_ipeak(E) oplus_bsp_dfr_ubt(E) guestvm_loader(E) qcom_cpufreq_hw_debug(E) rpm_smd_debug(E) leds_qpnp_flash_v2(E) tz_log_dlkm(OE) oplus_game_first(OE) shutdown_detect(E) Line 1548: 01-01 19:27:22.292323 4918 4918 W [ 59.508648]: oplus_networks_tuning(OE) pm8941_pwrkey(E) coresight_remote_etm(E) leds_aw2023(E) qti_qmi_sensor(E) usb_f_diag(E) rt_regmap(E) bcl_soc(E) cpu_hotplug(E) cnss_prealloc(OE) qcom_spmi_temp_alarm(E) oplus_security_guard(OE) qcom_spmi_adc_tm5(E) reboot_mode(E) regulator_cdev(E) i2c_msm_geni(E) qcom_iommu_debug(E) oplus_bsp_tp_ilitek_common(E) qrtr_smd(E) thermal_pause(E) ehset(E) msm_mmrm(OE) leds_qpnp_vibrator_ldo(E) ufcs_class(E) cpufreq_ondemand(E) game_opt(OE) coresight_tgu(E) oplus_data_module(OE) stm_console(E) oplus_audio_pa_manager(OE) qcom_pil_info(E) phy_msm_ssusb_qmp(E) msm_sharedmem(E) oplus_stability_helper(OE) phy_msm_qusb(E) iolimit(E) pmic_monitor(E) spi_msm_geni(E) qcom_spmi_adc5(E) oplus_bsp_memleak_detect(OE) ipa_fmwk(E) msm_qmp(E) oplus_bsp_ir_core(E) qfprom_sys(E) cx_ipeak(E) oplus_bsp_dfr_ubt(E) guestvm_loader(E) qcom_cpufreq_hw_debug(E) rpm_smd_debug(E) leds_qpnp_flash_v2(E) tz_log_dlkm(OE) oplus_game_first(OE) shutdown_detect(E) Line 1549: 01-01 19:27:22.292414 4918 4918 W [ 59.508739]: qti_qmi_cdev(E) rpm_smd_cooling_device(E) rtc_pm8xxx(E) uff_fp_driver(E) bcl_pmic5(E) oplus_nfc(E) oplus_bsp_tp_comon(E) oplus_wifismartantenna(OE) qcom_sysmon(E) oplus_camera_wl2868c(E) oplus_stats_calc(OE) msm_performance(E) usb_f_cdev(E) dump_device_info(E) aw_breath_algorithm(E) frpc_adsprpc(E) qcom_lpm(E) phy_msm_snps_hs(E) f_fs_ipc_log(E) phy_qcom_emu(E) oplus_io_monitor(E) oplus_score(OE) coresight_stm(E) coresight_replicator(E) wcd_core_dlkm(OE) test_kit(E) refgen(E) qti_devfreq_cdev(E) wl2866d_regulator(E) oplus_sensor(E) q6_dlkm(OE) aw37004_regulator(E) fan53870(E) lmh_cpu_vdd_cdev(E) oplus_mm_kevent_fb(E) snd_usb_audio_qmi(E) cnss_utils(OE) q6_pdr_dlkm(OE) sg(E) oplus_freeze_process(OE) rdbg(E) oplus_binder_strategy(E) oplus_app_monitor(OE) snd_event_dlkm(OE) oplus_secure_harden(OE) oplus_qr_scan(OE) dispcc_sm6115(E) qcom_ramdump(E) qpnp_pdphy(E) pd_dbg_info(E) usb_bam(E) stm_p_basic(E) ordump(E) cfg80211(E) phy_generic(E) combkey_monitor(E) Line 1549: 01-01 19:27:22.292414 4918 4918 W [ 59.508739]: qti_qmi_cdev(E) rpm_smd_cooling_device(E) rtc_pm8xxx(E) uff_fp_driver(E) bcl_pmic5(E) oplus_nfc(E) oplus_bsp_tp_comon(E) oplus_wifismartantenna(OE) qcom_sysmon(E) oplus_camera_wl2868c(E) oplus_stats_calc(OE) msm_performance(E) usb_f_cdev(E) dump_device_info(E) aw_breath_algorithm(E) frpc_adsprpc(E) qcom_lpm(E) phy_msm_snps_hs(E) f_fs_ipc_log(E) phy_qcom_emu(E) oplus_io_monitor(E) oplus_score(OE) coresight_stm(E) coresight_replicator(E) wcd_core_dlkm(OE) test_kit(E) refgen(E) qti_devfreq_cdev(E) wl2866d_regulator(E) oplus_sensor(E) q6_dlkm(OE) aw37004_regulator(E) fan53870(E) lmh_cpu_vdd_cdev(E) oplus_mm_kevent_fb(E) snd_usb_audio_qmi(E) cnss_utils(OE) q6_pdr_dlkm(OE) sg(E) oplus_freeze_process(OE) rdbg(E) oplus_binder_strategy(E) oplus_app_monitor(OE) snd_event_dlkm(OE) oplus_secure_harden(OE) oplus_qr_scan(OE) dispcc_sm6115(E) qcom_ramdump(E) qpnp_pdphy(E) pd_dbg_info(E) usb_bam(E) stm_p_basic(E) ordump(E) cfg80211(E) phy_generic(E) combkey_monitor(E) Line 1549: 01-01 19:27:22.292414 4918 4918 W [ 59.508739]: qti_qmi_cdev(E) rpm_smd_cooling_device(E) rtc_pm8xxx(E) uff_fp_driver(E) bcl_pmic5(E) oplus_nfc(E) oplus_bsp_tp_comon(E) oplus_wifismartantenna(OE) qcom_sysmon(E) oplus_camera_wl2868c(E) oplus_stats_calc(OE) msm_performance(E) usb_f_cdev(E) dump_device_info(E) aw_breath_algorithm(E) frpc_adsprpc(E) qcom_lpm(E) phy_msm_snps_hs(E) f_fs_ipc_log(E) phy_qcom_emu(E) oplus_io_monitor(E) oplus_score(OE) coresight_stm(E) coresight_replicator(E) wcd_core_dlkm(OE) test_kit(E) refgen(E) qti_devfreq_cdev(E) wl2866d_regulator(E) oplus_sensor(E) q6_dlkm(OE) aw37004_regulator(E) fan53870(E) lmh_cpu_vdd_cdev(E) oplus_mm_kevent_fb(E) snd_usb_audio_qmi(E) cnss_utils(OE) q6_pdr_dlkm(OE) sg(E) oplus_freeze_process(OE) rdbg(E) oplus_binder_strategy(E) oplus_app_monitor(OE) snd_event_dlkm(OE) oplus_secure_harden(OE) oplus_qr_scan(OE) dispcc_sm6115(E) qcom_ramdump(E) qpnp_pdphy(E) pd_dbg_info(E) usb_bam(E) stm_p_basic(E) ordump(E) cfg80211(E) phy_generic(E) combkey_monitor(E) Line 1550: 01-01 19:27:22.292523 4918 4918 W [ 59.508848]: stm_core(E) keyevent_handler(E) qcom_pm8008_regulator(E) ocp2130_bias(E) coresight(E) oplus_bsp_rfcablemonitor(E) oplus_secure_common(OE) oplus_security_keventupload(OE) qcom_vadc_common(E) icc_test(E) hung_task_enhance(E) oplus_mm_kevent(E) qti_battery_debug(E) oplus_bsp_fw_update(E) charger_ulog_glink(E) msm_tsens_driver(E) sps_drv(E) debugcc_sm6115(E) msm_geni_serial(E) usb_f_ccid(E) qcom_va_minidump(E) msm_lmh_dcvs(E) qpnp_lcdb_regulator(E) oplus_bsp_tp_custom(E) oplus_bsp_tp_notify(E) qcom_i2c_pmic(E) oplus_resctrl(E) ucsi_glink(E) oplus_bsp_sensor_feedback(E) init_watchdog(E) olc(E) hung_task_enh(E) pmic_glink_debug(E) oplus_exit_mm_optimize(E) bwmon(E) altmode_glink(E) oplus_bsp_mapped_protect(E) oplus_theia(E) phy_msm_qusb_v2(E) memlat(E) core_hang_detect(E) gpucc_sm6115(E) boot_stats(E) pmic_glink(E) rpm_master_stat(E) debugcc_khaje(E) dispcc_khaje(E) rq_stats(E) glink_pkt(E) cdsprm(E) oplus_bsp_dynamic_readahead(E) msm_gpi(E) cdsp_loader(E) eud(E) Line 1550: 01-01 19:27:22.292523 4918 4918 W [ 59.508848]: stm_core(E) keyevent_handler(E) qcom_pm8008_regulator(E) ocp2130_bias(E) coresight(E) oplus_bsp_rfcablemonitor(E) oplus_secure_common(OE) oplus_security_keventupload(OE) qcom_vadc_common(E) icc_test(E) hung_task_enhance(E) oplus_mm_kevent(E) qti_battery_debug(E) oplus_bsp_fw_update(E) charger_ulog_glink(E) msm_tsens_driver(E) sps_drv(E) debugcc_sm6115(E) msm_geni_serial(E) usb_f_ccid(E) qcom_va_minidump(E) msm_lmh_dcvs(E) qpnp_lcdb_regulator(E) oplus_bsp_tp_custom(E) oplus_bsp_tp_notify(E) qcom_i2c_pmic(E) oplus_resctrl(E) ucsi_glink(E) oplus_bsp_sensor_feedback(E) init_watchdog(E) olc(E) hung_task_enh(E) pmic_glink_debug(E) oplus_exit_mm_optimize(E) bwmon(E) altmode_glink(E) oplus_bsp_mapped_protect(E) oplus_theia(E) phy_msm_qusb_v2(E) memlat(E) core_hang_detect(E) gpucc_sm6115(E) boot_stats(E) pmic_glink(E) rpm_master_stat(E) debugcc_khaje(E) dispcc_khaje(E) rq_stats(E) glink_pkt(E) cdsprm(E) oplus_bsp_dynamic_readahead(E) msm_gpi(E) cdsp_loader(E) eud(E) Line 1552: 01-01 19:27:22.292697 4918 4918 W [ 59.509022]: gcc_khaje(E) oplus_bsp_task_sched(E) gcc_sm6115(E) mem_buf(E) qcom_dma_heaps(E) qseecom_dlkm(OE) oplus_kmsg_wb(E) phy_qcom_ufs_qmp_v3_660(E) phy_qcom_ufs_qrbtc_sdm845(E) phy_qcom_ufs_qmp_v4_khaje(E) qrtr(E) qcom_glink(E) qnoc_bengal(E) qcom_soc_wdt(E) ua_cpu_ioctl(E) smp2p(E) ufshcd_crypto_qti(E) usbpd(E) clk_qcom(E) crypto_qti_common(E) dcc_v2(E) device_info(E) icc_rpm(E) mem_buf_dev(E) oplus_bsp_frame_boost(E) mem_offline(E) memory_dump_v2(E) msm_poweroff(E) oplus_phoenix(E) pinctrl_bengal(E) oplus_schedinfo(E) qcom_iommu_util(E) phy_qcom_ufs(E) oplus_pmicwd(E) pinctrl_khaje(E) qcom_ipc_logging(E) qcom_logbuf_vh(E) rpm_smd_regulator(E) qcom_wdt_core(E) boot_mode(E) gdsc_regulator(E) crypto_qti_tz(E) minidump(E) oplus_bsp_sched_assist(E) oplus_project(E) oplus_mdmfeature(E) oplus_uprobe(E) pinctrl_msm(E) phoenix_reboot_speed(E) qcom_cpufreq_hw(E) qcom_spmi_pmic(E) qcom_smd(E) secure_buffer(E) socinfo(E) rpm_smd(E) qpnp_power_on(E) stub_regulator(E) 这个是对应时间的kernel日志

大家在看

recommend-type

文星小标宋字体

文星小标宋题字体下载,大家可以无需积分下载,旨在分享。
recommend-type

2000-2022年全国省份农业绿色全要素生产率:超效率SBM投入导向VRS/非期望产出SBM投入导向(全新整理)

1、资源内容地址:https://blog.csdn.net/2301_79696294/article/details/141441843 2、代码特点:今年全新,手工精心整理,放心引用,数据来自权威,相对于其他人的控制变量数据准确很多,适合写论文做实证用 ,不会出现数据造假问题 3、适用对象:大学生,本科生,研究生小白可用,容易上手!!! 3、课程引用: 经济学,地理学,城市规划与城市研究,公共政策与管理,社会学,商业与管理 ## 数据指标说明 资源名称:农业绿色全要素生产率 省份层面数据时间:2003-2022年 农业绿色全要素生产率 超效率SBM投入导向VRS/非期望产出SBM投入导向 变量指标 指标说明 资本投入 农业全社会固定资产投资额(亿元)最新2022年版! 劳动投入 农业从业人员数(万人) 土地资源投入 农作物播种面积(千公顷) 灌溉投入 有效灌溉面积(千公顷) 农药投入 农药施用量(万吨) 化肥投入 化肥施用(折纯)量(万吨) 农膜投入 农膜使用量(
recommend-type

宏碁Acer 4741G驱动合集 for winxp 官方版_宏碁个人笔记本XP驱动

宏碁Acer4741G驱动合集包含了显卡、网卡、声卡等驱动,都是xp版本,因为笔记本自带win7系统,有想要装xp系统的就需要这个驱动包。哈哈,买回来的Acer4741G,宏基的本本,性价比高,I5的CPU才4K多点,系统是win7家庭版,感觉还是XP好用,就要换回来了,想把驱动找全,欢迎下载体验
recommend-type

java读取kml文件数据

自己做的用java读取kml文件数据,并保存为json文件。方便其它地方解析。
recommend-type

无线系统中的微波与射频.rar

电子科技大学,研究生专业选修课矩无线系统中的微波与射频ppt,压缩包内包含无线系统中的微波与射频全部章节ppt。供电子科大研究生学习复习使用,请勿乱传。

最新推荐

recommend-type

基于微信小程序的社区垃圾回收管理-基于微信小程序的社区垃圾回收管理系统-基于微信小程序的社区垃圾回收管理系统源码-基于微信小程序的社区垃圾回收管理管理系统-基于微信小程序的社区垃圾回收管理管理系统ja

基于微信小程序的社区垃圾回收管理-基于微信小程序的社区垃圾回收管理系统-基于微信小程序的社区垃圾回收管理系统源码-基于微信小程序的社区垃圾回收管理管理系统-基于微信小程序的社区垃圾回收管理管理系统java代码-基于微信小程序的社区垃圾回收管理系统设计与实现-基于ssm的基于微信小程序的社区垃圾回收管理系统-基于Web的基于微信小程序的社区垃圾回收管理系统设计与实现-基于微信小程序的社区垃圾回收管理网站-基于微信小程序的社区垃圾回收管理网站代码-基于微信小程序的社区垃圾回收管理平台-基于微信小程序的社区垃圾回收管理平台代码-基于微信小程序的社区垃圾回收管理项目-基于微信小程序的社区垃圾回收管理项目代码-基于微信小程序的社区垃圾回收管理代码
recommend-type

Info2007v1.0更新至v2.0:优化管理与前台功能

根据提供的文件信息,可以挖掘出以下知识点: ### 标题知识点: 1. **免费时代WEB程序INFO2007 V1.0:** - 该标题表明存在一个名为INFO2007的WEB程序版本1.0,该版本是在免费时代推出的,可能意味着该程序是开源的或者提供免费下载。 ### 描述知识点: 1. **软件缺陷说明:** - 开发者提到程序存在BUG(程序缺陷),并提供了一个更新和反馈的渠道,说明软件仍在开发中,且有后续版本计划。 2. **联系方式:** - 开发者提供了QQ和邮箱作为联系方式,用于反馈问题或询问更新情况。 3. **Info2007v2.0更新内容:** - 提及了升级后的版本INFO2007v2.0新增功能,包括数据库结构变化(添加会员和公告表)、后台管理功能的增加与优化、前台功能的增加与优化等。 4. **安装要求:** - 软件需要特定的服务器环境支持,比如FSO(文件系统对象)、数据采集功能和JMAIL(邮件发送组件)。 5. **配置与安装细节:** - 对config.asp下的目录配置和pageurlsa变量做了说明,这些通常涉及程序的运行环境和安全设置。 6. **默认登录信息:** - 提供了默认的管理员用户名和密码,以及后台管理的默认目录,这对于安装和测试程序很重要。 7. **使用前的必要步骤:** - 强调了解压后生成静态页面的重要性,这可能是确保网站内容可被正确浏览的前置操作。 ### 标签知识点: 1. **ASP源码其他类别:** - 这表明该程序使用ASP(Active Server Pages)作为后端编程语言,并且归类于其他类别,可能意味着它不局限于某一特定功能或领域。 ### 压缩包文件名称列表知识点: 1. **www.codejia.com:** - 这个文件名可能指示了程序被托管或下载的来源网站,也暗示了可能含有与网站域名相关的程序文件。 ### 综合知识点: 1. **软件开发与维护:** - 从描述中可以看出开发者在推动软件的持续改进,并鼓励用户参与软件的测试和反馈过程。 2. **软件环境配置:** - 软件对运行环境有所要求,特别是服务器端的支持,需要了解FSO、数据采集、JMAIL等组件的使用和配置。 3. **后台管理系统:** - 更新内容中提及的后台管理功能,如会员管理、公告管理、文章管理等,显示了该程序提供了一套用于网站内容和用户管理的后台解决方案。 4. **前台展示优化:** - 对前台页面的优化和增加功能,如会员注册、文章页、下载页和分类栏目的改进,说明了对用户体验的重视。 5. **安全与权限控制:** - 默认用户名和密码的提供,以及后台目录的默认设置,强调了安装过程中应立即更改编译以提高安全性。 6. **静态页面生成:** - 生成静态页面作为必要步骤可能涉及到网站的性能优化和安全措施。 7. **开源与社区支持:** - 由于提及了更新的可能和用户反馈渠道,这表明软件具有一定的开源特性或至少鼓励社区参与。 综上所述,这些知识点涵盖了软件开发的常见方面,包括软件生命周期的维护、功能更新、环境配置、安全实践以及优化用户体验。了解和掌握这些知识点可以帮助开发者和用户更好地利用和改进免费时代WEB程序INFO2007 V1.0。
recommend-type

Rust测试实战:错误处理、环境变量与模拟服务器

### Rust 测试实战:错误处理、环境变量与模拟服务器 在 Rust 开发中,测试是确保代码质量和稳定性的重要环节。本文将深入探讨 Rust 中的测试技巧,包括错误处理、使用环境变量测试 Config 模块以及使用模拟服务器测试 profanity 模块。 #### 1. 错误处理与比较 在 Rust 中,我们可以为自定义错误类型实现 `std::fmt::Display` 特征,以便将错误转换为字符串。以下是一个示例: ```rust impl std::fmt::Display for Error { fn fmt(&self, f: &mut std::fmt::For
recommend-type

请分析下面代码:<tbody> <#if (paginationSupport.items)?has_content> <#list paginationSupport.items?sort_by('caseNo') as s> <tr class="b"> <td><a href="../user/viewRequestForm.action?requestFormId=${s.id}">${s.caseNo?default("Not Assigned")?if_exists}</a></td> <td>${s.lotId?if_exists}</td> <td><@m.directoryLink s.applicant?if_exists /></td> <td>${s.prodId?if_exists}</td> <td>${s.lotStageId?if_exists}</td> <td>${s.status?if_exists}</td> <td> <#if s.status!="Waiting For STR"> <#if s.workflowId?exists> <#list s.queuedOwners as owner> <#if owner?matches("[MmAaEeTt]\\d{3}.*")> <@m.directoryLink owner/> <#elseif owner?matches("[K-Z][A-Z][A-Z].*[_].*")> <#list adminService.loadGroupMembersByName(owner) as member> <@m.directoryLink member/><!--by Group--> </#list> <#else> <@m.orgManager owner?if_exists/><!--by Org--> </#if> </#list> </#if> <#else> <#if s.ercCategory=="Input the STR Number"||s.ercCategory=="STR"||s.ercCategory=="MSTR"> STR NO:<a href="${ercService.strLink?if_exists}${s.strEnNo?if_exists}" target="_blank">${s.strEnNo?if_exists}</a> is not effective <#else> EN NO:<a href="${ercService.enLink?if_exists}${s.strEnNo?if_exists}" target="_blank">${s.strEnNo?if_exists}</a> is not effective </#if> </#if> </td> <td><#if s.submitDate?exists>${s.submitDate?datetime?if_exists}</#if></td> <td>${s.purpose?default('')}</td> </tr> </#list> </#if> </tbody>

这段代码是使用 FreeMarker 模板引擎生成 HTML 表格内容的一部分,主要功能是根据分页数据展示请求表单的信息。以下是代码的详细分析: --- ### 1. **条件判断与循环** ```html <#if (paginationSupport.items)?has_content> ``` 判断 `paginationSupport.items` 是否存在且非空,只有存在数据时才执行表格渲染。 ```html <#list paginationSupport.items?sort_by('caseNo') as s> ``` 对 `paginationSupport.item
recommend-type

op-drone:监控未平仓头寸的市场利器

标题中提到的“op-drone”很可能是指一个特定的监控系统或服务的名称,它被用来“持续监控市场中的未平仓头寸”。未平仓头寸是指在金融市场上尚未完成交易结算的买卖双方的持仓数量。监控未平仓头寸对于市场参与者来说至关重要,因为它可以提供有关市场流动性和投资者情绪的重要信息。 在深入探讨之前,需要了解几个基础概念: 1. 未平仓头寸:指交易者在期货、期权、外汇或其他衍生品市场上建立的但尚未平仓的头寸。这些头寸在到期前仍然具有价值,而且市场上的价格变动会对它们的总体价值产生影响。 2. 持续监控:这通常是指使用软件工具或服务不断跟踪和分析市场数据的过程。持续监控可帮助交易者或市场分析师及时捕捉市场的动态变化,并根据最新情况做出交易决策。 3. 市场监控系统:这类系统通常具备收集实时数据、分析市场趋势、识别异常交易行为等多种功能。它们对于投资者了解市场状况、进行风险管理以及制定交易策略至关重要。 从描述中可以推断出,op-drone是一个专门用于持续监控未平仓头寸的系统或服务。这种系统需要具备以下功能: 1. 数据收集:系统需要有能力实时收集金融市场中的数据,包括但不限于期货、期权、股票、债券等金融产品的交易信息。 2. 数据分析:通过算法或机器学习技术分析收集到的数据,识别市场趋势、投资者行为模式以及潜在风险。 3. 异常检测:能够识别出市场中的异常交易活动,比如未平仓头寸的急剧变化,这可能是市场重大变动的前兆。 4. 风险预警:系统应能向用户发出风险预警,告知用户潜在的市场风险,帮助他们进行风险管理。 5. 报告与可视化:提供详细的数据报告和可视化图表,帮助用户更直观地理解市场状况和未平仓头寸变化。 此外,虽然文件中未提供标签和具体的文件名称列表,但可以推测“op-drone-main”可能是系统中的一个核心组件或主程序的名称。这个组件可能是整个op-drone系统运行的基础,负责处理大部分的监控和分析功能。 综合以上信息,我们可以得出一个结论:op-drone是一个专门设计用于监控金融市场上未平仓头寸的系统或服务。它可能具备实时数据收集和分析、异常行为识别、风险预警以及报告和可视化展示等多种功能,从而帮助用户在复杂的市场环境中做出更加明智的决策。对于需要精确把握市场动态、进行风险管理的金融分析师、交易员、投资组合经理等专业人士来说,这样的系统是不可或缺的工具。
recommend-type

RustWeb服务部署与环境变量配置全解析

### Rust Web 服务部署与环境变量配置全解析 在 Rust 开发中,完成业务逻辑编写后,将应用部署到生产环境是关键的下一步。本文将深入探讨 Rust 应用部署过程中的重要环节,包括环境变量的配置、二进制文件的优化以及跨平台编译等内容。 #### 1. 认证与授权相关未覆盖内容 在认证和授权方面,有一些内容未详细涉及。例如,设置会话数据库来存储令牌,以便在数据泄露或用户有其他需求时使令牌失效。可以通过设置 Redis 实例,在生成每个令牌时,不仅将结果返回给客户端,还将其存储在 Redis 键值存储中。 另外,重置用户密码和创建刷新令牌也是重要的话题。重置用户密码可以通过创建一个
recommend-type

消灭病毒 源代码

要查找消灭病毒游戏的源代码,可通过以下几种常见途径获取: ### 开源代码平台 - **GitHub**:作为全球最大的开源代码托管平台,有开发者会将自己开发的消灭病毒游戏源代码分享到上面。在GitHub的搜索框输入“消灭病毒游戏”相关关键词,如“Virus Elimination Game” 、“消灭病毒 Unity”等,就能筛选出相关的代码仓库。有些仓库可能是完整的项目,包含游戏开发所需的全部代码和资源;有些则可能是部分功能的实现,需要进一步整合。 - **Gitee**:国内的开源代码托管平台,很多国内开发者会将自己的项目上传至此。同样使用相关关键词搜索,或许能找到符合需求的消灭病毒游
recommend-type

Apache Directory:Java编写的LDAP v3兼容目录解决方案

标题中所提及的“directory”一词在IT领域有多种含义,而描述中提供了具体的上下文信息,即Apache Directory项目。这个项目是Apache软件基金会下的一个子项目,它提供了使用Java语言开发的开源目录服务解决方案。下面详细说明Apache Directory项目中涉及的知识点。 **Apache Directory项目知识点** 1. **目录服务(Directory Service)** - 目录服务是一种特殊类型的数据库,它主要用于存储关于网络中的对象信息,如用户、组、设备等,并使得这些信息可以被集中管理和查询。与传统的关系数据库不同,目录服务通常是为了读操作比写操作更频繁的应用场景优化的,这使得它特别适合用于存储诸如用户身份验证信息、配置数据、策略信息等。 2. **LDAP(轻量级目录访问协议)** - LDAP是目录服务使用的一种协议标准,它定义了客户端与目录服务进行交互的规则和方法。LDAP v3是LDAP协议的第三个版本,它在功能上比前两个版本更为强大和灵活。LDAP服务器通常被称为目录服务器(Directory Server),用于存储目录信息并提供查询服务。 3. **ApacheDS(Apache Directory Server)** - Apache Directory Server是Apache Directory项目的主要组件之一,是一个完全用Java编写的LDAP v3兼容的目录服务器。它符合LDAP标准的所有基本要求,还提供了丰富的可扩展性,如扩展协议操作、自定义属性类型、自定义操作等。它的设计目标是成为一个轻量级、易于使用且功能强大的目录服务器,特别适用于企业环境中的用户身份管理。 4. **认证和授权** - 在一个目录服务环境中,认证是指验证用户身份的过程,而授权是指授予已认证用户访问资源的权限。Apache Directory Server在设计上提供了对这些安全特性的支持,包括但不限于:密码策略、访问控制列表(ACLs)等。 5. **Eclipse和Apache Directory Studio** - Apache Directory Studio是一个基于Eclipse的开源集成开发环境(IDE),它专门为目录服务的开发和管理提供工具。它包含一个LDAP浏览器、一个LDIF编辑器、一个Schema编辑器等工具。开发者和管理员可以利用Apache Directory Studio来浏览和管理LDAP服务器,以及创建和修改LDAP条目和Schema。 6. **LDIF(LDAP数据交换格式)** - LDIF是LDAP数据交换的文件格式,用于在文本文件中表示LDAP目录的信息。它通常用于备份和恢复LDAP数据,以及将数据导入到LDAP目录中。Apache Directory API允许用户操作LDIF文件,为这些操作提供了丰富的接口。 **网络服务器与网络客户端** 网络服务器是位于服务器端的软件,负责处理来自客户端的请求,并将信息回传给客户端。网络客户端则是发起请求的软件,它连接到服务器并获取服务或数据。Apache Directory Server作为网络服务器的一个例子,为客户端提供目录服务的访问能力。这可能包括身份验证服务、数据检索服务等。网络客户端则需要使用适当的协议和API与目录服务器通信,例如使用LDAP协议。 **压缩包子文件的文件名称列表** 提供的文件名称“apache-ldap-api-1.0.3-bin”表明这是一个可执行的二进制包,其中包含了Apache Directory API的版本1.0.3。API通常包含了一系列用于与目录服务进行交互的类和方法。开发者可以使用这些API来编写代码,实现对LDAP服务器的管理操作,如查询、更新、删除和添加目录信息。 总结上述内容,Apache Directory项目是针对提供目录服务解决方案的开源项目,包括了Apache Directory Server作为服务器组件,和Apache Directory Studio作为客户端工具。项目遵守LDAP v3协议标准,并提供易于使用的API接口,使得开发者能够构建和管理一个高效、安全的目录服务环境。在使用过程中,了解LDAP协议、目录服务的安全机制以及相关的API使用是基础知识点。同时,由于Apache Directory项目采用Java语言编写,了解Java编程语言和其生态系统也对开发和部署相关服务有极大的帮助。
recommend-type

Rust项目中用户认证与登录功能的实现与优化

### Rust 项目中用户认证与登录功能的实现与优化 在开发 Web 应用时,用户认证是一个至关重要的环节。它涉及到用户密码的安全存储、账户注册时的重复错误处理以及登录逻辑的实现等多个方面。下面将详细介绍如何在 Rust 项目中实现这些功能。 #### 1. 密码哈希与加盐 为了确保用户密码的安全,我们不能直接存储明文密码。常见的做法是使用哈希算法对密码进行处理。不过,单纯的哈希还不够,因为攻击者可能通过比对已知破解的哈希列表来获取明文密码。因此,我们还需要对密码进行加盐处理,即在哈希之前添加一个随机生成的序列。 我们引入了两个新的 crate 来实现这个功能: - `rand`:用于
recommend-type

如何使用使用QZipReader解压文件

`QZipReader` 是一个方便的工具,用于在 Qt 应用程序中解压 ZIP 压缩包,它提供了读取 ZIP 文件的接口,并能提取其中的内容。以下是使用 `QZipReader` 解压文件的示例代码: ```cpp #include <QZipReader> #include <QFile> #include <QDir> void zip_decompress(const QString &fileName, const QString &path) { if (fileName.isEmpty()) { return; } QFileInfo f