Sending custom DSDL requests with ease

280 views
Skip to first unread message

Pavel Vasev

unread,
Apr 1, 2018, 8:30:47 AM4/1/18
to UAVCAN
Hi there!

We are developing custom uavcan protocol and thus have some DSDL definition files.

Is there a way to send requests (defined in our DSDL definitions) using uavcan_gui_tool or uavcan_nodetool ?

We hope this will simplify our debug process (instead of writing own request tool).

Thanks a lot!

Best Regards,
Pavel Vasev

Pavel Kirienko

unread,
Apr 3, 2018, 6:23:10 AM4/3/18
to Pavel Vasev, UAVCAN
As of today, the only way to send a custom DSDL message, request, or response, is to use the embedded IPython console. It is a bit inconvenient but highly generic and flexible. You can also implement your own Panel, like the ESC Panel, for your custom data types. It shouldn't be difficult, PyQt5 is quite friendly; use the aforementioned ESC Panel as an example.

Pavel.

--
You received this message because you are subscribed to the Google Groups "UAVCAN" group.
To unsubscribe from this group and stop receiving emails from it, send an email to uavcan+unsubscribe@googlegroups.com.
To post to this group, send email to uav...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/uavcan/acd7f0ae-e0be-4fa4-8e9a-51ecb1d282c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Pavel Vasev

unread,
Apr 3, 2018, 7:03:28 AM4/3/18
to Pavel Kirienko, UAVCAN
Thank you, Pavel!

вт, 3 апр. 2018, 15:23 Pavel Kirienko <pavel.k...@gmail.com>:
As of today, the only way to send a custom DSDL message, request, or response, is to use the embedded IPython console. It is a bit inconvenient but highly generic and flexible. You can also implement your own Panel, like the ESC Panel, for your custom data types. It shouldn't be difficult, PyQt5 is quite friendly; use the aforementioned ESC Panel as an example.

Pavel.
On Sun, Apr 1, 2018 at 3:30 PM, Pavel Vasev <pavel...@gmail.com> wrote:
Hi there!

We are developing custom uavcan protocol and thus have some DSDL definition files.

Is there a way to send requests (defined in our DSDL definitions) using uavcan_gui_tool or uavcan_nodetool ?

We hope this will simplify our debug process (instead of writing own request tool).

Thanks a lot!

Best Regards,
Pavel Vasev

--
You received this message because you are subscribed to the Google Groups "UAVCAN" group.
To unsubscribe from this group and stop receiving emails from it, send an email to uavcan+un...@googlegroups.com.

Kent Martin

unread,
Apr 13, 2018, 12:28:57 AM4/13/18
to UAVCAN
Pavel,
That's good, but I can't find the ipyhton console it uavcan gui? I only see Tools->interactive console, which brings up Jupyter console.
I'm usingUAVCAN gui toll V0.9.0.
Can you tell me where to find the console and how to add the dsdl filess to it?
Is there an example explaingin how to make a new panel like the esc panel?

Thanks,
Kent.


On Tuesday, April 3, 2018 at 8:23:10 PM UTC+10, Pavel Kirienko wrote:
As of today, the only way to send a custom DSDL message, request, or response, is to use the embedded IPython console. It is a bit inconvenient but highly generic and flexible. You can also implement your own Panel, like the ESC Panel, for your custom data types. It shouldn't be difficult, PyQt5 is quite friendly; use the aforementioned ESC Panel as an example.

Pavel.
On Sun, Apr 1, 2018 at 3:30 PM, Pavel Vasev <pavel...@gmail.com> wrote:
Hi there!

We are developing custom uavcan protocol and thus have some DSDL definition files.

Is there a way to send requests (defined in our DSDL definitions) using uavcan_gui_tool or uavcan_nodetool ?

We hope this will simplify our debug process (instead of writing own request tool).

Thanks a lot!

Best Regards,
Pavel Vasev

--
You received this message because you are subscribed to the Google Groups "UAVCAN" group.
To unsubscribe from this group and stop receiving emails from it, send an email to uavcan+un...@googlegroups.com.

Pavel Vasev

unread,
Apr 13, 2018, 1:23:59 AM4/13/18
to Kent Martin, UAVCAN
I will appreciate too for some working example of custom dsdl loading and sending a request.

пт, 13 апр. 2018, 9:28 Kent Martin <kentma...@gmail.com>:
You received this message because you are subscribed to a topic in the Google Groups "UAVCAN" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/uavcan/A8Id80JPly4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to uavcan+un...@googlegroups.com.

