Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: tools: mavp2p: Add first version #2072

Merged
merged 9 commits into from Sep 13, 2023

Conversation

patrickelectric
Copy link
Member

@patrickelectric patrickelectric commented Aug 28, 2023

Should helps #2070

How to test:
Terminal -> mv /usr/bin/mavlink-routerd /usr/bin/mavlink-routerd2
Go to autopilot tmux
Restart the service

@Williangalvani
Copy link
Member

nice

@joaoantoniocardoso
Copy link
Collaborator

When it's working, it uses ~40% of the CPU on Pi3.

But it is unreliable with this configuration: after some minutes (10?) it lowers to ~2%, and when that happens, all the connections are dropped.

@Williangalvani
Copy link
Member

at my bench setup it is running at ~10% cpu, which is nice.
I'll let it run for a while.

Copy link
Member

@Williangalvani Williangalvani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good and working great so far. I'll leave it connected to qgc overnight, but I had it working for longer than 1h with no issues.

I found some typos and small things that could be changed, no blockers though.

fi

ARTIFACT_NAME="mavp2p"
COMPRESS_FILE="$ARTIFACT_NAME.tar.gz"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd call it COMPRESSED_FILE/ TAR_FILE or similar. COMPRESS sounded weird when first read it

chmod +x "$LOCAL_BINARY_PATH"

# Remove temporary files
rm -rf "$COMPRESS_FILE" "${ARTIFACT_NAME}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline at end of file, since we're here?

return list(filter(lambda subclass: subclass.is_ok, AbstractRouter.__subclasses__()))
logger.debug(f"Possible interfaces: {AbstractRouter.possible_interfaces()}")

def caller(subclass: Type["AbstractRouter"]) -> bool:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use a more meaningfull name than "caller" ?
maybe router_is_ok(), interface_is_ok() or similar?

@@ -4,6 +4,8 @@
# Immediately exit on errors
set -e

# Any changes in this file should reflect in the Dockerfile as well,
# since we get this binaries from multstage
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo:
multstage -> multistage

@joaoantoniocardoso
Copy link
Collaborator

looking good and working great so far. I'll leave it connected to qgc overnight, but I had it working for longer than 1h with no issues.

I found some typos and small things that could be changed, no blockers though.

So it fails with Pixhawk only?

@Williangalvani
Copy link
Member

So it fails with Pixhawk only?

good question. is it easy to replicate? is there anything relevant on dmesg by any chance?

we should log the output of our routers...

@joaoantoniocardoso
Copy link
Collaborator

So it fails with Pixhawk only?

good question. is it easy to replicate? is there anything relevant on dmesg by any chance?

