Guided Mode Control over CAN and DroneCAN

base on previous post from @tridge Serial over DroneCAN support
using AP_Periph as Serial tunnel
I have create a example script using pydronecan that can do Guided mode control over CAN bus from companion computer

example script is in the PR link

using Copter-4.5.1 for testing
params setup(using SITL or Pixhawk)

CAN_P1_DRIVER 1.0 # First driver
CAN_D1_PROTOCOL 1.0 # DroneCAN
CAN_D1_UC_S1_BD 115200.0
CAN_D1_UC_S1_IDX 1.0 # Serial1
CAN_D1_UC_S1_NOD 88.0
CAN_D1_UC_S1_PRO 2.0 # MAVLink2

startup the script will route the tunnel data to a tcp connection

./examples/mavlink_tunnel.py --node-id 88 --tcp-host 'localhost' --tcp-port 5790 mcast:0

replace mcast:0 to the actual can intferfce ie. slcan0

in another terminal

mavproxy.py --master tcp:127.0.0.1:5790

or using any supported GCS

2 Likes

@Huibean Did you need to make any changes to the SRx values? I’m finding the Targetted message clogging up the CANBUS. thanks

@davidbitton You need to adjust message update rate depend on you bandwidth usage

I found that I needed to increase the pool size. i saw in MatekL431-Serial that the default pool size is bumped up to 12,000. Where is the update rate setting? Thanks.

you need to set data stream rate when you set up mavlink connection, or just simply request all and use SRC params to adjust Messages (common) · MAVLink Developer Guide

1 Like

Since the UART is virtual, which SRx values do I use?

have you check the S1_IDX

just an FYI. If you limit the Subscriber to only 9 lines of output, you’ll only see one message.