christianrauch / ros-multiwii

ROS Node for MultiWii and Cleanflight flight controllers
30 stars 9 forks source link

MWC Multiwii #1

Closed gusthemoose closed 7 years ago

gusthemoose commented 7 years ago

Hello, I am trying to use this package with an MWC Multiwii FC. The gy86,launch gets refused by my FC, and the betaflight_rpi_zero.launch does not publish anything other than parameters. Is the MWC board not compatible with this package, or am I missing something here? It is not a problem at all if it is not compatible, I have spent hours looking through your code trying to understand why it is not publishing (I am a novice), and just want to make sure I am not barking up the wrong tree.

christianrauch commented 7 years ago

I don't know the MWC. Can you provide a link to it? Which firmware is it using? Have you tried to run one of the example programs that come with the msp library at https://github.com/christianrauch/msp ? It could be simply that you provide a wrong file path or a wrong baud rate. E.g. when connecting with the wrong baud rate, the driver will wait forever for messages and won't complain about connection issues. You should verify that the default configuration GUI (e.g. MultiWiiConf or cleanflight GUI) works with your FC.

gusthemoose commented 7 years ago

http://www.robotshop.com/en/mwc-multiwii-flight-controller-uav-w--pins-arduino-compatible.html

It is running multiwii. I have changed the baud rate, and confirmed the FC uses the mpu6050, so when using the gy86 example it does not get refused. I have tried running MSP examples, I am getting syntax errors, which leads me to believe this is the source of my issue. The GUI for the FC works fine, so I think I am either compiling or running the MSP examples wrong.

gusthemoose commented 7 years ago

I apologize for being a complete noob here, but here is what I have done: in order to get your ROS package to compile, I git clone MSP into the "src" folder of my catkin_ws. I use catkin_make to compile, and then do the same for your ROS-multiwii package. Using the correct baudrate (i have confirmed within code), the FC refuses ID. I apologize again, I am a novice and am still learning ROS and linux, and the whole non-ROS package thing is throwing me off.

gusthemoose commented 7 years ago

Also, I believe my FC is running MW 2.3, is this an issue

christianrauch commented 7 years ago

No need to apologise :-) The way you compile the ROS node seems to be correct. But I would try to get the communication with the FC working before using the ROS node.

What "syntax errors" do you get? Do you know if the FC reboot when you establish a connection (e.g. when opening the serial device under Linux)? For example, the Arduino mini pro with integrated USB-serial converter reboots after connecting and it then takes a couple of seconds before it does respond to messages.

Does one of the example programs output something?

gusthemoose commented 7 years ago

I believe the device reboots, it starts flashign when i connect to it. How do I compile the MSP package alone? Do I use catkin Make? If i use cmake and put it in the build directory, I cannot compile the ROS node. The syntax error is "unexpected token before '(' in line 8 of everything I run in the MSP package

gusthemoose commented 7 years ago

I think I am mainly struggling with the installation of the MSP package. Do i want to git clone it into the build directory of my catkin package? What do I do next? I have been unsuccessful in executing any of the examples. I have used cmake and make -j on the package, and when i CD to the examples folder and ./msp_read_test /dev/ttyUSB0 it says no directory or file msp_read_test found

gusthemoose commented 7 years ago

Ok, so I have found how to install the MSP package and run it. I now get the error "unknown MSP ID" when running the majority of the example files. Does being on version 2.3 instead 2.4 affect this?

gusthemoose commented 7 years ago

I have now upgraded to 2.4, and am still receiving "unknown MSP ID" in both the node and the example files. It connects, shows version info etc, then gives that message

christianrauch commented 7 years ago

Currently I don't have enough information to reproduce your issue. Which ID is it? Which examples are you executing? Can you provide a log of the output?

gusthemoose commented 7 years ago

screenshot from 2017-06-17 18-46-57 screenshot from 2017-06-17 18-47-15 screenshot from 2017-06-17 18-47-22

christianrauch commented 7 years ago

I don't see messages about unknown IDs there, just messages about wrong CRCs. If the CRCs are wrong, the FC is probably sending a corrupted message (or it calculates a wrong CRC).

gusthemoose commented 7 years ago

At the very end, it says FC refused to process message with id: 253

christianrauch commented 7 years ago

Ok, I missed that. In this case, the message with ID 253 is just not understood by the firmware. It is the MSP_DEBUGMSG message and you need to enable it by #define DEBUGMSG in the firmware source code. But unless you need to debug the firmware, there is no need to enable it.

gusthemoose commented 7 years ago

What about ID 1? This is the error I am now getting refused by in the ROS node

christianrauch commented 7 years ago

The list at http://www.multiwii.com/wiki/index.php?title=Multiwii_Serial_Protocol provides the original MSP messages that are supported by the original MultiWii firmware. ID 1 is a message for cleanflight/betaflight based firmwares. At initialisation, the library should actually determine by this message with which type of firmware it is communicating. The node should still work, even if message ID 1 is not accepted. Currently I cannot reproduce this error since I am using betaflight.

As I am working on a larger update for the library and the node, I might have a look at this with the original MultiWii firmware. In the meantime you could check out the branches async for the node and the library and see if it fixes your problem.

Otherwise, I am happy to accept pull requests that fix this issue :-)

gusthemoose commented 7 years ago

No luck with the async branch either, same issue. I will wait for this update, I cannot express how much I appreciate your help so far, thank you very much sir :D

christianrauch commented 7 years ago

I have successfully tested my Arduino Nano 3.0 with MultiWii 2.4 on the updated async branch. It successfully connects and provides IMU data.

If you have setup the logging on ROS correctly, you should see logs in the terminal like this:

[ INFO] [1497828583.616900355]: Connected to FCU at /dev/ttyUSB0
MultiWii version 240 ready
[ INFO] [1497828589.879758297]: MSP ready
MSP ready
gusthemoose commented 7 years ago

Welp, my FC has died on me. LOL. I greatly appreciate you testing this, however I am in need of a new FC now and am debating what kind to get for my V-tail

gusthemoose commented 7 years ago

Do you recommend any FC that support both your package and V-Tail quads? sorry to get off topic

christianrauch commented 7 years ago

I do not know which firmwares support V-Tail, but this ROS node should support any firmware that uses the MSP communication protocol. I know of these firmwares:

You should ask in their respective forums or Slack channels for hardware recommendation and how to setup V-Tail configurations. I am using Cleanflight (http://cleanflight.com/) since it supports newer hardware and faster communication rates for MSP. They have a Slack channel at http://cleanflight.com/slack/ where you can get support and recommendations.

You can of course just buy the same FC again. If you decide to get a different FC, please close this issue.