To post to this group, send email to uav...@googlegroups.com.

Pavel Kirienko

unread,
Apr 13, 2018, 4:07:21 AM4/13/18
to Pavel Vasev, Kent Martin, UAVCAN
Gentlemen,

In the case of the UAVCAN GUI Tool, both IPython and Jupyter refer to the same concept. You will find your answers on this page: http://uavcan.org/GUI_Tool/User_guide/

Let me know if there is something specific you need help with.

Pavel.

To unsubscribe from this group and all its topics, send an email to uavcan+unsubscribe@googlegroups.com.

To post to this group, send email to uav...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/uavcan/3878f944-94e6-4e18-9b68-49f0d3b3610c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "UAVCAN" group.
To unsubscribe from this group and stop receiving emails from it, send an email to uavcan+unsubscribe@googlegroups.com.

To post to this group, send email to uav...@googlegroups.com.

Kent Martin

unread,
Apr 16, 2018, 6:44:25 PM4/16/18
to Pavel Kirienko, Pavel Vasev, UAVCAN
Pavel,
Thanks I have managed to get uavcan gui tool to recognise the packets.
The next question is how to send a packet to it?
With the python console how would I do this?
Also , after I test this we would like to make a panel like the esc one for setting parameters graphically.
Is their some help on these topics?

Thanks,
Kent

Pavel Kirienko

unread,
Apr 17, 2018, 3:07:52 AM4/17/18
to Kent Martin, Pavel Vasev, UAVCAN
The examples are shown on this webpage here: http://uavcan.org/GUI_Tool/User_guide/ please search the page for the keyword "broadcast" (and there's also "request" for services).

There is currently no documentation on the subject of custom GUI elements, but it should be easy enough to do just by looking at the way existing panels and tools are implemented.

Pavel.

Kent Martin

unread,
Apr 17, 2018, 9:05:28 AM4/17/18
to Pavel Kirienko, Pavel Vasev, UAVCAN
Pavel,
Thanks, I did try the broadcast, however auto complete is not working for my custom data types when using broadcast. The standard messages do.
Is that supposed to be the case? 
I assume you want me to look at the source for UAVCAN GUI tool and esc panel python script and make my own script and build it into the UAVCAN GUI source code?
Is that correct.
Kent

Pavel Kirienko

unread,
Apr 17, 2018, 9:50:19 AM4/17/18
to Kent Martin, Pavel Vasev, UAVCAN
> Thanks, I did try the broadcast, however auto complete is not working for my custom data types when using broadcast. The standard messages do.
> Is that supposed to be the case? 

No, it's a bug. A fix would be appreciated.

> I assume you want me to look at the source for UAVCAN GUI tool and esc panel python script and make my own script and build it into the UAVCAN GUI source code?
> Is that correct.

That is correct.

Pavel.

Kent Martin

unread,
Apr 30, 2018, 11:04:57 PM4/30/18
to Pavel Kirienko, Pavel Vasev, UAVCAN
Pavel,
I have tried typing non standard dsdl commands in the console but it will not recognise them as valid commands.
Is the console completely not able to support non standard dsdl commands at all?

Thanks,
Kent

Pavel Kirienko

unread,
May 1, 2018, 10:25:53 AM5/1/18
to Kent Martin, Pavel Vasev, UAVCAN
The console is supposed to support them just fine. Please show us what you're typing and what you're getting back from the console so we could troubleshoot it together.

Pavel.

Kent Martin

unread,
May 1, 2018, 7:07:12 PM5/1/18
to Pavel Kirienko, Pavel Vasev, UAVCAN
Pavel,
Here is the command:
broadcast(rfd.equipment.eng_mon.EngineStatus(clearServiceData=0))
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-1-039da1a50f5d> in <module>()
----> 1 broadcast(rfd.equipment.eng_mon.EngineStatus(clearServiceData=0))

NameError: name 'rfd' is not defined


Here is the folder structure
C:\Users\kentm\uavcan_vendor_specific_types\rfd\equipment\eng_mon

And the file :
210.EngineStatus.uavcan

# RFD Engine Monitor EngineStatus
# typedef struct 'EngineStatus'
# 17/04/18

## Data from client sent to server
bool clearServiceData # clear the service data after returning it, only used by rfdesign for resetting engines

---

