Homepage GitHub

Call and pub commands in basic usage demo

Ref: Pyuavcan 1.1.0.dev1, Windows 10, Python 3.8.2, UDP/Loopback.

Hi Everyone!
I’m a beginner trying evaluating the demo. Heartbeats are being subscribed and diagnostic session is waiting for demo publications. However, I’m facing some trouble with the call and pub commands (please take a look at console messages below - sorry, i’m not allowed to upload files yet).
Could you please help me?
Thanks in advance.
Best regards,
Lellis

Console messages:

uvc call --tr="UDP('127.0.0.111/8')" 42 123.sirius_cyber_corp.PerformLinearLeastSquaresFit.1.0 '{points: [{x: 10, y: 1}, {x: 20, y: 2}]}'
Error: ScannerError: while scanning a quoted scalar
  in "<unicode string>", line 1, column 1:
    '{points:
    ^ (line: 1)
found unexpected end of stream
  in "<unicode string>", line 1, column 10:
    '{points:
             ^ (line: 1)
             
uvc pub 283.uavcan.si.temperature.Scalar.1.0 '{kelvin: 123.456}' --count=2 --tr="UDP('127.0.0.111/8')"
Error: TypeError: __init__() missing 1 required positional argument: 'message'

I can’t reproduce your issues locally. Are you sure you are executing exact same commands that you’ve copy-pasted here? The first one in particular looks like a minor syntax error. I am trying this on GNU/Linux though, so there may be some subtle differences here also.

Hi Pavel,
Yes, messages were directly copied from the console. In fact, I copied commands from the Pyuavcan basic demo usage and just added the transport argument.
BR.

Ok I just reproduced your error. The problem is that you’ve copy-pasted the commands incorrectly. See:

$ uvc call --tr="UDP('127.0.0.111/8')" 42 123.sirius_cyber_corp.PerformLinearLeastSquaresFit.1.0 '{points:[{x: 10, y: 1}, {x: 20, y: 2}]}'
Error: ParserError: while parsing a flow mapping
  in "<unicode string>", line 1, column 1:
    {points:[{x: 10, y: 1}, {x: 20,  ... 
    ^ (line: 1)
expected ',' or '}', but got '['
  in "<unicode string>", line 1, column 9:
    {points:[{x: 10, y: 1}, {x: 20, y: 2}]}
            ^ (line: 1)
$ uvc pub 12345.uavcan.si.sample.temperature.Scalar.1.0'{kelvin: 123.456}' --count=2 --tr="UDP('127.0.0.111/8')"
Error: TypeError: __init__() missing 1 required positional argument: 'message'

If you put the missing spaces back, the commands work properly.

(I just noticed one unrelated error in the docs which I fixed just now: https://github.com/UAVCAN/pyuavcan/commit/1d5dbf07b6acc64576ca4f1deaae3b35bd7df377)

I’m deeply sorry. My pub command was using subject id 283 instead of 12345 as you pointed out. It was fixed. Spaces were ok. Commands only worked properly when I replaced the ‘’’ (ASCII code 39) characters by ‘"’ (ASCII code 34) ones in YAML_FIELDS. See below:

  1. Call command
    FROM: ‘{points: [{x: 10, y: 1}, {x: 20, y: 2}]}’
    TO: “{points: [{x: 10, y: 1}, {x: 20, y: 2}]}”
  2. Pub command
    FROM: ‘{kelvin: 123.456}’
    TO: “{kelvin: 123.456}”
    Thank you very much.

The subject-ID has nothing to do with it. 283 works just as well as 12345 does.

OK, clear.
Thanks.

Ref: Pyuavcan 1.1.0.dev1, Windows 10, Python 3.7.7, CAN/python-can.

I have exactly the same error now:

uvc pub 283.uavcan.si.temperature.Scalar.1.0 '{kelvin: 123.456}' --count=2 --tr="CAN(can.media.pythoncan.PythonCANMedia('pcan','PCAN_USBBUS1',8),10)"
Error: TypeError: __init__() missing 1 required positional argument: 'message'

I have copied the command from the fixing commit already.

The same is true for UDP connection –tr=“UDP(‘127.0.0.111/8’)” too.

Can’t reproduce. Can you please share a screenshot (not a copy-pasted string) of your command line showing the problem? Thanks.