@@ -296,7 +296,7 @@ inline auto makePseudoUniqueID(const SystemInfo::UniqueID& uid) -> std::uint64_t
296
296
297
297
// / If the local-ID is provided, the filter will match only on service transfers addressed to the local node.
298
298
// / If the local-ID is not provided, the filter will match on PnP allocation response messages only.
299
- template <std::uint8_t UAVCANVersion >
299
+ template <std::uint8_t Version >
300
300
[[nodiscard]] auto makeAcceptanceFilter (const std::optional<std::uint8_t > local_node_id) -> CANAcceptanceFilterConfig;
301
301
template <>
302
302
[[nodiscard]] inline auto makeAcceptanceFilter<0 >(const std::optional<std::uint8_t > local_node_id)
@@ -383,7 +383,7 @@ struct ServiceFrameModel : FrameModel
383
383
const std::uint8_t transfer_id = (tail & MaxTransferID);
384
384
if (start_of_transfer && (!toggle))
385
385
{
386
- return {}; // UAVCAN v0
386
+ return {}; // DroneCAN
387
387
}
388
388
if (((!start_of_transfer) || (!end_of_transfer)) && (out_payload_size == 0 ))
389
389
{
@@ -450,7 +450,7 @@ struct ServiceFrameModel : FrameModel
450
450
-> std::optional<std::variant<MessageFrameModel, ServiceFrameModel>>
451
451
{
452
452
KOCHERGA_ASSERT (payload != nullptr );
453
- if ((payload_size < 1 ) || (payload_size > 8 )) // Legacy UAVCAN v0 is compatible only with Classic CAN.
453
+ if ((payload_size < 1 ) || (payload_size > 8 )) // Legacy is compatible only with Classic CAN.
454
454
{ // This is because the low granularity of DLC in CAN FD breaks TAO.
455
455
return {};
456
456
}
@@ -462,7 +462,7 @@ struct ServiceFrameModel : FrameModel
462
462
const std::uint8_t transfer_id = (tail & MaxTransferID);
463
463
if (start_of_transfer && toggle)
464
464
{
465
- return {}; // UAVCAN v1
465
+ return {}; // Cyphal
466
466
}
467
467
const auto priority = static_cast <std::uint8_t >((extended_can_id >> 24U ) & 31U );
468
468
const auto source_node_id = static_cast <std::uint8_t >(extended_can_id & 0x7FU );
@@ -671,7 +671,7 @@ class BasicTransferReasmV0
671
671
}
672
672
if (frame.payload_size > (buffer_.size () - state_->payload_size ))
673
673
{
674
- state_.reset (); // Too much payload -- UAVCAN v0 does not define payload truncation.
674
+ state_.reset (); // Too much payload -- DroneCAN does not define payload truncation.
675
675
return {};
676
676
}
677
677
std::copy_n (frame.payload , frame.payload_size , buffer_.begin () + state_->payload_size );
@@ -778,7 +778,7 @@ class BasicServiceTransferReasmV0 : public BasicTransferReasmV0<MaxPayloadSize>
778
778
const std::uint8_t local_node_id_;
779
779
};
780
780
781
- // / Send one UAVCAN /CAN v1 transfer. The push_frame callback is invoked per each transmitted frame; its type should be:
781
+ // / Send one Cyphal /CAN transfer. The push_frame callback is invoked per each transmitted frame; its type should be:
782
782
// / (std::size_t, const std::uint8_t*) -> bool
783
783
// / The return value is true on success, false otherwise.
784
784
// / The callback shall not be an std::function<> or std::bind<> to avoid heap allocation.
@@ -1070,7 +1070,7 @@ class IActivity
1070
1070
auto operator =(IActivity&&) -> IActivity& = delete ;
1071
1071
};
1072
1072
1073
- // / The v0 main activity is a simplified translation layer between UAVCAN /CAN v1 and UAVCAN v0 .
1073
+ // / The v0 main activity is a simplified translation layer between Cyphal /CAN and DroneCAN .
1074
1074
// / The following ports are supported:
1075
1075
// /
1076
1076
// / Service RX TX
@@ -1437,7 +1437,7 @@ class V0MainActivity : public IActivity
1437
1437
BasicServiceTransferReasmV0<300 > rx_res_file_read_{FileReadSignature, local_node_id_};
1438
1438
};
1439
1439
1440
- // / The following example shows the CAN exchange dump collected from a real network using the old UAVCAN v0 GUI Tool.
1440
+ // / The following example shows the CAN exchange dump collected from a real network using the old GUI Tool.
1441
1441
// /
1442
1442
// / Unique-ID of the allocatee: 35 FF D5 05 50 59 31 34 61 41 23 43 00 00 00 00
1443
1443
// / Preferred node-ID: 0 (any, no preference)
@@ -1619,7 +1619,6 @@ class V0NodeIDAllocationActivity : public IActivity
1619
1619
KOCHERGA_ASSERT ((0 <= randomized) && (randomized <= delta));
1620
1620
const auto delay = std::max (std::chrono::microseconds (1 ), range.first ) + std::chrono::microseconds (randomized);
1621
1621
KOCHERGA_ASSERT (range.first <= delay);
1622
- KOCHERGA_ASSERT (range.second >= delay);
1623
1622
deadline_ = now + delay;
1624
1623
}
1625
1624
@@ -2090,17 +2089,17 @@ class VersionDetectionActivity : public IActivity
2090
2089
while (const auto frame = driver_.pop (buf))
2091
2090
{
2092
2091
const auto [can_id, payload_size] = *frame;
2093
- if (payload_size > 0 ) // UAVCAN frames are guaranteed to contain the tail byte always.
2092
+ if (payload_size > 0 ) // Cyphal frames are guaranteed to contain the tail byte always.
2094
2093
{
2095
- if (const auto uavcan_version = tryDetectVersionFromFrame (can_id, buf.at (payload_size - 1U )))
2094
+ if (const auto version = tryDetectVersionFromFrame (can_id, buf.at (payload_size - 1U )))
2096
2095
{
2097
2096
if (!highest_version_seen_)
2098
2097
{
2099
2098
deadline_ = uptime + ListeningPeriod;
2100
2099
}
2101
- if ((!highest_version_seen_) || (*highest_version_seen_ < *uavcan_version ))
2100
+ if ((!highest_version_seen_) || (*highest_version_seen_ < *version ))
2102
2101
{
2103
- highest_version_seen_ = uavcan_version ;
2102
+ highest_version_seen_ = version ;
2104
2103
KOCHERGA_ASSERT (highest_version_seen_);
2105
2104
}
2106
2105
}
@@ -2114,7 +2113,7 @@ class VersionDetectionActivity : public IActivity
2114
2113
-> std::optional<std::uint8_t>
2115
2114
{
2116
2115
// CAN ID is not validated at the moment. This may be improved in the future to avoid misdetection if there
2117
- // are other protocols besides UAVCAN on the same network.
2116
+ // are other protocols besides Cyphal on the same network.
2118
2117
(void ) can_id;
2119
2118
if ((tail_byte & TailByteStartOfTransfer) != 0 )
2120
2119
{
@@ -2200,22 +2199,23 @@ class BitrateDetectionActivity : public IActivity
2200
2199
2201
2200
} // namespace detail
2202
2201
2203
- // / Kocherga node implementing the UAVCAN /CAN v1 transport along with UAVCAN v0 with automatic version detection.
2202
+ // / Kocherga node implementing the Cyphal /CAN transport along with DroneCAN with automatic version detection.
2204
2203
class CANNode : public kocherga ::INode
2205
2204
{
2206
2205
public:
2207
2206
// / The local UID shall be the same that is passed to the bootloader. It is used for PnP node-ID allocation.
2207
+ // / The protocol version is 0 for DroneCAN (derived from legacy UAVCAN v0) and 1 for Cyphal/CAN.
2208
2208
// / By default, this implementation will auto-detect the parameters of the network and do a PnP node-ID allocation.
2209
2209
// / The application can opt-out of autoconfiguration by providing the required data to the constructor.
2210
2210
// / Unknown parameters shall be set to empty options.
2211
2211
CANNode (ICANDriver& driver,
2212
2212
const SystemInfo::UniqueID& local_unique_id,
2213
- const std::optional<ICANDriver::Bitrate>& can_bitrate = {},
2214
- const std::optional<std::uint8_t > uavcan_version = {},
2215
- const std::optional<NodeID> local_node_id = {})
2213
+ const std::optional<ICANDriver::Bitrate>& can_bitrate = {},
2214
+ const std::optional<std::uint8_t > protocol_version = {},
2215
+ const std::optional<NodeID> local_node_id = {})
2216
2216
{
2217
- if ((activity_ == nullptr ) && can_bitrate && //
2218
- uavcan_version && (*uavcan_version == 0 ) && //
2217
+ if ((activity_ == nullptr ) && can_bitrate && //
2218
+ protocol_version && (*protocol_version == 0 ) && //
2219
2219
local_node_id && (*local_node_id > 0 ) && (*local_node_id <= MaxNodeID))
2220
2220
{
2221
2221
if (const auto bus_mode =
@@ -2229,8 +2229,8 @@ class CANNode : public kocherga::INode
2229
2229
static_cast <std::uint8_t >(*local_node_id));
2230
2230
}
2231
2231
}
2232
- if ((activity_ == nullptr ) && can_bitrate && //
2233
- uavcan_version && (*uavcan_version == 1 ) && //
2232
+ if ((activity_ == nullptr ) && can_bitrate && //
2233
+ protocol_version && (*protocol_version == 1 ) && //
2234
2234
local_node_id && (*local_node_id <= MaxNodeID))
2235
2235
{
2236
2236
if (const auto bus_mode =
@@ -2244,7 +2244,7 @@ class CANNode : public kocherga::INode
2244
2244
static_cast <std::uint8_t >(*local_node_id));
2245
2245
}
2246
2246
}
2247
- if ((activity_ == nullptr ) && can_bitrate && uavcan_version && (*uavcan_version == 0 ))
2247
+ if ((activity_ == nullptr ) && can_bitrate && protocol_version && (*protocol_version == 0 ))
2248
2248
{
2249
2249
if (const auto bus_mode = driver.configure (*can_bitrate, false , detail::makeAcceptanceFilter<0 >({})))
2250
2250
{
@@ -2255,7 +2255,7 @@ class CANNode : public kocherga::INode
2255
2255
*can_bitrate);
2256
2256
}
2257
2257
}
2258
- if ((activity_ == nullptr ) && can_bitrate && uavcan_version && (*uavcan_version == 1 ))
2258
+ if ((activity_ == nullptr ) && can_bitrate && protocol_version && (*protocol_version == 1 ))
2259
2259
{
2260
2260
if (const auto bus_mode = driver.configure (*can_bitrate, false , detail::makeAcceptanceFilter<1 >({})))
2261
2261
{
0 commit comments