## Data returned from server to client
bool Result # result of service request, o = failed, 1 = passed
uint32[10] ICE1000RPM # Engine RPM Bins ? mins in RPM bins(1000RPM) ? minutes uint32[10]
uint32[32] ICEEng10degC # Temp Ch0 Bins ENGT ? seconds in 10 deg bins uint32[32]
uint32[100] ICEExh10degC # Temp Ch0 Bins EXHT ? seconds in 10 deg bins uint32[100]
uint64 FaultBits # Fault Bits ? 64 bit
uint32[64] FaultStartSec # Fault Start, when the fault first began
uint32[64] FaultLastSec # Fault Last , when the fault last occurred
uint32[64] FaultCount # Fault Count, increments each time fault occurs

Note I have also made a dummy panel and tried 
import rfd
which also fails.
How can I get the custom dsdl in the panel as well?

Thanks,
Kent Martin

Pavel Kirienko

unread,
May 7, 2018, 4:25:10 AM5/7/18
to Kent Martin, Pavel Vasev, UAVCAN
You should access third-party definitions as shown here: http://uavcan.org/Implementations/Pyuavcan/Tutorials/2._Basic_usage/#loading-dsdl-definitions

Example: uavcan.thirdparty.rfd.equipment.eng_mon.EngineStatus.

Pavel.

Kent Martin

unread,
May 20, 2018, 9:13:34 PM5/20/18
to Pavel Kirienko, Pavel Vasev, UAVCAN
Hi Pavel,
Ok I have tried again accessing using third party keyword.
It is returning 'bytearray' object has no attribute '_type'.
Can you tell me what is happening here?

Thanks,
Kent

broadcast(uavcan.thirdparty.rfd.equipment.eng_mon.EngineStatus.Request(clearServiceData=0))
2018-05-21 11:08:39,887 ERROR uavcan_gui_tool.active_data_type_detector: Could not detect data type name from transfer Transfer(id=1, source_node_id=20, dest_node_id=None, transfer_priority=30, payload=bytearray(b'\x00'))
Traceback (most recent call last):
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan_gui_tool\active_data_type_detector.py", line 37, in _on_transfer
    dtname = uavcan.get_uavcan_data_type(tr.payload).full_name
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan\transport.py", line 33, in get_uavcan_data_type
    return obj._type
AttributeError: 'bytearray' object has no attribute '_type'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan_gui_tool\active_data_type_detector.py", line 42, in _on_transfer
    dtname = uavcan.DATATYPES[(tr.data_type_id, kind)].full_name
KeyError: (210, 1)
2018-05-21 11:08:40,776 INFO uavcan_gui_tool.widgets.node_monitor: Removing row 0

Kent Martin

unread,
May 20, 2018, 9:28:55 PM5/20/18
to Pavel Kirienko, Pavel Vasev, UAVCAN
Pavel,
could you please give a full example of sending a custom dsdl request,
I have been trying for quite some time now and incrementally leaking small amounts of information has been quite slow.
A full response would be appreciated due to the time delay between time zones.

Thanks,
Kent

Pavel Kirienko

unread,
May 22, 2018, 9:06:31 AM5/22/18
to Kent Martin, Pavel Vasev, UAVCAN
Hi Kent,

In your specific case, the error is caused by the fact that you're trying to broadcast a service request. This is not possible by design; requests cannot be broadcasted. Instead of broadcast() you should use request(). A pull request adding a more meaningful error message would be appreciated!

Somebody else raised a concern that the bus monitor is unable to decode vendor-specific data types. That is a separate issue; it is due to the fact that the bus monitor runs in a separate process, which is not forked, but spawned; the new process is never instructed to load any vendor-specific data type definitions, and therefore, the user won't see their data types decoded in the bus monitor window. A temporary workaround for that is to put vendor-specific definitions into ~/uavcan_vendor_specific_types (more at http://uavcan.org/Implementations/Pyuavcan/Tutorials/2._Basic_usage/#using-vendor-specific-dsdl-definitions).

Pavel.

Kent Martin

unread,
May 22, 2018, 9:12:37 PM5/22/18
to Pavel Kirienko, Pavel Vasev, UAVCAN
HI pavel,
Ok I tried the command : 
request(uavcan.thirdparty.rfd.equipment.eng_mon.EngineStatus.Request(clearServiceData=0),10)
The destination nodeID is 10. I presume this is where it should be sent?
What do you mean a pull request with a more meaningful message?

