mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-14 07:00:35 +08:00
CATS and network compatibility checker removed
This commit is contained in:
+1
-1
Submodule dsdl updated: bda1145252...4f8a54ef25
@@ -9,7 +9,6 @@
|
||||
#include <uavcan/error.hpp>
|
||||
#include <uavcan/std.hpp>
|
||||
#include <uavcan/data_type.hpp>
|
||||
#include <uavcan/util/bitset.hpp>
|
||||
#include <uavcan/util/templates.hpp>
|
||||
#include <uavcan/util/linked_list.hpp>
|
||||
#if UAVCAN_DEBUG
|
||||
@@ -18,11 +17,6 @@
|
||||
|
||||
namespace uavcan
|
||||
{
|
||||
/**
|
||||
* Bit mask where bit at index X is set if there's a Data Type with ID X.
|
||||
*/
|
||||
typedef BitSet<DataTypeID::MaxPossibleDataTypeIDValue + 1> DataTypeIDMask;
|
||||
|
||||
/**
|
||||
* This singleton is shared among all existing node instances. It is instantiated automatically
|
||||
* when the C++ runtime executes contstructors before main().
|
||||
@@ -151,28 +145,6 @@ public:
|
||||
*/
|
||||
const DataTypeDescriptor* find(DataTypeKind kind, DataTypeID dtid) const;
|
||||
|
||||
/**
|
||||
* Computes Aggregate Signature for all known data types selected by the mask.
|
||||
* Extra bits will be zeroed.
|
||||
* Please read the DSDL specification.
|
||||
* @param[in] kind Data Type Kind - messages or services.
|
||||
* @param[inout] inout_id_mask Data types to compute aggregate signature for; bits at
|
||||
* the positions of unknown data types will be cleared.
|
||||
* @return Computed data type signature.
|
||||
*/
|
||||
DataTypeSignature computeAggregateSignature(DataTypeKind kind, DataTypeIDMask& inout_id_mask) const;
|
||||
|
||||
/**
|
||||
* Sets the mask so that only bits corresponding to known data types will be set.
|
||||
* In other words:
|
||||
* for data_type_id := [0, 1023]
|
||||
* mask[data_type_id] := data_type_exists(data_type_id)
|
||||
*
|
||||
* @param[in] kind Data Type Kind - messages or services.
|
||||
* @param[out] mask Output mask of known data types.
|
||||
*/
|
||||
void getDataTypeIDMask(DataTypeKind kind, DataTypeIDMask& mask) const;
|
||||
|
||||
/**
|
||||
* Returns the number of registered message types.
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
# include <uavcan/protocol/logger.hpp>
|
||||
# include <uavcan/protocol/restart_request_server.hpp>
|
||||
# include <uavcan/protocol/transport_stats_provider.hpp>
|
||||
# include <uavcan/protocol/network_compat_checker.hpp>
|
||||
#endif
|
||||
|
||||
#if !defined(UAVCAN_CPP_VERSION) || !defined(UAVCAN_CPP11)
|
||||
@@ -150,15 +149,6 @@ public:
|
||||
*/
|
||||
int start(const TransferPriority node_status_transfer_priority = TransferPriority::Default);
|
||||
|
||||
#if !UAVCAN_TINY
|
||||
/**
|
||||
* Please read the specs to learn about Network Compatibility Check.
|
||||
* Returns negative error code.
|
||||
* @param[out] result Check result (output).
|
||||
*/
|
||||
int checkNetworkCompatibility(NetworkCompatibilityCheckResult& result);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Sets the node name, e.g. "com.example.product_name". The node name can be set only once.
|
||||
* Must be executed before the node is started, otherwise the node will refuse to start up.
|
||||
@@ -305,32 +295,6 @@ fail:
|
||||
return res;
|
||||
}
|
||||
|
||||
#if !UAVCAN_TINY
|
||||
|
||||
template <std::size_t MemPoolSize_, unsigned OutgoingTransferRegistryStaticEntries>
|
||||
int Node<MemPoolSize_, OutgoingTransferRegistryStaticEntries>::
|
||||
checkNetworkCompatibility(NetworkCompatibilityCheckResult& result)
|
||||
{
|
||||
if (!started_)
|
||||
{
|
||||
return -ErrNotInited;
|
||||
}
|
||||
|
||||
int res = NetworkCompatibilityChecker::publishGlobalDiscoveryRequest(*this);
|
||||
if (res < 0)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
|
||||
NetworkCompatibilityChecker checker(*this);
|
||||
StaticAssert<(sizeof(checker) < 2048)>::check(); // Making sure that the code footprint doesn't explode
|
||||
res = checker.execute();
|
||||
result = checker.getResult();
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif // UAVCAN_NODE_NODE_HPP_INCLUDED
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <uavcan/node/service_server.hpp>
|
||||
#include <uavcan/util/method_binder.hpp>
|
||||
#include <uavcan/build_config.hpp>
|
||||
#include <uavcan/protocol/ComputeAggregateTypeSignature.hpp>
|
||||
#include <uavcan/protocol/GetDataTypeInfo.hpp>
|
||||
#include <uavcan/debug.hpp>
|
||||
|
||||
@@ -21,50 +20,19 @@ namespace uavcan
|
||||
*/
|
||||
class UAVCAN_EXPORT DataTypeInfoProvider : Noncopyable
|
||||
{
|
||||
typedef MethodBinder<DataTypeInfoProvider*,
|
||||
void (DataTypeInfoProvider::*)(const protocol::ComputeAggregateTypeSignature::Request&,
|
||||
protocol::ComputeAggregateTypeSignature::Response&)>
|
||||
ComputeAggregateTypeSignatureCallback;
|
||||
|
||||
typedef MethodBinder<DataTypeInfoProvider*,
|
||||
void (DataTypeInfoProvider::*)(const protocol::GetDataTypeInfo::Request&,
|
||||
protocol::GetDataTypeInfo::Response&)> GetDataTypeInfoCallback;
|
||||
|
||||
ServiceServer<protocol::ComputeAggregateTypeSignature, ComputeAggregateTypeSignatureCallback> cats_srv_;
|
||||
ServiceServer<protocol::GetDataTypeInfo, GetDataTypeInfoCallback> gdti_srv_;
|
||||
|
||||
INode& getNode() { return cats_srv_.getNode(); }
|
||||
INode& getNode() { return gdti_srv_.getNode(); }
|
||||
|
||||
static bool isValidDataTypeKind(DataTypeKind kind)
|
||||
{
|
||||
return (kind == DataTypeKindMessage) || (kind == DataTypeKindService);
|
||||
}
|
||||
|
||||
void handleComputeAggregateTypeSignatureRequest(const protocol::ComputeAggregateTypeSignature::Request& request,
|
||||
protocol::ComputeAggregateTypeSignature::Response&)
|
||||
{
|
||||
const DataTypeKind kind = DataTypeKind(request.kind.value); // No mapping needed
|
||||
if (!isValidDataTypeKind(kind))
|
||||
{
|
||||
UAVCAN_TRACE("DataTypeInfoProvider", "ComputeAggregateTypeSignature request with invalid DataTypeKind %d",
|
||||
kind);
|
||||
return;
|
||||
}
|
||||
|
||||
#if 0 /* TODO FIXME */
|
||||
UAVCAN_TRACE("DataTypeInfoProvider", "ComputeAggregateTypeSignature request for dtk=%d, len(known_ids)=%d",
|
||||
int(request.kind.value), int(request.known_ids.size()));
|
||||
|
||||
// Correcting the mask length according to the data type kind
|
||||
response.mutually_known_ids = request.known_ids;
|
||||
response.mutually_known_ids.resize(
|
||||
static_cast<uint16_t>(DataTypeID::getMaxValueForDataTypeKind(kind).get() + 1U));
|
||||
|
||||
response.aggregate_signature =
|
||||
GlobalDataTypeRegistry::instance().computeAggregateSignature(kind, response.mutually_known_ids).get();
|
||||
#endif
|
||||
}
|
||||
|
||||
void handleGetDataTypeInfoRequest(const protocol::GetDataTypeInfo::Request& request,
|
||||
protocol::GetDataTypeInfo::Response& response)
|
||||
{
|
||||
@@ -140,22 +108,14 @@ class UAVCAN_EXPORT DataTypeInfoProvider : Noncopyable
|
||||
}
|
||||
|
||||
public:
|
||||
explicit DataTypeInfoProvider(INode& node)
|
||||
: cats_srv_(node)
|
||||
, gdti_srv_(node)
|
||||
explicit DataTypeInfoProvider(INode& node) :
|
||||
gdti_srv_(node)
|
||||
{ }
|
||||
|
||||
int start()
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
res = cats_srv_.start(
|
||||
ComputeAggregateTypeSignatureCallback(this, &DataTypeInfoProvider::handleComputeAggregateTypeSignatureRequest));
|
||||
if (res < 0)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
|
||||
res = gdti_srv_.start(GetDataTypeInfoCallback(this, &DataTypeInfoProvider::handleGetDataTypeInfoRequest));
|
||||
if (res < 0)
|
||||
{
|
||||
@@ -167,7 +127,6 @@ public:
|
||||
|
||||
fail:
|
||||
UAVCAN_ASSERT(res < 0);
|
||||
cats_srv_.stop();
|
||||
gdti_srv_.stop();
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -1,281 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef UAVCAN_PROTOCOL_NETWORK_COMPAT_CHECKER_HPP_INCLUDED
|
||||
#define UAVCAN_PROTOCOL_NETWORK_COMPAT_CHECKER_HPP_INCLUDED
|
||||
|
||||
#include <uavcan/build_config.hpp>
|
||||
#include <uavcan/debug.hpp>
|
||||
#include <uavcan/util/bitset.hpp>
|
||||
#include <uavcan/util/method_binder.hpp>
|
||||
#include <uavcan/node/subscriber.hpp>
|
||||
#include <uavcan/node/publisher.hpp>
|
||||
#include <uavcan/node/service_client.hpp>
|
||||
#include <uavcan/protocol/ComputeAggregateTypeSignature.hpp>
|
||||
#include <uavcan/protocol/NodeStatus.hpp>
|
||||
#include <uavcan/protocol/GlobalDiscoveryRequest.hpp>
|
||||
#include <cassert>
|
||||
|
||||
namespace uavcan
|
||||
{
|
||||
|
||||
struct UAVCAN_EXPORT NetworkCompatibilityCheckResult
|
||||
{
|
||||
NodeID conflicting_node; ///< First detected conflicting node
|
||||
uint8_t num_failed_nodes; ///< Number of nodes that did not respond to service requests (probably not supporting)
|
||||
|
||||
NetworkCompatibilityCheckResult()
|
||||
: num_failed_nodes(0)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Quick check if the network compatibility check did not discover any problems.
|
||||
*/
|
||||
bool isOk() const { return !conflicting_node.isValid(); }
|
||||
};
|
||||
|
||||
/**
|
||||
* Performs Network Compatibility Check. Please read the specs.
|
||||
*
|
||||
* This class does not issue GlobalDiscoveryRequest, assuming that it was done already by the caller.
|
||||
* Instantiated object can @ref execute() only once.
|
||||
* Objects of this class are intended for stack allocation.
|
||||
*/
|
||||
class UAVCAN_EXPORT NetworkCompatibilityChecker : Noncopyable
|
||||
{
|
||||
typedef BitSet<NodeID::Max + 1> NodeIDMask;
|
||||
typedef MethodBinder<NetworkCompatibilityChecker*,
|
||||
void (NetworkCompatibilityChecker::*)(const ReceivedDataStructure<protocol::NodeStatus>&)>
|
||||
NodeStatusCallback;
|
||||
typedef MethodBinder<NetworkCompatibilityChecker*,
|
||||
void (NetworkCompatibilityChecker::*)(ServiceCallResult<protocol::ComputeAggregateTypeSignature>&)>
|
||||
CATSResponseCallback;
|
||||
|
||||
Subscriber<protocol::NodeStatus, NodeStatusCallback> ns_sub_;
|
||||
ServiceClient<protocol::ComputeAggregateTypeSignature, CATSResponseCallback> cats_cln_;
|
||||
NodeIDMask nid_mask_present_;
|
||||
NodeIDMask nid_mask_checked_;
|
||||
NetworkCompatibilityCheckResult result_;
|
||||
DataTypeKind checking_dtkind_;
|
||||
bool last_cats_request_ok_;
|
||||
|
||||
INode& getNode() { return ns_sub_.getNode(); }
|
||||
const INode& getNode() const { return ns_sub_.getNode(); }
|
||||
|
||||
MonotonicDuration getNetworkDiscoveryDelay() const
|
||||
{
|
||||
// Base duration is constant - NodeStatus max publication period
|
||||
MonotonicDuration dur = MonotonicDuration::fromMSec(protocol::NodeStatus::MAX_PUBLICATION_PERIOD_MS);
|
||||
// Additional duration depends on the node priority - gets larger with higher Node ID
|
||||
dur += MonotonicDuration::fromMSec(getNode().getNodeID().get() * 10);
|
||||
return dur;
|
||||
}
|
||||
|
||||
NodeID findNextUncheckedNode()
|
||||
{
|
||||
for (uint8_t i = 1; i <= NodeID::Max; i++)
|
||||
{
|
||||
if (nid_mask_present_.test(i) && !nid_mask_checked_.test(i))
|
||||
{
|
||||
nid_mask_checked_[i] = true;
|
||||
return NodeID(i);
|
||||
}
|
||||
}
|
||||
return NodeID();
|
||||
}
|
||||
|
||||
int waitForCATSResponse()
|
||||
{
|
||||
while (cats_cln_.hasPendingCalls())
|
||||
{
|
||||
const int res = getNode().spin(MonotonicDuration::fromMSec(10));
|
||||
if (res < 0 || !result_.isOk())
|
||||
{
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void handleNodeStatus(const ReceivedDataStructure<protocol::NodeStatus>& msg)
|
||||
{
|
||||
if (!nid_mask_present_.test(msg.getSrcNodeID().get()))
|
||||
{
|
||||
UAVCAN_TRACE("NodeInitializer", "New node nid=%i", int(msg.getSrcNodeID().get()));
|
||||
nid_mask_present_[msg.getSrcNodeID().get()] = true;
|
||||
}
|
||||
|
||||
if (msg.getSrcNodeID() == getNode().getNodeID())
|
||||
{
|
||||
UAVCAN_TRACE("NodeInitializer", "Node ID collision; nid=%i", int(msg.getSrcNodeID().get()));
|
||||
result_.conflicting_node = msg.getSrcNodeID();
|
||||
}
|
||||
}
|
||||
|
||||
void handleCATSResponse(ServiceCallResult<protocol::ComputeAggregateTypeSignature>& resp)
|
||||
{
|
||||
last_cats_request_ok_ = resp.isSuccessful();
|
||||
if (last_cats_request_ok_)
|
||||
{
|
||||
#if 0 /* TODO FIXME */
|
||||
const DataTypeSignature sign = GlobalDataTypeRegistry::instance().
|
||||
computeAggregateSignature(checking_dtkind_, resp.getResponse().mutually_known_ids);
|
||||
|
||||
UAVCAN_TRACE("NodeInitializer", "CATS response from nid=%i; local=%llu remote=%llu",
|
||||
int(resp.getCallID().server_node_id.get()), static_cast<unsigned long long>(sign.get()),
|
||||
static_cast<unsigned long long>(resp.getResponse().aggregate_signature));
|
||||
|
||||
if (sign.get() != resp.getResponse().aggregate_signature)
|
||||
{
|
||||
result_.conflicting_node = resp.getCallID().server_node_id;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
int checkOneNodeOneDataTypeKind(NodeID nid, DataTypeKind kind)
|
||||
{
|
||||
StaticAssert<DataTypeKindMessage == int(protocol::DataTypeKind::MESSAGE)>::check();
|
||||
StaticAssert<DataTypeKindService == int(protocol::DataTypeKind::SERVICE)>::check();
|
||||
|
||||
UAVCAN_ASSERT(nid.isUnicast());
|
||||
UAVCAN_ASSERT(!cats_cln_.hasPendingCalls());
|
||||
|
||||
checking_dtkind_ = kind;
|
||||
protocol::ComputeAggregateTypeSignature::Request request;
|
||||
request.kind.value = kind;
|
||||
// TODO FIXME
|
||||
// GlobalDataTypeRegistry::instance().getDataTypeIDMask(kind, request.known_ids);
|
||||
|
||||
int res = cats_cln_.call(nid, request);
|
||||
if (res < 0)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
res = waitForCATSResponse();
|
||||
if (res < 0)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
if (!last_cats_request_ok_)
|
||||
{
|
||||
return -ErrFailure;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int checkOneNode(NodeID nid)
|
||||
{
|
||||
if (nid == getNode().getNodeID())
|
||||
{
|
||||
result_.conflicting_node = nid; // NodeID collision
|
||||
return 0;
|
||||
}
|
||||
|
||||
const int res = checkOneNodeOneDataTypeKind(nid, DataTypeKindMessage);
|
||||
if (res < 0 || !result_.isOk())
|
||||
{
|
||||
return res;
|
||||
}
|
||||
return checkOneNodeOneDataTypeKind(nid, DataTypeKindService);
|
||||
}
|
||||
|
||||
int checkNodes()
|
||||
{
|
||||
(void)nid_mask_checked_.reset();
|
||||
result_ = NetworkCompatibilityCheckResult();
|
||||
|
||||
while (result_.isOk())
|
||||
{
|
||||
const NodeID nid = findNextUncheckedNode();
|
||||
if (nid.isValid())
|
||||
{
|
||||
UAVCAN_TRACE("NodeInitializer", "Checking nid=%i", int(nid.get()));
|
||||
const int res = checkOneNode(nid);
|
||||
if (res < 0)
|
||||
{
|
||||
result_.num_failed_nodes++;
|
||||
}
|
||||
UAVCAN_TRACE("NodeInitializer", "Checked nid=%i result=%i", int(nid.get()), res);
|
||||
}
|
||||
else { break; }
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public:
|
||||
explicit NetworkCompatibilityChecker(INode& node)
|
||||
: ns_sub_(node)
|
||||
, cats_cln_(node)
|
||||
, checking_dtkind_(DataTypeKindService)
|
||||
, last_cats_request_ok_(false)
|
||||
{ }
|
||||
|
||||
/**
|
||||
* Run the check.
|
||||
* Beware: this method may block for a several seconds!
|
||||
*
|
||||
* If this method has been executed successfully, use @ref getResult() to get the actual check result.
|
||||
*
|
||||
* This method can be executed only once on a given instance of this class (shall be
|
||||
* destroyed and reconstructed from scratch).
|
||||
*
|
||||
* Returns negative error code.
|
||||
*/
|
||||
int execute()
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
if (!getNode().getNodeID().isUnicast())
|
||||
{
|
||||
result_.conflicting_node = getNode().getNodeID();
|
||||
goto exit;
|
||||
}
|
||||
|
||||
res = ns_sub_.start(NodeStatusCallback(this, &NetworkCompatibilityChecker::handleNodeStatus));
|
||||
if (res < 0)
|
||||
{
|
||||
goto exit;
|
||||
}
|
||||
|
||||
cats_cln_.setCallback(CATSResponseCallback(this, &NetworkCompatibilityChecker::handleCATSResponse));
|
||||
res = cats_cln_.init();
|
||||
if (res < 0)
|
||||
{
|
||||
goto exit;
|
||||
}
|
||||
|
||||
res = getNode().spin(getNetworkDiscoveryDelay());
|
||||
if (res < 0)
|
||||
{
|
||||
goto exit;
|
||||
}
|
||||
|
||||
res = checkNodes();
|
||||
|
||||
exit:
|
||||
ns_sub_.stop();
|
||||
cats_cln_.cancelAllCalls();
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method can return a meaningful result only if @ref execute() has been executed successfully once.
|
||||
*/
|
||||
const NetworkCompatibilityCheckResult& getResult() const { return result_; }
|
||||
|
||||
/**
|
||||
* Convenience method. Should be called immediately before @ref execute().
|
||||
* Returns negative error code.
|
||||
*/
|
||||
static int publishGlobalDiscoveryRequest(INode& node)
|
||||
{
|
||||
Publisher<protocol::GlobalDiscoveryRequest> pub(node);
|
||||
return pub.broadcast(protocol::GlobalDiscoveryRequest());
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // UAVCAN_PROTOCOL_NETWORK_COMPAT_CHECKER_HPP_INCLUDED
|
||||
@@ -196,75 +196,4 @@ const DataTypeDescriptor* GlobalDataTypeRegistry::find(DataTypeKind kind, DataTy
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DataTypeSignature GlobalDataTypeRegistry::computeAggregateSignature(DataTypeKind kind,
|
||||
DataTypeIDMask& inout_id_mask) const
|
||||
{
|
||||
UAVCAN_ASSERT(isFrozen()); // Computing the signature if the registry is not frozen is pointless
|
||||
|
||||
const List* list = selectList(kind);
|
||||
if (!list)
|
||||
{
|
||||
UAVCAN_ASSERT(0);
|
||||
return DataTypeSignature();
|
||||
}
|
||||
|
||||
int prev_dtid = -1;
|
||||
DataTypeSignature signature;
|
||||
bool signature_initialized = false;
|
||||
Entry* p = list->get();
|
||||
while (p)
|
||||
{
|
||||
const DataTypeDescriptor& desc = p->descriptor;
|
||||
const int dtid = desc.getID().get();
|
||||
|
||||
if (inout_id_mask[unsigned(dtid)])
|
||||
{
|
||||
if (signature_initialized)
|
||||
{
|
||||
signature.extend(desc.getSignature());
|
||||
}
|
||||
else
|
||||
{
|
||||
signature = DataTypeSignature(desc.getSignature());
|
||||
}
|
||||
signature_initialized = true;
|
||||
}
|
||||
|
||||
UAVCAN_ASSERT(prev_dtid < dtid); // Making sure that list is ordered properly
|
||||
prev_dtid++;
|
||||
while (prev_dtid < dtid)
|
||||
{
|
||||
inout_id_mask[unsigned(prev_dtid++)] = false; // Erasing bits for missing types
|
||||
}
|
||||
UAVCAN_ASSERT(prev_dtid == dtid);
|
||||
|
||||
p = p->getNextListNode();
|
||||
}
|
||||
prev_dtid++;
|
||||
while (unsigned(prev_dtid) < inout_id_mask.size())
|
||||
{
|
||||
inout_id_mask[unsigned(prev_dtid++)] = false;
|
||||
}
|
||||
|
||||
return signature;
|
||||
}
|
||||
|
||||
void GlobalDataTypeRegistry::getDataTypeIDMask(DataTypeKind kind, DataTypeIDMask& mask) const
|
||||
{
|
||||
(void)mask.reset();
|
||||
const List* list = selectList(kind);
|
||||
if (!list)
|
||||
{
|
||||
UAVCAN_ASSERT(0);
|
||||
return;
|
||||
}
|
||||
Entry* p = list->get();
|
||||
while (p)
|
||||
{
|
||||
UAVCAN_ASSERT(p->descriptor.getKind() == kind);
|
||||
mask[p->descriptor.getID().get()] = true;
|
||||
p = p->getNextListNode();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <uavcan/helpers/ostream.hpp>
|
||||
|
||||
#include <uavcan/Timestamp.hpp>
|
||||
#include <uavcan/protocol/ComputeAggregateTypeSignature.hpp>
|
||||
#include <uavcan/protocol/GetTransportStats.hpp>
|
||||
#include <uavcan/protocol/Panic.hpp>
|
||||
#include <uavcan/protocol/RestartNode.hpp>
|
||||
|
||||
@@ -61,7 +61,6 @@ uavcan::DataTypeDescriptor extractDescriptor(uint16_t dtid = Type::DefaultDataTy
|
||||
TEST(GlobalDataTypeRegistry, Basic)
|
||||
{
|
||||
using uavcan::GlobalDataTypeRegistry;
|
||||
using uavcan::DataTypeIDMask;
|
||||
using uavcan::DataTypeSignature;
|
||||
|
||||
GlobalDataTypeRegistry::instance().reset();
|
||||
@@ -69,14 +68,6 @@ TEST(GlobalDataTypeRegistry, Basic)
|
||||
ASSERT_EQ(0, GlobalDataTypeRegistry::instance().getNumMessageTypes());
|
||||
ASSERT_EQ(0, GlobalDataTypeRegistry::instance().getNumServiceTypes());
|
||||
|
||||
DataTypeIDMask dtmask;
|
||||
dtmask.set();
|
||||
GlobalDataTypeRegistry::instance().getDataTypeIDMask(uavcan::DataTypeKindMessage, dtmask);
|
||||
ASSERT_FALSE(dtmask.any());
|
||||
dtmask.set();
|
||||
GlobalDataTypeRegistry::instance().getDataTypeIDMask(uavcan::DataTypeKindService, dtmask);
|
||||
ASSERT_FALSE(dtmask.any());
|
||||
|
||||
/*
|
||||
* Static registrations
|
||||
*/
|
||||
@@ -86,12 +77,6 @@ TEST(GlobalDataTypeRegistry, Basic)
|
||||
ASSERT_EQ(2, GlobalDataTypeRegistry::instance().getNumMessageTypes());
|
||||
ASSERT_EQ(0, GlobalDataTypeRegistry::instance().getNumServiceTypes());
|
||||
|
||||
GlobalDataTypeRegistry::instance().getDataTypeIDMask(uavcan::DataTypeKindMessage, dtmask);
|
||||
ASSERT_TRUE(dtmask[0]);
|
||||
ASSERT_TRUE(dtmask[42]);
|
||||
dtmask[0] = dtmask[42] = false;
|
||||
ASSERT_FALSE(dtmask.any());
|
||||
|
||||
/*
|
||||
* Runtime registrations
|
||||
*/
|
||||
@@ -102,11 +87,6 @@ TEST(GlobalDataTypeRegistry, Basic)
|
||||
ASSERT_EQ(2, GlobalDataTypeRegistry::instance().getNumMessageTypes());
|
||||
ASSERT_EQ(1, GlobalDataTypeRegistry::instance().getNumServiceTypes());
|
||||
|
||||
GlobalDataTypeRegistry::instance().getDataTypeIDMask(uavcan::DataTypeKindService, dtmask);
|
||||
ASSERT_TRUE(dtmask[0]);
|
||||
dtmask[0] = false;
|
||||
ASSERT_FALSE(dtmask.any());
|
||||
|
||||
/*
|
||||
* Runtime re-registration
|
||||
*/
|
||||
@@ -118,17 +98,6 @@ TEST(GlobalDataTypeRegistry, Basic)
|
||||
ASSERT_EQ(2, GlobalDataTypeRegistry::instance().getNumMessageTypes());
|
||||
ASSERT_EQ(1, GlobalDataTypeRegistry::instance().getNumServiceTypes());
|
||||
|
||||
GlobalDataTypeRegistry::instance().getDataTypeIDMask(uavcan::DataTypeKindMessage, dtmask);
|
||||
ASSERT_TRUE(dtmask[0]);
|
||||
ASSERT_TRUE(dtmask[741]);
|
||||
dtmask[0] = dtmask[741] = false;
|
||||
ASSERT_FALSE(dtmask.any());
|
||||
|
||||
GlobalDataTypeRegistry::instance().getDataTypeIDMask(uavcan::DataTypeKindService, dtmask);
|
||||
ASSERT_TRUE(dtmask[147]);
|
||||
dtmask[147] = false;
|
||||
ASSERT_FALSE(dtmask.any());
|
||||
|
||||
/*
|
||||
* These types will be necessary for the aggregate signature test
|
||||
*/
|
||||
@@ -139,19 +108,6 @@ TEST(GlobalDataTypeRegistry, Basic)
|
||||
GlobalDataTypeRegistry::instance().registerDataType<DataTypeC>(DataTypeC::DefaultDataTypeID));
|
||||
uavcan::DefaultDataTypeRegistrator<DataTypeD> reg_DataTypeD;
|
||||
|
||||
GlobalDataTypeRegistry::instance().getDataTypeIDMask(uavcan::DataTypeKindMessage, dtmask);
|
||||
ASSERT_TRUE(dtmask[0]);
|
||||
ASSERT_TRUE(dtmask[741]);
|
||||
ASSERT_TRUE(dtmask[1023]);
|
||||
dtmask[0] = dtmask[1023] = dtmask[741] = false;
|
||||
ASSERT_FALSE(dtmask.any());
|
||||
|
||||
GlobalDataTypeRegistry::instance().getDataTypeIDMask(uavcan::DataTypeKindService, dtmask);
|
||||
ASSERT_TRUE(dtmask[147]);
|
||||
ASSERT_TRUE(dtmask[43]);
|
||||
dtmask[43] = dtmask[147] = false;
|
||||
ASSERT_FALSE(dtmask.any());
|
||||
|
||||
/*
|
||||
* Frozen state
|
||||
*/
|
||||
@@ -199,73 +155,6 @@ TEST(GlobalDataTypeRegistry, Basic)
|
||||
}
|
||||
|
||||
|
||||
TEST(GlobalDataTypeRegistry, AggregateSignature)
|
||||
{
|
||||
using uavcan::GlobalDataTypeRegistry;
|
||||
using uavcan::DataTypeIDMask;
|
||||
using uavcan::DataTypeSignature;
|
||||
|
||||
ASSERT_TRUE(GlobalDataTypeRegistry::instance().isFrozen());
|
||||
|
||||
DataTypeIDMask mask;
|
||||
DataTypeSignature sign;
|
||||
|
||||
// Zero - empty mask
|
||||
sign = GlobalDataTypeRegistry::instance().computeAggregateSignature(uavcan::DataTypeKindMessage, mask);
|
||||
|
||||
ASSERT_EQ(DataTypeSignature(), sign);
|
||||
ASSERT_FALSE(mask.any());
|
||||
|
||||
// All set
|
||||
mask.set();
|
||||
sign = GlobalDataTypeRegistry::instance().computeAggregateSignature(uavcan::DataTypeKindMessage, mask);
|
||||
ASSERT_TRUE(mask[0]); // DataTypeAMessage
|
||||
ASSERT_TRUE(mask[741]); // DataTypeB
|
||||
ASSERT_TRUE(mask[1023]); // DataTypeC
|
||||
mask[0] = mask[741] = mask[1023] = false;
|
||||
ASSERT_FALSE(mask.any());
|
||||
{
|
||||
DataTypeSignature check_signature(DataTypeAMessage::getDataTypeSignature()); // Order matters - low --> high
|
||||
check_signature.extend(DataTypeB::getDataTypeSignature());
|
||||
check_signature.extend(DataTypeC::getDataTypeSignature());
|
||||
ASSERT_EQ(check_signature, sign);
|
||||
}
|
||||
|
||||
mask.set();
|
||||
sign = GlobalDataTypeRegistry::instance().computeAggregateSignature(uavcan::DataTypeKindService, mask);
|
||||
ASSERT_TRUE(mask[43]); // DataTypeD
|
||||
ASSERT_TRUE(mask[147]); // DataTypeAService
|
||||
mask[43] = mask[147] = false;
|
||||
ASSERT_FALSE(mask.any());
|
||||
{
|
||||
DataTypeSignature check_signature(DataTypeD::getDataTypeSignature());
|
||||
check_signature.extend(DataTypeAService::getDataTypeSignature());
|
||||
ASSERT_EQ(check_signature, sign);
|
||||
}
|
||||
|
||||
// Random
|
||||
mask[0] = mask[99] = mask[147] = mask[741] = mask[999] = mask[1022] = true;
|
||||
sign = GlobalDataTypeRegistry::instance().computeAggregateSignature(uavcan::DataTypeKindMessage, mask);
|
||||
ASSERT_TRUE(mask[0]); // DataTypeAMessage
|
||||
ASSERT_TRUE(mask[741]); // DataTypeB
|
||||
mask[0] = mask[741] = false;
|
||||
ASSERT_FALSE(mask.any());
|
||||
{
|
||||
DataTypeSignature check_signature(DataTypeAMessage::getDataTypeSignature()); // Order matters - low --> high
|
||||
check_signature.extend(DataTypeB::getDataTypeSignature());
|
||||
ASSERT_EQ(check_signature, sign);
|
||||
}
|
||||
|
||||
// One
|
||||
mask[1] = mask[43] = true;
|
||||
sign = GlobalDataTypeRegistry::instance().computeAggregateSignature(uavcan::DataTypeKindService, mask);
|
||||
ASSERT_TRUE(mask[43]); // DataTypeD
|
||||
mask[43] = false;
|
||||
ASSERT_FALSE(mask.any());
|
||||
ASSERT_EQ(DataTypeD::getDataTypeSignature(), sign);
|
||||
}
|
||||
|
||||
|
||||
TEST(GlobalDataTypeRegistry, Reset)
|
||||
{
|
||||
using uavcan::GlobalDataTypeRegistry;
|
||||
|
||||
@@ -14,7 +14,6 @@ static void registerTypes()
|
||||
uavcan::GlobalDataTypeRegistry::instance().reset();
|
||||
uavcan::DefaultDataTypeRegistrator<uavcan::protocol::GlobalDiscoveryRequest> _reg1;
|
||||
uavcan::DefaultDataTypeRegistrator<uavcan::protocol::NodeStatus> _reg2;
|
||||
uavcan::DefaultDataTypeRegistrator<uavcan::protocol::ComputeAggregateTypeSignature> _reg3;
|
||||
uavcan::DefaultDataTypeRegistrator<uavcan::protocol::GetNodeInfo> _reg4;
|
||||
uavcan::DefaultDataTypeRegistrator<uavcan::protocol::GetDataTypeInfo> _reg5;
|
||||
uavcan::DefaultDataTypeRegistrator<uavcan::protocol::debug::LogMessage> _reg6;
|
||||
@@ -59,11 +58,7 @@ TEST(Node, Basic)
|
||||
/*
|
||||
* Init the second node - network is empty
|
||||
*/
|
||||
uavcan::NetworkCompatibilityCheckResult result;
|
||||
ASSERT_LE(0, node2.start());
|
||||
ASSERT_LE(0, node2.checkNetworkCompatibility(result));
|
||||
ASSERT_TRUE(result.isOk());
|
||||
|
||||
ASSERT_FALSE(node_status_monitor.findNodeWithWorstStatus().isValid());
|
||||
|
||||
/*
|
||||
@@ -72,10 +67,10 @@ TEST(Node, Basic)
|
||||
ASSERT_FALSE(node1.isStarted());
|
||||
ASSERT_EQ(-uavcan::ErrNotInited, node1.spin(uavcan::MonotonicDuration::fromMSec(20)));
|
||||
ASSERT_LE(0, node1.start());
|
||||
ASSERT_LE(0, node1.checkNetworkCompatibility(result));
|
||||
ASSERT_TRUE(result.isOk());
|
||||
ASSERT_TRUE(node1.isStarted());
|
||||
|
||||
ASSERT_LE(0, node1.spin(uavcan::MonotonicDuration::fromMSec(2000)));
|
||||
|
||||
ASSERT_EQ(1, node_status_monitor.findNodeWithWorstStatus().get());
|
||||
|
||||
/*
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <uavcan/node/service_client.hpp>
|
||||
#include <uavcan/node/service_server.hpp>
|
||||
#include <uavcan/util/method_binder.hpp>
|
||||
#include <uavcan/protocol/ComputeAggregateTypeSignature.hpp>
|
||||
#include <uavcan/protocol/RestartNode.hpp>
|
||||
#include <uavcan/protocol/GetDataTypeInfo.hpp>
|
||||
#include <root_ns_a/StringService.hpp>
|
||||
@@ -444,15 +443,6 @@ TEST(ServiceClient, Sizes)
|
||||
{
|
||||
using namespace uavcan;
|
||||
|
||||
std::cout << "ComputeAggregateTypeSignature server: " <<
|
||||
sizeof(ServiceServer<protocol::ComputeAggregateTypeSignature>) << std::endl;
|
||||
|
||||
std::cout << "ComputeAggregateTypeSignature client: " <<
|
||||
sizeof(ServiceClient<protocol::ComputeAggregateTypeSignature>) << std::endl;
|
||||
|
||||
std::cout << "ComputeAggregateTypeSignature request data struct: " <<
|
||||
sizeof(protocol::ComputeAggregateTypeSignature::Request) << std::endl;
|
||||
|
||||
std::cout << "GetDataTypeInfo server: " <<
|
||||
sizeof(ServiceServer<protocol::GetDataTypeInfo>) << std::endl;
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ static void registerTypes()
|
||||
uavcan::GlobalDataTypeRegistry::instance().reset();
|
||||
uavcan::DefaultDataTypeRegistrator<uavcan::protocol::GlobalDiscoveryRequest> _reg1;
|
||||
uavcan::DefaultDataTypeRegistrator<uavcan::protocol::NodeStatus> _reg2;
|
||||
uavcan::DefaultDataTypeRegistrator<uavcan::protocol::ComputeAggregateTypeSignature> _reg3;
|
||||
uavcan::DefaultDataTypeRegistrator<uavcan::protocol::GetNodeInfo> _reg4;
|
||||
uavcan::DefaultDataTypeRegistrator<uavcan::protocol::GetDataTypeInfo> _reg5;
|
||||
uavcan::DefaultDataTypeRegistrator<uavcan::protocol::debug::LogMessage> _reg6;
|
||||
@@ -59,11 +58,10 @@ TEST(SubNode, Basic)
|
||||
ASSERT_FALSE(node1.isStarted());
|
||||
ASSERT_EQ(-uavcan::ErrNotInited, node1.spin(uavcan::MonotonicDuration::fromMSec(20)));
|
||||
ASSERT_LE(0, node1.start());
|
||||
uavcan::NetworkCompatibilityCheckResult result;
|
||||
ASSERT_LE(0, node1.checkNetworkCompatibility(result));
|
||||
ASSERT_TRUE(result.isOk());
|
||||
ASSERT_TRUE(node1.isStarted());
|
||||
|
||||
ASSERT_LE(0, node1.spin(uavcan::MonotonicDuration::fromMSec(2000)));
|
||||
|
||||
ASSERT_EQ(1, node_status_monitor.findNodeWithWorstStatus().get());
|
||||
|
||||
/*
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "helpers.hpp"
|
||||
|
||||
using uavcan::protocol::GetDataTypeInfo;
|
||||
using uavcan::protocol::ComputeAggregateTypeSignature;
|
||||
using uavcan::protocol::NodeStatus;
|
||||
using uavcan::protocol::DataTypeKind;
|
||||
using uavcan::ServiceCallResult;
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <uavcan/protocol/network_compat_checker.hpp>
|
||||
#include <uavcan/protocol/node_status_provider.hpp>
|
||||
#include <uavcan/protocol/data_type_info_provider.hpp>
|
||||
#include <uavcan/protocol/GlobalDiscoveryRequest.hpp>
|
||||
#include <memory>
|
||||
#include "helpers.hpp"
|
||||
|
||||
|
||||
static void registerTypes()
|
||||
{
|
||||
uavcan::GlobalDataTypeRegistry::instance().reset();
|
||||
uavcan::DefaultDataTypeRegistrator<uavcan::protocol::GlobalDiscoveryRequest> _reg1;
|
||||
uavcan::DefaultDataTypeRegistrator<uavcan::protocol::NodeStatus> _reg2;
|
||||
uavcan::DefaultDataTypeRegistrator<uavcan::protocol::ComputeAggregateTypeSignature> _reg3;
|
||||
uavcan::DefaultDataTypeRegistrator<uavcan::protocol::GetNodeInfo> _reg4;
|
||||
uavcan::DefaultDataTypeRegistrator<uavcan::protocol::GetDataTypeInfo> _reg5;
|
||||
}
|
||||
|
||||
|
||||
struct NetworkCompatibilityCheckerRemoteContext
|
||||
{
|
||||
uavcan::NodeStatusProvider node_status_provider;
|
||||
uavcan::DataTypeInfoProvider data_type_info_provider;
|
||||
|
||||
NetworkCompatibilityCheckerRemoteContext(uavcan::INode& node)
|
||||
: node_status_provider(node)
|
||||
, data_type_info_provider(node)
|
||||
{
|
||||
node_status_provider.setName("com.example");
|
||||
uavcan::protocol::SoftwareVersion swver;
|
||||
swver.vcs_commit = 1;
|
||||
node_status_provider.setSoftwareVersion(swver);
|
||||
}
|
||||
|
||||
void start()
|
||||
{
|
||||
ASSERT_LE(0, node_status_provider.startAndPublish());
|
||||
ASSERT_LE(0, data_type_info_provider.start());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
TEST(NetworkCompatibilityChecker, Size)
|
||||
{
|
||||
// Objects are subject for stack allocation, hence the size matters
|
||||
std::cout << "sizeof(uavcan::NetworkCompatibilityChecker): "
|
||||
<< sizeof(uavcan::NetworkCompatibilityChecker) << std::endl;
|
||||
ASSERT_TRUE(sizeof(uavcan::NetworkCompatibilityChecker) < 2048);
|
||||
}
|
||||
|
||||
|
||||
TEST(NetworkCompatibilityChecker, EmptyNetwork)
|
||||
{
|
||||
registerTypes();
|
||||
InterlinkedTestNodesWithSysClock nodes;
|
||||
|
||||
ASSERT_LE(0, uavcan::NetworkCompatibilityChecker::publishGlobalDiscoveryRequest(nodes.a));
|
||||
|
||||
uavcan::NetworkCompatibilityChecker ni(nodes.a);
|
||||
ASSERT_LE(0, ni.execute());
|
||||
ASSERT_TRUE(ni.getResult().isOk());
|
||||
}
|
||||
|
||||
|
||||
TEST(NetworkCompatibilityChecker, Success)
|
||||
{
|
||||
registerTypes();
|
||||
InterlinkedTestNodesWithSysClock nodes;
|
||||
NetworkCompatibilityCheckerRemoteContext remote(nodes.b);
|
||||
remote.start();
|
||||
|
||||
BackgroundSpinner bgspinner(nodes.b, nodes.a);
|
||||
bgspinner.startPeriodic(uavcan::MonotonicDuration::fromMSec(10));
|
||||
|
||||
ASSERT_LE(0, uavcan::NetworkCompatibilityChecker::publishGlobalDiscoveryRequest(nodes.a));
|
||||
|
||||
uavcan::NetworkCompatibilityChecker ni(nodes.a);
|
||||
ASSERT_LE(0, ni.execute());
|
||||
ASSERT_TRUE(ni.getResult().isOk());
|
||||
}
|
||||
|
||||
|
||||
TEST(NetworkCompatibilityChecker, RequestTimeout)
|
||||
{
|
||||
registerTypes();
|
||||
InterlinkedTestNodesWithSysClock nodes;
|
||||
NetworkCompatibilityCheckerRemoteContext remote(nodes.b);
|
||||
remote.start();
|
||||
|
||||
ASSERT_LE(0, uavcan::NetworkCompatibilityChecker::publishGlobalDiscoveryRequest(nodes.a));
|
||||
|
||||
uavcan::NetworkCompatibilityChecker ni(nodes.a);
|
||||
// There is no background spinner, so CATS request will time out
|
||||
// Despite the time out, the checker will not report failure
|
||||
ASSERT_EQ(0, ni.execute());
|
||||
|
||||
// The one (and only) node has failed
|
||||
ASSERT_EQ(1, ni.getResult().num_failed_nodes);
|
||||
ASSERT_TRUE(ni.getResult().isOk());
|
||||
}
|
||||
|
||||
|
||||
TEST(NetworkCompatibilityChecker, NodeIDCollision)
|
||||
{
|
||||
registerTypes();
|
||||
InterlinkedTestNodesWithSysClock nodes(8, 8); // Same NID
|
||||
NetworkCompatibilityCheckerRemoteContext remote(nodes.b);
|
||||
remote.start();
|
||||
|
||||
BackgroundSpinner bgspinner(nodes.b, nodes.a);
|
||||
bgspinner.startPeriodic(uavcan::MonotonicDuration::fromMSec(10));
|
||||
|
||||
ASSERT_LE(0, uavcan::NetworkCompatibilityChecker::publishGlobalDiscoveryRequest(nodes.a));
|
||||
|
||||
uavcan::NetworkCompatibilityChecker ni(nodes.a);
|
||||
ASSERT_LE(0, ni.execute());
|
||||
ASSERT_FALSE(ni.getResult().isOk());
|
||||
ASSERT_EQ(8, ni.getResult().conflicting_node.get());
|
||||
}
|
||||
@@ -41,13 +41,6 @@ uavcan_linux::NodePtr initNode(const std::vector<std::string>& ifaces, uavcan::N
|
||||
const int start_res = node->start();
|
||||
ENFORCE(0 == start_res);
|
||||
|
||||
uavcan::NetworkCompatibilityCheckResult check_result;
|
||||
ENFORCE(0 == node->checkNetworkCompatibility(check_result));
|
||||
if (!check_result.isOk())
|
||||
{
|
||||
throw std::runtime_error("Network conflict with node " + std::to_string(check_result.conflicting_node.get()));
|
||||
}
|
||||
|
||||
node->setStatusOk();
|
||||
|
||||
return node;
|
||||
|
||||
@@ -404,13 +404,6 @@ static uavcan_linux::NodePtr initMainNode(const std::vector<std::string>& ifaces
|
||||
const int start_res = node->start();
|
||||
ENFORCE(0 == start_res);
|
||||
|
||||
uavcan::NetworkCompatibilityCheckResult init_result;
|
||||
ENFORCE(0 == node->checkNetworkCompatibility(init_result));
|
||||
if (!init_result.isOk())
|
||||
{
|
||||
throw std::runtime_error("Network conflict with node " + std::to_string(init_result.conflicting_node.get()));
|
||||
}
|
||||
|
||||
node->setStatusOk();
|
||||
return node;
|
||||
}
|
||||
|
||||
@@ -28,16 +28,6 @@ static uavcan_linux::NodePtr initNode(const std::vector<std::string>& ifaces, ua
|
||||
std::cout << "Start returned: " << start_res << std::endl;
|
||||
ENFORCE(0 == start_res);
|
||||
|
||||
/*
|
||||
* Checking if our node conflicts with other nodes. This may take a few seconds.
|
||||
*/
|
||||
uavcan::NetworkCompatibilityCheckResult init_result;
|
||||
ENFORCE(0 == node->checkNetworkCompatibility(init_result));
|
||||
if (!init_result.isOk())
|
||||
{
|
||||
throw std::runtime_error("Network conflict with node " + std::to_string(init_result.conflicting_node.get()));
|
||||
}
|
||||
|
||||
std::cout << "Node started successfully" << std::endl;
|
||||
|
||||
/*
|
||||
|
||||
@@ -19,13 +19,6 @@ static uavcan_linux::NodePtr initNode(const std::vector<std::string>& ifaces, ua
|
||||
|
||||
ENFORCE(0 == node->start());
|
||||
|
||||
uavcan::NetworkCompatibilityCheckResult init_result;
|
||||
ENFORCE(0 == node->checkNetworkCompatibility(init_result));
|
||||
if (!init_result.isOk())
|
||||
{
|
||||
throw std::runtime_error("Network conflict with node " + std::to_string(init_result.conflicting_node.get()));
|
||||
}
|
||||
|
||||
node->setStatusOk();
|
||||
return node;
|
||||
}
|
||||
|
||||
@@ -51,13 +51,6 @@ uavcan_linux::NodePtr initNode(const std::vector<std::string>& ifaces, uavcan::N
|
||||
const int start_res = node->start();
|
||||
ENFORCE(0 == start_res);
|
||||
|
||||
uavcan::NetworkCompatibilityCheckResult check_result;
|
||||
ENFORCE(0 == node->checkNetworkCompatibility(check_result));
|
||||
if (!check_result.isOk())
|
||||
{
|
||||
throw std::runtime_error("Network conflict with node " + std::to_string(check_result.conflicting_node.get()));
|
||||
}
|
||||
|
||||
node->setStatusOk();
|
||||
|
||||
return node;
|
||||
|
||||
Reference in New Issue
Block a user