CANbus for Ardupilot with UAVCAN and UC4H

he does not use GIT

well, that’s not totally correct anymore, here a link to git branches: Branches · olliw42/BetaPilot · GitHub

@anon67614380 many thx, sir :slight_smile:

Ok the if it is just a matter of HEADing to this branch and launching a ./waf build then, it is good.

OlliW has made it simple and pre-compiled the common models. AH you are probably interested in plane tho…

Actually I have some branches of my own with some mods , so I need to merge all these … nice melting pot

I.m afraid you will be disappointed
I just wanted to bring across that it is in a git branch

That’s it; the GPS connected to Node and UAVCAN to to PixHawk running BetaCopter.
GPS Type 2 connected to Tunnel Serial 1 on node 44 using protocol 5

:+1:

now you just need to get yourself a WS2812B and can add Indicatorleds to your gpsmag node :slight_smile:

Yes, why not, I may have some hanging around. I dont see much detail on connection and annunciator configuration, do you have a link or video ?

Tunneling question:
The 3 serial tunnels act as additionnals serial ports, right ?
There is a lot of interest to get additionals ports, so UAVCAN Tunneling seems appealing , but how these additional ports are managed by ArduPilot, does it create new instances?

Here is a practical example, lets say we create an avoidance node with 3 UC4H UartBridge Node fed with serial rangefinders (TFMINI). These 3 nodes would be connected with TS0 - TS1- TS2 with 115kbaud and type 9 for rangefinder.
How would the proximity library would consume these 3 streams ?

Regards

Regards

I dont see much detail on connection and annunciator configuration, do you have a link or video ?

you couldn’t find any since I haven’t put up any … I’ll provide you with the info later (just need to remind myself what the pin was you need to use).

Do the 3 serial tunnels act as additionnals serial ports ?

yes, they do work one-to-one exactly like any of the other serial ports. No difference (except that you need to in addition specify ChannelId of course).

(I think that’s the neat aspect of my tunnel implementation)

There is a possible bandwidth limitation. E.g., if you configure each of the 3 tunnels to 115200 and would use each at full bandwidth this would be roughly 4000 CAN frames/s or more than 50% of the CAN bandwidth. In the BetaCopter code you’ll find some more detailed comments. But except of that there is zero difference to the normal SERIAL ports.

Here is a practical example, lets say we create an avoidance node with 3 UC4H UartBridge Node fed with serial rangefinders (TFMINI). These 3 nodes would be connected with TS0 - TS1- TS2 with 115kbaud and type 9 for rangefinder.
How would the proximity library would consume these 3 streams ?

exactly like if the rangefinders would be connected to normal uarts. All these libraries call the SerialManager (IMHO) to get an uart handle, and would never notice what’s behind the scene.

I should say that I of course have never tested such a situation, so I can just comment on what my understanding is. What I can say, and you can see much of this being demonstrated in the video I’ve linked to earlier, is that I had connected two GPSes and a STorM32 to the three SERIALTNLs (that’s why there are 3 :wink: ), and configuration and operation was one-to-one identical to when I would have used normal SERIAL ports.

I can’t see any difference. Unless the proximity library is doing some “strange” uart stuff I predict you’ll find this remarkably simple to do.

@olliw42 did you ever though of adding serial3 to make a 3 ports UC4H UartBridge ?

An avoidance node could be a nice add-on , and the RangeFinder could work as effectively @ 38kbaud
Will do some tests and probably make a wrap up of all the above on a blog

yes, I indeed did

but:
the F103T8 I’m using in the nodes only has two UARTs. Thus, when you use the UartBridge firmware you’re offered only two uart channels, as this is also the number offered by e.g. a Gen.Purpose board.

the bluepill offers 3, and doing 3 would be a piece of cake, I can do up to 5 easily for e.g.a F103RC. But I concluded - and I think you said this yourself before - that the bluepill isn’t really what one wants to use extensively on our copters. One could however of course easily design a node pcb with a 103CB…

but:
there is IMHO also a conceptional issue. If the idea is to use that as a sort of uart expander to equip the FC with more uarts, then using CAN and UAVCAN especially would in my opinion be nonsense (even though it’s possible). I could not imagine a UAVCAN node which could need more than two UARTs (I can’t even imagine one which would need two …)… so I actually wonder if what you call “avoidance node” is in fact a node in any proper CAN/UAVCAN sense.

WS2182B:
the signal for it is on TIM2_CH3 or pin PA2
so you connect the WS’s gnd to gnd, it’s signal-in to PA2, and it’s vcc to … well … this depends now on your powering scheme and number of LEDs. If you connect just one LED it wouldn’t suck much current and you could connect it to the CANbus’ 5V.

it should then work out of the box with ArduPilot, since ArduPilot also used LedlightId = 0. Maybe there is some setting in AP’s Notify parameter section which I’m forgetting now however.

Couldn’t you use the second UAVCAN bus to double the total available bandwidth? Placing some devices on the second bus to reduce the impact to other devices on the main bus?

absolutely
it IMHO could actually be a very recommendable setup to have the “critical” components on one bus and the “non-critical” ones on the other
I’m not sure if my implementation(s) in BetaCopter would support that however out of the box, I have never ventured into this (my modded AUAVX and the pixracer just have one CAN bus), but exploiting two CAN ports is definitely on my list

@ppoirier
Patrick , as regards the QMC magnetometer, I just got mine, and the modded firmware worked for me out of the box … both MagneticSensorType = 0 and 2 just worked … (and the scaling appears to be at least not obviously wrong)
???

Yep just tested during lunch , it work OK, must have been " a momentary lapse of reason"
Will test the WS2182 later today

Thanks

Yep just tested during lunch , it work OK

great. many THX. So it remains to check that range and orientation are correct.

just for the sake of fun I did a uartbridge firmware for you with 3 uarts. I haven’t really tested it much, but maybe it just works.
uc4h-uartbridge-v008-4ppoirier.zip (27.5 KB)

Lol , I just finished a blog … using 2 uarts … Please read and comment:

1 Like

@olliw42 what about adding the rm3100 mag support to the node? I use that one and it’s pretty amazing! That would be incredible to have.

Love this! Finally it’s getting some serious traction. You’re a genius and kind for contributing all this!

@jpkh what happened to my blog ?!?