Python (on Raspberry Pi) <-> MSP (on CC3D)

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
lv-426
Posts: 1
Joined: Sun May 12, 2019 11:07 am

Python (on Raspberry Pi) <-> MSP (on CC3D)

Post by lv-426 »

Hi All,

Quadcopter, Raspberry Pi and MSP newbie here, tinkering with RPi and getting back into Python after a long absence.

Using all the info I can find online, and studying the excellent work put into both pyMultiWii and WiiProxy, I am trying to talk to my CC3D and retrieve Attitude data.

I believe the command should be: ['$', 'M', '<', '0', '108', 108]
The standard request pre amble, followed by 0 length data, followed by command, followed by repeat command as checksum (because the checksum is the same as the MSP message ID for requests.)

I believe I need to pack to C struct, and the struct format for this would be: <3c2B0HB, due to length of data being 0 (as present in pyMultiWii)
To test I send the tx straight to rx on raspberry pi, and I have a separate python script running to test what is returned.

When I run this:

ser.write(struct.pack('<3c2B0HB','$','M','<',0,108,108))

The result of this is:
x = $m<ll
and struct.unpack('<3c2B0HB',x) = ('$', 'M', '<', 0, 108, 108) .

However, when I connect up the CC3D, and send this command, nothing is returned.


I am a bit stuck now and would appreciate any suggestions you have that I can test.

I also had a query about the struct format string - given that for a 'request', the checksum is the same value as the MSP message ID, why is the struct format not something like: <3c2B0HH ?

Any help or advice greatly appreciated!

Post Reply