mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 15:37:34 +08:00
Linux test - nodetool - enumeration support
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <uavcan/protocol/param/GetSet.hpp>
|
||||
#include <uavcan/protocol/param/SaveErase.hpp>
|
||||
#include <uavcan/protocol/EnumerationRequest.hpp>
|
||||
#include <uavcan/equipment/hardpoint/Command.hpp>
|
||||
|
||||
namespace
|
||||
@@ -204,6 +205,22 @@ void executeCommand(const uavcan_linux::NodePtr& node, const std::string& cmd,
|
||||
(void)pub->unicast(msg, node_id);
|
||||
}
|
||||
}
|
||||
else if (cmd == "enum")
|
||||
{
|
||||
uavcan::protocol::EnumerationRequest msg;
|
||||
msg.node_id = std::stoi(args.at(0));
|
||||
msg.timeout_sec = (args.size() > 1) ? std::stoi(args.at(1)) : 60;
|
||||
std::cout << msg << std::endl;
|
||||
auto pub = node->makePublisher<uavcan::protocol::EnumerationRequest>();
|
||||
if (node_id.isBroadcast())
|
||||
{
|
||||
(void)pub->broadcast(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)pub->unicast(msg, node_id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Invalid command" << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user