From 15949eac7a4f2df01b487de7a0f6484086a4ab9d Mon Sep 17 00:00:00 2001 From: maksimdrachov <39975120+maksimdrachov@users.noreply.github.com> Date: Wed, 13 Mar 2024 18:01:55 +0200 Subject: [PATCH 1/3] Add example for call command (#98) Question: Is there a way to this: ``` yakut call 125 435:uavcan.node.ExecuteCommand '{command: COMMAND_RESTART, parameter: "firmware.bin"}' ``` Instead of this: ``` yakut call 125 435:uavcan.node.ExecuteCommand '{command: 65533, parameter: "firmware.bin"}' ``` [Relevant forum question](https://forum.opencyphal.org/t/yakut-file-commands/1815/2) --------- Co-authored-by: Pavel Kirienko --- README.md | 10 ++++++++-- yakut/VERSION | 2 +- yakut/cmd/call.py | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index efa2e3e..617b5a7 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ There are certain registers that are looked at by Cyphal nodes to determine how If the available registers define more than one transport configuration, a redundant transport will be initialized. It is not necessary to assign all of these registers to use a particular transport because all of them except `uavcan.*.iface` come with defaults. | Transport | Register name | Register type | Environment variable name | Semantics | Example environment variable value | -|-----------|-----------------------|----------------|---------------------------|------------------------------------------------------------|-------------------------------------| +| --------- | --------------------- | -------------- | ------------------------- | ---------------------------------------------------------- | ----------------------------------- | | (any) | `uavcan.node.id` | `natural16[1]` | `UAVCAN__NODE__ID` | The local node-ID; anonymous if not set | `42` | | UDP | `uavcan.udp.iface` | `string` | `UAVCAN__UDP__IFACE` | Space-separated local IPs (16 LSB overridden with node-ID) | `127.9.0.0 192.168.0.0` | | Serial | `uavcan.serial.iface` | `string` | `UAVCAN__SERIAL__IFACE` | Space-separated serial port names | `COM9 socket://127.0.0.1:50905` | @@ -305,6 +305,12 @@ You can still override the type if you want to use a different one (e.g., if the y q 42 least_squares:my_namespace.MySpecialType '[[10, 1], [20, 2]]' ``` +If your service call requires multiple arguments, specify them as follows: + +```bash +yakut call 125 435:uavcan.node.ExecuteCommand '{command: 65533, parameter: "firmware.bin"}' +yakut call 125 435:uavcan.node.ExecuteCommand '[65533, "firmware.bin"]' # Shorter but position-sensitive + ## Monitoring the network The command `yakut monitor` can be used to display *all* activity on the network in a compact representation. It tracks online nodes and maintains real-time statistics on all transfers exchanged between each node on the network. It may also be able to detect some common network configuration issues like zombie nodes (nodes that do not publish `uavcan.node.Heartbeat`). @@ -448,7 +454,7 @@ $ y r 125, m.inductance_dq --detailed --detailed real32: value: [1.2999999853491317e-05, 1.2000000424450263e-05] _meta_: {mutable: true, persistent: true} - + # If there is no such register, we get a null (empty): $ y r 125 no.such.register null diff --git a/yakut/VERSION b/yakut/VERSION index c317a91..9beb74d 100644 --- a/yakut/VERSION +++ b/yakut/VERSION @@ -1 +1 @@ -0.13.1 +0.13.2 diff --git a/yakut/cmd/call.py b/yakut/cmd/call.py index 6b2dedd..e1045ab 100644 --- a/yakut/cmd/call.py +++ b/yakut/cmd/call.py @@ -111,6 +111,7 @@ async def call( yakut call 42 uavcan.node.getinfo +M -T3 -Pe yakut call 42 least_squares 'points: [{x: 10, y: 1}, {x: 20, y: 2}]' yakut call 42 least_squares:sirius_cyber_corp.PerformLinearLeastSquaresFit '[[10, 1], [20, 2]]' + yakut call 125 435:uavcan.node.ExecuteCommand '{command: 65533, parameter: "firmware.bin"}' """ try: from pycyphal.application import Node From 38aae49cbf2f7767bb0ed7c4470b227baf8aea62 Mon Sep 17 00:00:00 2001 From: Maksim Drachov Date: Thu, 25 Jul 2024 13:59:48 +0300 Subject: [PATCH 2/3] Fix execute_command test --- tests/cmd/execute_command.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/cmd/execute_command.py b/tests/cmd/execute_command.py index df0d7d2..5b54cc9 100644 --- a/tests/cmd/execute_command.py +++ b/tests/cmd/execute_command.py @@ -94,15 +94,15 @@ async def _unittest_basic(_context: tuple[Runner, tuple[Remote, Remote]]) -> Non assert await run("10-12", "restart", "--timeout=3") == ( 0, { - "10": {"status": 0}, - "11": {"status": 0}, + "10": {"output": '', "status": 0}, + "11": {"output": '', "status": 0}, }, ) assert await run("10-12", "111", "COMMAND ARGUMENT", "--timeout=3") == ( 0, { - "10": {"status": 0}, - "11": {"status": 0}, + "10": {"output": '', "status": 0}, + "11": {"output": '', "status": 0}, }, ) assert ( @@ -122,15 +122,15 @@ async def _unittest_basic(_context: tuple[Runner, tuple[Remote, Remote]]) -> Non assert await run("10-12", "restart", "--timeout=3") == ( EXIT_CODE_UNSUCCESSFUL, { - "10": {"status": 100}, - "11": {"status": 200}, + "10": {"output": '', "status": 100}, + "11": {"output": '', "status": 200}, }, ) assert await run("10-12", "123", "--expect=100,200", "--timeout=3") == ( 0, { - "10": {"status": 100}, - "11": {"status": 200}, + "10": {"output": '', "status": 100}, + "11": {"output": '', "status": 200}, }, ) assert remote_10.last_request and remote_10.last_request.command == 123 @@ -143,14 +143,14 @@ async def _unittest_basic(_context: tuple[Runner, tuple[Remote, Remote]]) -> Non EXIT_CODE_UNSUCCESSFUL, { "10": None, - "11": {"status": 0}, + "11": {"output": '', "status": 0}, }, ) assert await run("10-12", "123", "--expect") == ( 0, { "10": None, - "11": {"status": 0}, + "11": {"output": '', "status": 0}, }, ) @@ -158,7 +158,7 @@ async def _unittest_basic(_context: tuple[Runner, tuple[Remote, Remote]]) -> Non remote_11.next_response = ExecuteCommand_1.Response(status=210) assert await run("11", "123", "FOO BAR", "--timeout=3") == ( EXIT_CODE_UNSUCCESSFUL, - {"status": 210}, + {"output": '', "status": 210}, ) assert ( remote_11.last_request @@ -167,7 +167,7 @@ async def _unittest_basic(_context: tuple[Runner, tuple[Remote, Remote]]) -> Non ) assert await run("11", "222", "--timeout=3", "--expect=0..256") == ( 0, - {"status": 210}, + {"output": '', "status": 210}, ) assert ( remote_11.last_request From 2a2b28aad4473a25b768affae34fa04ef66288a7 Mon Sep 17 00:00:00 2001 From: Maksim Drachov Date: Tue, 30 Jul 2024 17:45:37 +0300 Subject: [PATCH 3/3] bump version --- yakut/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yakut/VERSION b/yakut/VERSION index 9beb74d..288adf5 100644 --- a/yakut/VERSION +++ b/yakut/VERSION @@ -1 +1 @@ -0.13.2 +0.13.3