Closed lhc610github closed 7 years ago
At begginning not important, but useful: a) use triple tilda ("``") for code block. quote not readable. b)
target_idbad name, it looks similar to
target_systemand
target_component(which used to address message to particular system or system's component). Perhaps
index` may be better. And why start from one?
What strange: diagnostics show "not connected", while checkid
sees msgid = 0 (HEARTBEAT).
You sure that there no "Got heartbeat" message in roslaunch log?
To check that your message are send to wire you need traffic sniffer, i recommend wireshark
.
You may set fcu_url:=udp://@127.0.0.1:14555
and then monitor that port and publish poses.
There exists wireshark mavlink plugin (wlua), but i never used it.
Then you should check PX4 sources. There may be situation when msg header exist, but used incorrect msg crc array. Unknown and corrupted (bad crc) messages don't pass to handlers.
@vooon thank you for reply. The mavros
can connect to the PX4
and work fine. PX4
receive TIMESYNC
,SYSTEM_TIME
and HEARTBEAT
MAVLink Messages.
However, PX4
cannot receive the new message WHYCON_TARGET
.What I have done was:
mavros
:
mavlink/message_definitions/v1.0/common.xml
. id
is 213
common
floder in /devel/include/mavlink/v1.0/
and /devel/include/mavlink/v2.0/
whycon_connect.cpp
file in the mavros_extras/src/plugins/
directory of the mavros_extras
package.catkin build
.PX4
:
https://github.com/mavlink/mavlink
-branch mavlink2-cxx11
mavlink/message_definitions/v1.0/common.xml
common
floder in /Firmware/mavlink/include/mavlink/v1.0/
and /Firmware/mavlink/include/mavlink/v2.0/
mavlink_receiver.h
. add a function that handles the incoming mavlink message in the MavlinkReceiver class in mavlink_receiver.h
and mavlink_receiver.cpp
I add PX4_INFO("%d ,msgi" ,msg->msgid)
in MavlinkReceiver::handle_message()
of mavlink_receiver.cpp
.
Then the test result was that I can get the 0
(HEARTBEAT), 2
(SYSTEM_TIME), 111
(TIMESYNC). Can not receive 213
(new message what I defined) when I publish poses to mavros
.
Is it should be situation used incorrect msg crc array?
Thanks again for recommend . but wireshark
may be too large for my board(Raspberrypi3). Is there a simpler way to monitor the mavros
?
Mavros step 2 is not needed, catkin build
should generate on xml change. You use source install instructions, right?
At p 3 did you add cpp to CMakeLists.txt? But since it loads, ok.
PX4 step 1 is unnecessary, firmware doesn't use C++ gen, better to use master
. Also be sure that message definition is identical.
It might be CRC error, but first need to check that message are sent.
You may use tcpdump
on remote machine:
$ cat ~/bin/router-wireshark.sh
#!/bin/bash
SSHHOST=root@router
BINPATH=/opt/sbin
wireshark -k -i <(ssh $SSHHOST $BINPATH/tcpdump -s 0 -U -n -w - not port 22)
Or simply set fcu_url:=udp://@<your-pc-ip>
and look what UDP packets arrives to your machine.
hi,friends .At present ,i am doing the same thing as you .i want to know where to define your own msg.please tell me .thank you.
@KJNKJNKJN
Mavlink: in /yourworkspace_ws/src/mavlink/message_defines/v1.0/common.xml
or add a new .xml
file.
Ros: in /yourpackage/msg/
@lhc610github is this answered to you?
Closing this as there are no updates.
Issue details
hi guys, I want to send a custom message to the px4 through mavros. This is the content of the
whycon_connect.cpp
file in themavros_extras/src/plugins/
directory of the mavros package:in
/mavros/launch/px4_pluginlists.yaml
Then I added the code to convert the new mavlink message to a uORB message.
MAVROS version and platform
Mavros: ?0.18.7? ROS: ?Kinetic? Ubuntu: ?16.04?
Autopilot type and version
PX4
Version: ?3.7.1?
Node logs
mavros node works fine. but PX4 cannot receive the new message.
Diagnostics
Check ID