It's easy to replicate:

  1. Run w/ MAVP2P
  2. Wait (may only happen when not using QGC? Didn't try to use it though)

The dmesg shows the following, which happened some time after I started the MAVP2P, but I don't know if there's any relationship with it.

[ 3470.659434] ------------[ cut here ]------------                                                                                                                                                                                                                                                           
[ 3470.659471] WARNING: CPU: 2 PID: 2363 at drivers/firmware/raspberrypi.c:234 get_throttled_show+0x6c/0x70
[ 3470.659477] deprecated, use hwmon sysfs instead
[ 3470.659483] Modules linked in: tcp_diag inet_diag veth xt_nat xt_tcpudp xt_conntrack nft_chain_nat xt_MASQUERADE nf_nat nf_conntrack_netlink nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nft_counter xt_addrtype nft_compat nf_tables nfnetlink br_netfilter bridge cmac algif_hash aes_arm_bs crypto_simd c
ryptd algif_skcipher af_alg bnep hci_uart btbcm bluetooth ecdh_generic ecc overlay 8021q garp stp llc snd_usb_audio snd_hwdep snd_usbmidi_lib snd_rawmidi snd_seq_device uvcvideo cdc_acm brcmfmac brcmutil vc4 sha256_generic cec cfg80211 drm_kms_helper rfkill snd_soc_core snd_compress snd_pcm_dmaengine 
syscopyarea sysfillrect sysimgblt fb_sys_fops raspberrypi_hwmon snd_bcm2835(C) snd_pcm snd_timer snd bcm2835_codec(C) bcm2835_isp(C) v4l2_mem2mem videobuf2_dma_contig fixed uio_pdrv_genirq uio i2c_dev i2c_bcm2835 bcm2835_v4l2(C) bcm2835_mmal_vchiq(C) vc_sm_cma(C) videobuf2_vmalloc videobuf2_memops vid
eobuf2_v4l2 videobuf2_common videodev mc g_ether usb_f_rndis u_ether libcomposite dwc2 udc_core roles
[ 3470.659985]  drm fuse drm_panel_orientation_quirks backlight ip_tables x_tables ipv6
[ 3470.660039] CPU: 2 PID: 2363 Comm: linux2rest Tainted: G         C        5.10.33-v7+ #1415
[ 3470.660043] Hardware name: BCM2835
[ 3470.660048] Backtrace: 
[ 3470.660066] [<809eda64>] (dump_backtrace) from [<809eddf4>] (show_stack+0x20/0x24)
[ 3470.660076]  r7:ffffffff r6:00000000 r5:60000013 r4:80ee5e14
[ 3470.660085] [<809eddd4>] (show_stack) from [<809f1fa0>] (dump_stack+0xcc/0xf8)
[ 3470.660096] [<809f1ed4>] (dump_stack) from [<8011ed1c>] (__warn+0xfc/0x114)
[ 3470.660104]  r10:940edef8 r9:00000009 r8:8082a498 r7:000000ea r6:00000009 r5:8082a498
[ 3470.660109]  r4:80c6c918 r3:80e05050
[ 3470.660117] [<8011ec20>] (__warn) from [<809ee474>] (warn_slowpath_fmt+0xa4/0xd8)
[ 3470.660124]  r7:000000ea r6:80c6c918 r5:80e05008 r4:80c6c9b0
[ 3470.660134] [<809ee3d4>] (warn_slowpath_fmt) from [<8082a498>] (get_throttled_show+0x6c/0x70)
[ 3470.660142]  r9:86fa7b80 r8:816ab610 r7:b45de000 r6:80a48aa4 r5:815b7e40 r4:b45de000
[ 3470.660154] [<8082a42c>] (get_throttled_show) from [<80708abc>] (dev_attr_show+0x28/0x54)
[ 3470.660159]  r5:80f14c48 r4:814ddb40
[ 3470.660172] [<80708a94>] (dev_attr_show) from [<803ea29c>] (sysfs_kf_seq_show+0x98/0x100)
[ 3470.660178]  r5:00001000 r4:814ddb40
[ 3470.660186] [<803ea204>] (sysfs_kf_seq_show) from [<803e8314>] (kernfs_seq_show+0x34/0x38)
[ 3470.660194]  r9:814ddb58 r8:00000000 r7:00000001 r6:00400cc0 r5:00001000 r4:814ddb40
[ 3470.660204] [<803e82e0>] (kernfs_seq_show) from [<8035f56c>] (seq_read_iter+0x188/0x4d4)
[ 3470.660211] [<8035f3e4>] (seq_read_iter) from [<803e8990>] (kernfs_fop_read_iter+0x140/0x188)
[ 3470.660219]  r10:940edee0 r9:00000000 r8:00000000 r7:940edef8 r6:00001000 r5:8553ecc0
[ 3470.660223]  r4:86fa7b80
[ 3470.660234] [<803e8850>] (kernfs_fop_read_iter) from [<8033286c>] (vfs_read+0x218/0x344)
[ 3470.660242]  r10:940edf58 r9:00000000 r8:00000000 r7:80e05008 r6:00001000 r5:8553ecc0
[ 3470.660246]  r4:00000000
[ 3470.660255] [<80332654>] (vfs_read) from [<80332e64>] (ksys_read+0x68/0xe0)
[ 3470.660263]  r10:00001000 r9:76a00ac0 r8:8553ecc0 r7:00000000 r6:00000000 r5:8553ecc3
[ 3470.660267]  r4:80e05008
[ 3470.660276] [<80332dfc>] (ksys_read) from [<80332ef4>] (sys_read+0x18/0x1c)
[ 3470.660284]  r10:00000003 r9:940ec000 r8:80100204 r7:00000003 r6:76d6a590 r5:76a00ac0
[ 3470.660289]  r4:00001000
[ 3470.660298] [<80332edc>] (sys_read) from [<80100040>] (ret_fast_syscall+0x0/0x28)
[ 3470.660303] Exception stack(0x940edfa8 to 0x940edff0)
[ 3470.660311] dfa0:                   00001000 76a00ac0 00000021 76a00ac0 00001000 00000000
[ 3470.660319] dfc0: 00001000 76a00ac0 76d6a590 00000003 00000000 00001000 00001000 00000000
[ 3470.660324] dfe0: 00000003 76d69898 76ef35b9 76ef5676
[ 3470.660330] ---[ end trace 2eca7c32112d51f8 ]---

we should log the output of our routers...

Definitely

@joaoantoniocardoso
Copy link
Collaborator

The dmesg shows the following, which happened some time after I started the MAVP2P, but I don't know if there's any relationship with it.

Nope, that dmesg message is unrelated.

@Williangalvani
Copy link
Member

I think we should get this is in for more testing. it won't be easily enabled anyway...

@patrickelectric
Copy link
Member Author

Just rebased over master, will test to see if everything is correct before merging

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
… valid routers

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-complete Change documentation has been completed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants