Skip to content

Commit

Permalink
Merge 'origin/develop' into poe_mtu_sysctl
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-luxonis committed May 4, 2022
2 parents 8715e50 + 8dd039c commit cb30cd7
Show file tree
Hide file tree
Showing 10 changed files with 368 additions and 64 deletions.
23 changes: 20 additions & 3 deletions include/depthai-shared/common/EepromData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,30 @@ namespace dai {
* Contains the Calibration and Board data stored on device
*/
struct EepromData {
uint32_t version = 6;
std::string boardName, boardRev;
uint32_t version = 7;
std::string productName, boardCustom, boardName, boardRev, boardConf, hardwareConf, batchName;
uint64_t batchTime{0};
uint32_t boardOptions{0};
std::unordered_map<CameraBoardSocket, CameraInfo> cameraData;
StereoRectification stereoRectificationData;
Extrinsics imuExtrinsics;
std::vector<uint8_t> miscellaneousData;
DEPTHAI_SERIALIZE(EepromData, version, boardName, boardRev, cameraData, stereoRectificationData, imuExtrinsics, miscellaneousData);
};

DEPTHAI_SERIALIZE_OPTIONAL_EXT(EepromData,
version,
boardCustom,
boardName,
boardRev,
boardConf,
hardwareConf,
productName,
batchName,
batchTime,
boardOptions,
cameraData,
stereoRectificationData,
imuExtrinsics,
miscellaneousData);

} // namespace dai
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace dai {
/**
* SpatialLocation configuration thresholds structure
*
* Contains configuration data for lower and upper threshold in millimeters for ROI.
* Contains configuration data for lower and upper threshold in depth units (millimeter by default) for ROI.
* Values outside of threshold range will be ignored when calculating spatial coordinates from depth map.
*/
struct SpatialLocationCalculatorConfigThresholds {
Expand Down
2 changes: 1 addition & 1 deletion include/depthai-shared/datatype/RawSpatialLocations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace dai {
*
* Contains configuration data, average depth for the calculated ROI on depth map.
* Together with spatial coordinates: x,y,z relative to the center of depth map.
* Units are in millimeters.
* Units are in depth units (millimeter by default).
*/
struct SpatialLocations {
/**
Expand Down
33 changes: 28 additions & 5 deletions include/depthai-shared/datatype/RawStereoDepthConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,28 @@ struct RawStereoDepthConfig : public RawBuffer {
*/
enum class DepthAlign : int32_t { RECTIFIED_RIGHT, RECTIFIED_LEFT, CENTER };

/**
* Measurement unit for depth data
*/
enum class DepthUnit : int32_t { METER, CENTIMETER, MILLIMETER, INCH, FOOT, CUSTOM };

/**
* Set the disparity/depth alignment to the perspective of a rectified output, or center it
*/
DepthAlign depthAlign = DepthAlign::RECTIFIED_RIGHT;

/**
* Measurement unit for depth data.
* Depth data is integer value, multiple of depth unit.
*/
DepthUnit depthUnit = DepthUnit::MILLIMETER;

/**
* Custom depth unit multiplier, if custom depth unit is enabled, relative to 1 meter.
* A multiplier of 1000 effectively means depth unit in millimeter.
*/
float customDepthUnitMultiplier = 1000.f;

/**
* Computes and combines disparities in both L-R and R-L directions, and combine them.
* For better occlusion handling
Expand Down Expand Up @@ -64,7 +81,15 @@ struct RawStereoDepthConfig : public RawBuffer {
*/
std::int32_t subpixelFractionalBits = 3;

DEPTHAI_SERIALIZE(AlgorithmControl, depthAlign, enableLeftRightCheck, enableExtended, enableSubpixel, leftRightCheckThreshold, subpixelFractionalBits);
DEPTHAI_SERIALIZE(AlgorithmControl,
depthAlign,
depthUnit,
customDepthUnitMultiplier,
enableLeftRightCheck,
enableExtended,
enableSubpixel,
leftRightCheckThreshold,
subpixelFractionalBits);
};

/**
Expand Down Expand Up @@ -135,7 +160,6 @@ struct RawStereoDepthConfig : public RawBuffer {

/**
* Temporal filtering with optional persistence.
* More details about the filter can be found here:
*/
struct TemporalFilter {
static constexpr const std::int32_t DEFAULT_DELTA_VALUE = 3;
Expand Down Expand Up @@ -186,7 +210,6 @@ struct RawStereoDepthConfig : public RawBuffer {

/**
* Temporal filtering with optional persistence.
* More details about the filter can be found here:
*/
TemporalFilter temporalFilter;

Expand All @@ -196,12 +219,12 @@ struct RawStereoDepthConfig : public RawBuffer {
*/
struct ThresholdFilter {
/**
* Minimum range in millimeters.
* Minimum range in depth units.
* Depth values under this value are invalidated.
*/
std::int32_t minRange = 0;
/**
* Maximum range in millimeters.
* Maximum range in depth units.
* Depth values over this value are invalidated.
*/
std::int32_t maxRange = 65535;
Expand Down
8 changes: 7 additions & 1 deletion include/depthai-shared/device/BoardConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,18 @@ struct BoardConfig {
};
/// UART instance map
std::unordered_map<std::int8_t, UART> uart;

// PCIe config
tl::optional<bool> pcieInternalClock;

// USB3 phy config
tl::optional<bool> usb3PhyInternalClock;
};

DEPTHAI_SERIALIZE_EXT(BoardConfig::USB, vid, pid, flashBootedVid, flashBootedPid, maxSpeed);
DEPTHAI_SERIALIZE_EXT(BoardConfig::Network, mtu);
DEPTHAI_SERIALIZE_EXT(BoardConfig::GPIO, mode, direction, level, pull, drive, schmitt, slewFast);
DEPTHAI_SERIALIZE_EXT(BoardConfig::UART, tmp);
DEPTHAI_SERIALIZE_EXT(BoardConfig, usb, network, sysctl, watchdogTimeoutMs, watchdogInitialDelayMs, gpio, uart);
DEPTHAI_SERIALIZE_EXT(BoardConfig, usb, network, sysctl, watchdogTimeoutMs, watchdogInitialDelayMs, gpio, uart, pcieInternalClock, usb3PhyInternalClock);

} // namespace dai
2 changes: 1 addition & 1 deletion include/depthai-shared/log/LogMessage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace dai {

struct LogMessage {
std::string nodeIdName;
LogLevel level;
LogLevel level{LogLevel::TRACE};
Timestamp time;
size_t colorRangeStart{0};
size_t colorRangeEnd{0};
Expand Down
6 changes: 3 additions & 3 deletions include/depthai-shared/properties/Properties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ namespace dai {

/// Base Properties structure
struct Properties {
virtual void serialize(std::vector<std::uint8_t>& data) const = 0;
virtual void serialize(std::vector<std::uint8_t>& data, SerializationType type) const = 0;
virtual std::unique_ptr<Properties> clone() const = 0;
virtual ~Properties() = default;
};

/// Serializable properties
template <typename Base, typename Derived>
struct PropertiesSerializable : Base {
virtual void serialize(std::vector<std::uint8_t>& data) const override {
utility::serialize(static_cast<const Derived&>(*this), data);
virtual void serialize(std::vector<std::uint8_t>& data, SerializationType type = SerializationType::LIBNOP) const override {
utility::serialize(static_cast<const Derived&>(*this), data, type);
}

virtual std::unique_ptr<Properties> clone() const override {
Expand Down
13 changes: 12 additions & 1 deletion include/depthai-shared/properties/StereoDepthProperties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ struct StereoDepthProperties : PropertiesSerializable<Properties, StereoDepthPro
*/
CameraBoardSocket depthAlignCamera = CameraBoardSocket::AUTO;

/**
* Enable stereo rectification/dewarp or not.
* Useful to disable when replaying pre-recorded rectified frames.
*/
bool enableRectification = true;

/**
Expand Down Expand Up @@ -122,6 +126,12 @@ struct StereoDepthProperties : PropertiesSerializable<Properties, StereoDepthPro
* otherwise calculated from FOV and image resolution: focalLength = calib.width / (2.f * tan(calib.fov / 2 / 180.f * pi));
*/
tl::optional<bool> focalLengthFromCalibration;

/**
* Use homography for stereo rectification instead of sparse mesh generated on device.
* Default value: true.
*/
bool useHomographyRectification = true;
};

DEPTHAI_SERIALIZE_EXT(StereoDepthProperties,
Expand All @@ -139,6 +149,7 @@ DEPTHAI_SERIALIZE_EXT(StereoDepthProperties,
numFramesPool,
numPostProcessingShaves,
numPostProcessingMemorySlices,
focalLengthFromCalibration);
focalLengthFromCalibration,
useHomographyRectification);

} // namespace dai
Loading

0 comments on commit cb30cd7

Please sign in to comment.