Skip to content

Commit

Permalink
Merge pull request #178 from luxonis/develop
Browse files Browse the repository at this point in the history
Release v2.7.2
  • Loading branch information
SzabolcsGergely authored Jul 19, 2021
2 parents 5fff390 + b4f2851 commit bab310c
Show file tree
Hide file tree
Showing 41 changed files with 231 additions and 242 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if(WIN32)
endif()

# Create depthai project
project(depthai VERSION "2.7.1" LANGUAGES CXX C)
project(depthai VERSION "2.7.2" LANGUAGES CXX C)
get_directory_property(has_parent PARENT_DIRECTORY)
if(has_parent)
set(DEPTHAI_VERSION ${PROJECT_VERSION} PARENT_SCOPE)
Expand Down
2 changes: 1 addition & 1 deletion cmake/Depthai/DepthaiDeviceSideConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot")

# "full commit hash of device side binary"
set(DEPTHAI_DEVICE_SIDE_COMMIT "eb69fc0283cf82608e6eccf6f37b1709a2db8b5b")
set(DEPTHAI_DEVICE_SIDE_COMMIT "673983dd2b693f267cb3cb11a4247ec4a38a6508")

# "version if applicable"
set(DEPTHAI_DEVICE_SIDE_VERSION "")
20 changes: 20 additions & 0 deletions include/depthai/device/DataQueue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ class DataOutputQueue {
DataOutputQueue(const std::shared_ptr<XLinkConnection>& conn, const std::string& streamName, unsigned int maxSize = 16, bool blocking = true);
~DataOutputQueue();

/**
* Check whether queue is closed
*/
bool isClosed() const;

/**
* Closes the queue and the underlying thread
*/
void close();

/**
* Sets queue behavior when full (maxSize)
*
Expand Down Expand Up @@ -339,6 +349,16 @@ class DataInputQueue {
DataInputQueue(const std::shared_ptr<XLinkConnection>& conn, const std::string& streamName, unsigned int maxSize = 16, bool blocking = true);
~DataInputQueue();

/**
* Check whether queue is closed
*/
bool isClosed() const;

/**
* Closes the queue and the underlying thread
*/
void close();

/**
* Sets maximum message size. If message is larger than specified, then an exception is issued.
*
Expand Down
71 changes: 60 additions & 11 deletions include/depthai/pipeline/Node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,24 @@ class Node {
struct Connection;

protected:
// fwd declare classes
class Input;
class Output;

std::vector<Output*> outputs;
std::vector<Input*> inputs;

struct DatatypeHierarchy {
DatatypeHierarchy(DatatypeEnum d, bool c) : datatype(d), descendants(c) {}
DatatypeEnum datatype;
bool descendants;
};

// fwd declare Input class
struct Input;
class Output {
Node& parent;

struct Output {
public:
enum class Type { MSender, SSender };
Node& parent;
const std::string name;
const Type type;
// Which types and do descendants count as well?
Expand All @@ -54,7 +60,13 @@ class Node {
: parent(par), name(std::move(n)), type(t), possibleDatatypes(std::move(types)) {}
bool isSamePipeline(const Input& in);

public:
Node& getParent() {
return parent;
}
const Node& getParent() const {
return parent;
}

/**
* Check if connection is possible
* @param in Input to connect to
Expand Down Expand Up @@ -88,16 +100,18 @@ class Node {
void unlink(const Input& in);
};

struct Input {
enum class Type { SReceiver, MReceiver };
class Input {
Node& parent;

public:
enum class Type { SReceiver, MReceiver };
const std::string name;
const Type type;
bool defaultBlocking{true};
int defaultQueueSize{8};
tl::optional<bool> blocking;
tl::optional<int> queueSize;
friend struct Output;
friend class Output;
const std::vector<DatatypeHierarchy> possibleDatatypes;

/// Constructs Input with default blocking and queueSize options
Expand All @@ -108,7 +122,13 @@ class Node {
Input(Node& par, std::string n, Type t, bool blocking, int queueSize, std::vector<DatatypeHierarchy> types)
: parent(par), name(std::move(n)), type(t), defaultBlocking(blocking), defaultQueueSize(queueSize), possibleDatatypes(std::move(types)) {}

public:
Node& getParent() {
return parent;
}
const Node& getParent() const {
return parent;
}

/**
* Overrides default input queue behavior.
* @param blocking True blocking, false overwriting
Expand Down Expand Up @@ -154,12 +174,41 @@ class Node {
/// Retrieves nodes name
virtual std::string getName() const = 0;
/// Retrieves all nodes outputs
virtual std::vector<Output> getOutputs() = 0;
std::vector<Output> getOutputs() {
std::vector<Output> result;
for(auto* x : getOutputRefs()) {
result.push_back(*x);
}
return result;
}
/// Retrieves all nodes inputs
virtual std::vector<Input> getInputs() = 0;
std::vector<Input> getInputs() {
std::vector<Input> result;
for(auto* x : getInputRefs()) {
result.push_back(*x);
}
return result;
}
/// Retrieves all nodes assets
virtual std::vector<std::shared_ptr<Asset>> getAssets();

/// Retrieves reference to node outputs
std::vector<Output*> getOutputRefs() {
return outputs;
}
/// Retrieves reference to node outputs
std::vector<const Output*> getOutputRefs() const {
return {outputs.begin(), outputs.end()};
}
/// Retrieves reference to node inputs
std::vector<Input*> getInputRefs() {
return inputs;
}
/// Retrieves reference to node inputs
std::vector<const Input*> getInputRefs() const {
return {inputs.begin(), inputs.end()};
}

/// Connection between an Input and Output
struct Connection {
friend struct std::hash<Connection>;
Expand Down
10 changes: 4 additions & 6 deletions include/depthai/pipeline/node/ColorCamera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,16 @@ class ColorCamera : public Node {

private:
Properties properties;
std::shared_ptr<RawCameraControl> rawControl;

std::string getName() const override;
std::vector<Output> getOutputs() override;
std::vector<Input> getInputs() override;
nlohmann::json getProperties() override;
std::shared_ptr<Node> clone() override;
nlohmann::json getProperties() override;

std::shared_ptr<RawCameraControl> rawControl;
public:
std::string getName() const override;

int getScaledSize(int input, int num, int denom) const;

public:
/**
* Constructs ColorCamera node.
*/
Expand Down
7 changes: 3 additions & 4 deletions include/depthai/pipeline/node/DetectionNetwork.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ class DetectionNetwork : public NeuralNetwork {
using Properties = dai::DetectionNetworkProperties;

std::string getName() const override;
std::vector<Output> getOutputs() override;
std::vector<Input> getInputs() override;

protected:
DetectionNetwork(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId);
Properties properties;
virtual Properties& getPropertiesRef() override;

DetectionNetwork(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId);
Properties& getPropertiesRef() override;
nlohmann::json getProperties() override;
std::shared_ptr<Node> clone() override;

Expand Down
2 changes: 0 additions & 2 deletions include/depthai/pipeline/node/EdgeDetector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ class EdgeDetector : public Node {

private:
std::string getName() const override;
std::vector<Input> getInputs() override;
std::vector<Output> getOutputs() override;
nlohmann::json getProperties() override;
std::shared_ptr<Node> clone() override;

Expand Down
5 changes: 2 additions & 3 deletions include/depthai/pipeline/node/IMU.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ class IMU : public Node {
private:
Properties properties;

std::string getName() const override;
std::vector<Output> getOutputs() override;
std::vector<Input> getInputs() override;
nlohmann::json getProperties() override;
std::shared_ptr<Node> clone() override;

public:
std::string getName() const override;

/**
* Constructs IMU node.
*/
Expand Down
8 changes: 3 additions & 5 deletions include/depthai/pipeline/node/ImageManip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@ class ImageManip : public Node {

private:
Properties properties;
std::shared_ptr<RawImageManipConfig> rawConfig;

std::string getName() const override;
std::vector<Input> getInputs() override;
std::vector<Output> getOutputs() override;
nlohmann::json getProperties() override;
std::shared_ptr<Node> clone() override;

std::shared_ptr<RawImageManipConfig> rawConfig;

public:
std::string getName() const override;

ImageManip(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId);

/**
Expand Down
5 changes: 2 additions & 3 deletions include/depthai/pipeline/node/MonoCamera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ class MonoCamera : public Node {
private:
Properties properties;

std::string getName() const override;
std::vector<Output> getOutputs() override;
std::vector<Input> getInputs() override;
nlohmann::json getProperties() override;
std::shared_ptr<Node> clone() override;

std::shared_ptr<RawCameraControl> rawControl;

public:
std::string getName() const override;

MonoCamera(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId);

/**
Expand Down
5 changes: 2 additions & 3 deletions include/depthai/pipeline/node/MyProducer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ namespace node {
class MyProducer : public Node {
dai::MyProducerProperties properties;

std::string getName() const override;
std::vector<Input> getInputs() override;
std::vector<Output> getOutputs() override;
nlohmann::json getProperties() override;
std::shared_ptr<Node> clone() override;

public:
std::string getName() const override;

MyProducer(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId);

Output out{*this, "out", Output::Type::MSender, {{DatatypeEnum::Buffer, true}}};
Expand Down
2 changes: 0 additions & 2 deletions include/depthai/pipeline/node/NeuralNetwork.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class NeuralNetwork : public Node {
using Properties = dai::NeuralNetworkProperties;

std::string getName() const override;
std::vector<Output> getOutputs() override;
std::vector<Input> getInputs() override;

protected:
nlohmann::json getProperties() override;
Expand Down
5 changes: 2 additions & 3 deletions include/depthai/pipeline/node/ObjectTracker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ class ObjectTracker : public Node {
using Properties = dai::ObjectTrackerProperties;

private:
std::string getName() const override;
std::vector<Input> getInputs() override;
std::vector<Output> getOutputs() override;
nlohmann::json getProperties() override;
std::shared_ptr<Node> clone() override;

Properties properties;

public:
std::string getName() const override;

ObjectTracker(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId);

/**
Expand Down
18 changes: 6 additions & 12 deletions include/depthai/pipeline/node/SPIOut.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,6 @@ namespace node {
class SPIOut : public Node {
dai::SPIOutProperties properties;

std::string getName() const {
return "SPIOut";
}

std::vector<Input> getInputs() {
return {input};
}

std::vector<Output> getOutputs() {
return {};
}

nlohmann::json getProperties() {
nlohmann::json j;
nlohmann::to_json(j, properties);
Expand All @@ -37,8 +25,14 @@ class SPIOut : public Node {
}

public:
std::string getName() const {
return "SPIOut";
}

SPIOut(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId) : Node(par, nodeId) {
properties.busId = 0;

inputs = {&input};
}

/**
Expand Down
5 changes: 2 additions & 3 deletions include/depthai/pipeline/node/SpatialDetectionNetwork.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ class SpatialDetectionNetwork : public DetectionNetwork {
using Properties = dai::SpatialDetectionNetworkProperties;

std::string getName() const override;
std::vector<Input> getInputs() override;
std::vector<Output> getOutputs() override;

protected:
SpatialDetectionNetwork(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId);
Properties properties;
virtual Properties& getPropertiesRef() override;
nlohmann::json getProperties() override;
std::shared_ptr<Node> clone() override;

public:
SpatialDetectionNetwork(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId);

/**
* Input message with data to be infered upon
* Default queue is blocking with size 5
Expand Down
5 changes: 2 additions & 3 deletions include/depthai/pipeline/node/SpatialLocationCalculator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@ class SpatialLocationCalculator : public Node {
using Properties = dai::SpatialLocationCalculatorProperties;

private:
std::string getName() const override;
std::vector<Input> getInputs() override;
std::vector<Output> getOutputs() override;
nlohmann::json getProperties() override;
std::shared_ptr<Node> clone() override;

std::shared_ptr<RawSpatialLocationCalculatorConfig> rawConfig;
Properties properties;

public:
std::string getName() const override;

SpatialLocationCalculator(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId);

/**
Expand Down
Loading

0 comments on commit bab310c

Please sign in to comment.