The new error message returned is :
2018-05-23 11:06:39,438 ERROR uavcan_gui_tool.main: Node spin error [1 of 1000]: ValueError("Cannot generate YAML representation for <class 'NoneType'>",)
Traceback (most recent call last):
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan_gui_tool\main.py", line 531, in _spin_node
    self._node.spin(0)
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan\node.py", line 414, in spin
    self._poll_scheduler_and_get_next_deadline()
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan\node.py", line 82, in _poll_scheduler_and_get_next_deadline
    return self._run_scheduler()
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan\node.py", line 44, in <lambda>
    self._run_scheduler = lambda: self._scheduler.run(blocking=False) + self._scheduler.timefunc()
  File "C:\WinPython-32bit-3.4.4.1Qt5\python-3.4.4\lib\sched.py", line 151, in run
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan\node.py", line 440, in on_timeout
    callback(None)
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan_gui_tool\main.py", line 247, in print_yaml
    print(uavcan.to_yaml(obj))
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan\introspect.py", line 140, in to_yaml
    return _to_yaml_impl(obj)
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan\introspect.py", line 105, in _to_yaml_impl
    raise ValueError('Cannot generate YAML representation for %r' % type(obj))
ValueError: Cannot generate YAML representation for <class 'NoneType'>
2018-05-23 11:06:39,896 ERROR uavcan_gui_tool.main: Node spin error [1 of 1000]: ValueError('Not enough bits; need 32 but got 31',)
Traceback (most recent call last):
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan_gui_tool\main.py", line 531, in _spin_node
    self._node.spin(0)
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan\node.py", line 411, in spin
    self._recv_frame(frame)
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan\node.py", line 306, in _recv_frame
    transfer.from_frames(transfer_frames)
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan\transport.py", line 786, in from_frames
    self.payload._unpack(bits_from_bytes(payload_bytes))
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan\transport.py", line 572, in _unpack
    stream = field._unpack(stream)
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan\transport.py", line 380, in _unpack
    stream = self.__items[i]._unpack(stream)
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan\transport.py", line 219, in _unpack
    self._bits = be_from_le_bits(stream, self._type.bitlen)
  File "C:\Program Files (x86)\UAVCAN\UAVCAN GUI Tool\uavcan\transport.py", line 91, in be_from_le_bits
    raise ValueError("Not enough bits; need {0} but got {1}".format(bitlen, len(s)))
ValueError: Not enough bits; need 32 but got 31

What appears to be wrong this time?
Could you please put a sample of what you expect to be sent to send this request to the device.
The schedule to complete this is approaching and I need to progress or I'll have to look for another solution if a simple message cannot be successfully sent soon.

Thanks,
Kent Martin

here is DSDL source again
# RFD Engine Monitor EngineStatus
# typedef struct 'EngineStatus'
# 17/04/18

## Data from client sent to server
bool clearServiceData # clear the service data after returning it, only used by rfdesign for resetting engines

---

## Data returned from server to client
bool Result # result of service request, o = failed, 1 = passed
uint32[10] ICE1000RPM # Engine RPM Bins ? mins in RPM bins(1000RPM) ? minutes uint32[10]
uint32[32] ICEEng10degC # Temp Ch0 Bins ENGT ? seconds in 10 deg bins uint32[32]
uint32[100] ICEExh10degC # Temp Ch0 Bins EXHT ? seconds in 10 deg bins uint32[100]
uint64 FaultBits # Fault Bits ? 64 bit
uint32[64] FaultStartSec # Fault Start, when the fault first began
uint32[64] FaultLastSec # Fault Last , when the fault last occurred
uint32[64] FaultCount # Fault Count, increments each time fault occurs


Pavel Kirienko

unread,
May 23, 2018, 3:16:11 AM5/23/18
to Kent Martin, Pavel Vasev, UAVCAN
It seems like the message definition on the remote node differs from that of the local node.

Here's an example. Put the following text into "ns/123.Service.uavcan":


uint24 request
---
uint8[<=16] response


Then launch two interconnected instances of the UAVCAN GUI Tool and assign them unique node ID values. You can use a virtual CAN bus interface for that.

In the setup window, specify the location of the "ns" directory created above, for both instances of the GUI tool.

Open the console window in the first instance and execute this:


def handle_request(e):
    print('Received request:\n', uavcan.to_yaml(e.request))
    return uavcan.thirdparty.ns.Service.Response(response='Hello world!')
serve(uavcan.thirdparty.ns.Service, handle_request)


Then open the console window of the second instance and run this:



Hope this helps.

Pavel.
Reply all
Reply to author
Forward
0 new messages