Integrate CAN-aware CMS risk pipeline and relocatable Orin runtime
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
#include "config.hpp"
|
||||
#include "door_risk.hpp"
|
||||
#include <fstream>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace cms {
|
||||
PipelineConfig loadConfig(std::filesystem::path const& path) {
|
||||
std::ifstream file(path);
|
||||
if(!file)throw std::runtime_error("Cannot read configuration: "+path.string());
|
||||
auto j=Json::parse(file);PipelineConfig config;
|
||||
auto const& camera=j.at("camera");
|
||||
config.camera.device=camera.at("device");config.camera.width=camera.at("width");
|
||||
config.camera.height=camera.at("height");config.camera.fps=camera.at("fps");
|
||||
config.camera.buffers=camera.at("buffers");config.camera.timeout_ms=camera.at("timeout_ms");
|
||||
auto resolve=[&](std::string const& value){auto p=std::filesystem::path(value);return std::filesystem::absolute(p.is_absolute()?p:path.parent_path()/p);};
|
||||
auto const& inference=j.at("inference");
|
||||
config.engines=resolve(inference.at("engine_directory"));config.max_people=inference.at("max_people");
|
||||
config.detector_confidence=inference.at("detector_confidence");config.queue_capacity=inference.at("queue_capacity");
|
||||
auto const& door=j.at("door");config.door_mask=resolve(door.at("mask"));
|
||||
config.warning_relative=door.at("warning_relative");config.release_relative=door.at("release_relative");
|
||||
config.door_mask_calibration_verified=door.at("calibration_verified");
|
||||
return config;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user