Update YOLO test:

Normal YOLO for 0.01 step
Perfectionist YOLO for 0.005 step
This commit is contained in:
SoftFever 2024-08-17 21:18:28 +08:00
parent a49c48ab43
commit 3e88e5577a
5 changed files with 49 additions and 38 deletions

Binary file not shown.

View File

@ -2815,16 +2815,18 @@ void MainFrame::init_menubar_as_editor()
auto flowrate_menu = new wxMenu();
append_menu_item(
flowrate_menu, wxID_ANY, _L("Pass 1"), _L("Flow rate test - Pass 1"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(1); }, "", nullptr,
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(false, 1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(flowrate_menu, wxID_ANY, _L("Pass 2"), _L("Flow rate test - Pass 2"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(2); }, "", nullptr,
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(false, 2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
flowrate_menu->AppendSeparator();
append_menu_item(flowrate_menu, wxID_ANY, _L("YOLO flowrate calibration"), _L("Orca YOLO flowrate calibration"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate_linear(); }, "", nullptr,
append_menu_item(flowrate_menu, wxID_ANY, _L("YOLO(Recommended)"), _L("Orca YOLO flowrate calibration, 0.01 step"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(true, 1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(flowrate_menu, wxID_ANY, _L("YOLO(perfectionist version)"), _L("Orca YOLO flowrate calibration, 0.005 step"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(true, 2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
m_topbar->GetCalibMenu()->AppendSubMenu(flowrate_menu, _L("Flow rate"));
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Pressure advance"), _L("Pressure advance"),
[this](wxCommandEvent&) {
@ -2907,18 +2909,21 @@ void MainFrame::init_menubar_as_editor()
// Flowrate
auto flowrate_menu = new wxMenu();
append_menu_item(flowrate_menu, wxID_ANY, _L("Pass 1"), _L("Flow rate test - Pass 1"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(1); }, "", nullptr,
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(false, 1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(flowrate_menu, wxID_ANY, _L("Pass 2"), _L("Flow rate test - Pass 2"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(2); }, "", nullptr,
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(false, 2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_submenu(calib_menu,flowrate_menu,wxID_ANY,_L("Flow rate"),_L("Flow rate"),"",
[this]() {return m_plater->is_view3D_shown();; });
flowrate_menu->AppendSeparator();
append_menu_item(flowrate_menu, wxID_ANY, _L("YOLO flowrate calibration"), _L("Orca YOLO flowrate calibration"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate_linear(); }, "", nullptr,
append_menu_item(flowrate_menu, wxID_ANY, _L("YOLO(Recommended)"), _L("Orca YOLO flowrate calibration, 0.01 step"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(true, 1); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(flowrate_menu, wxID_ANY, _L("YOLO(perfectionist version)"), _L("Orca YOLO flowrate calibration, 0.005 step"),
[this](wxCommandEvent&) { if (m_plater) m_plater->calib_flowrate(true, 2); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
// PA
append_menu_item(calib_menu, wxID_ANY, _L("Pressure advance"), _L("Pressure advance"),
[this](wxCommandEvent&) {

View File

@ -9632,8 +9632,8 @@ void Plater::_calib_pa_select_added_objects() {
}
// Adjust settings for flowrate calibration
// Parameter pass's value should be [0,1,2], while 0 means the new YOLO flowrate calibration
void adjust_settings_for_flowrate_calib(ModelObjectPtrs& objects, int pass)
// For linear mode, pass 1 means normal version while pass 2 mean "for perfectionists" version
void adjust_settings_for_flowrate_calib(ModelObjectPtrs& objects, bool linear, int pass)
{
auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
auto printerConfig = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
@ -9666,8 +9666,9 @@ auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config
Flow infill_flow = Flow(nozzle_diameter * 1.2f, layer_height, nozzle_diameter);
double filament_max_volumetric_speed = filament_config->option<ConfigOptionFloats>("filament_max_volumetric_speed")->get_at(0);
double max_infill_speed;
if(pass == 0)
max_infill_speed = filament_max_volumetric_speed / (infill_flow.mm3_per_mm() * (cur_flowrate+0.35)/cur_flowrate);
if (linear)
max_infill_speed = filament_max_volumetric_speed /
(infill_flow.mm3_per_mm() * (cur_flowrate + (pass == 2 ? 0.035 : 0.05)) / cur_flowrate);
else
max_infill_speed = filament_max_volumetric_speed / (infill_flow.mm3_per_mm() * (pass == 1 ? 1.2 : 1));
double internal_solid_speed = std::floor(std::min(print_config->opt_float("internal_solid_infill_speed"), max_infill_speed));
@ -9708,8 +9709,8 @@ auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config
if (obj_name[0] == 'm')
obj_name[0] = '-';
auto modifier = stof(obj_name);
if(pass == 0)
_obj->config.set_key_value("print_flow_ratio", new ConfigOptionFloat(1.0f + modifier/cur_flowrate));
if(linear)
_obj->config.set_key_value("print_flow_ratio", new ConfigOptionFloat((cur_flowrate + modifier)/cur_flowrate));
else
_obj->config.set_key_value("print_flow_ratio", new ConfigOptionFloat(1.0f + modifier/100.f));
@ -9729,36 +9730,42 @@ auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config
wxGetApp().get_tab(Preset::TYPE_PRINTER)->reload_config();
}
void Plater::calib_flowrate(int pass) {
void Plater::calib_flowrate(bool is_linear, int pass) {
if (pass != 1 && pass != 2)
return;
const auto calib_name = wxString::Format(L"Flowrate Test - Pass%d", pass);
wxString calib_name;
if (is_linear) {
calib_name = L"Orca YOLO Flow Calibration";
if (pass == 2)
calib_name += L" - Perfectionist version";
} else
calib_name = wxString::Format(L"Flowrate Test - Pass%d", pass);
if (new_project(false, false, calib_name) == wxID_CANCEL)
return;
wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
if(pass == 1)
add_model(false, (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "flowrate-test-pass1.3mf").string());
else
add_model(false, (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "flowrate-test-pass2.3mf").string());
adjust_settings_for_flowrate_calib(model().objects, pass);
if (is_linear) {
if (pass == 1)
add_model(false,
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "Orca-LinearFlow.3mf").string());
else
add_model(false,
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "Orca-LinearFlow_fine.3mf").string());
} else {
if (pass == 1)
add_model(false,
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "flowrate-test-pass1.3mf").string());
else
add_model(false,
(boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "flowrate-test-pass2.3mf").string());
}
adjust_settings_for_flowrate_calib(model().objects, is_linear, pass);
wxGetApp().get_tab(Preset::TYPE_PRINTER)->reload_config();
}
void Plater::calib_flowrate_linear() {
const wxString calib_name(L"Orca Flow Calibration - Linear");
if (new_project(false, false, calib_name) == wxID_CANCEL)
return;
wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor));
add_model(false, (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "Orca-LinearFlow.3mf").string());
adjust_settings_for_flowrate_calib(model().objects, 0);
}
void Plater::calib_temp(const Calib_Params& params) {
const auto calib_temp_name = wxString::Format(L"Nozzle temperature test");

View File

@ -259,8 +259,7 @@ public:
// SoftFever
void calib_pa(const Calib_Params& params);
void calib_flowrate(int pass);
void calib_flowrate_linear();
void calib_flowrate(bool is_linear, int pass);
void calib_temp(const Calib_Params& params);
void calib_max_vol_speed(const Calib_Params& params);
void calib_retraction(const Calib_Params& params);