Ask Your Question

ROS WARN Could not process inbound connection: topic types do not match

asked 2020-08-25 05:53:21 -0500

nmpm gravatar image

updated 2021-04-24 02:35:25 -0500

miura gravatar image

Hello, I'm working with ROS and AirSim, I'm also using the AirSim ROS Wrapper to comunicate between the two. As you can see, in the link there are some publishers, subscribers and so on... to do the comunication.

I wrote a python script that subscribes to the topic /cmd_vel and then publishes the twist messages on the AirSim topic /airsim_node/vel_cmd_body_frame (a topic from AirSim ROS Wrapper Node). I think the comunication between the two is fine, however when I try to publish on /cmd_vel by doing "rostopic pub /cmd_vel geometry..." I get this warning message on my console:

Could not process inbound connection: topic types do not match: [airsim_ros_pkgs/VelCmd] vs. [geometry_msgs/Twist]{'topic': '/airsim_node/drone_1/vel_cmd_body_frame', 'tcp_nodelay': '0', 'md5sum': 'a787b2802160dcc7fe02d089e10afe56', 'type': 'airsim_ros_pkgs/VelCmd', 'callerid': '/airsim_node'}

I think both of these topics are geometry_msgs/Twist twist, I don't know what I'm doing wrong. Can somebody help me? I will leave my code here, in case there's any mistake:

import rospy                          
import roslib
import tf 
from std_msgs.msg import String
from geometry_msgs.msg import Twist

def callback(msg):
    pub = rospy.Publisher('/airsim_node/drone_1/vel_cmd_body_frame', Twist, queue_size=10)
    rospy.loginfo("Publishing: [%f, %f, %f]" %(msg.linear.x, msg.linear.y, msg.linear.z))

def listener():
    global msg
    rospy.init_node('cmdvel_listener', anonymous=True)
    msg = Twist
    rospy.Subscriber("/cmd_vel", Twist, callback)

if __name__ == '__main__':
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-08-25 06:25:46 -0500

prefpkg21 gravatar image

First, the AirSim is not expecting a geometry/twist msg but rather a airsim_ros_pkgs/VelCmd. The message types must match between a publisher and subscriber. So you need to import this message type into your script. Also, it’s not a good idea to define a publisher inside a callback. Either create a Class or define it in your main setup.

edit flag offensive delete link more


Hello, thanks for replying. Ok, but in the AirSim Ros Wrapper website when I click to see the type of the airsim_ros_pkgs/VelCmd it show me that it is geometry_msgs/Twist twist or am I missing something? Also, thanks for the heads up on the code, I'm new to python.

nmpm gravatar image nmpm  ( 2020-08-25 06:55:37 -0500 )edit

The message is not a Twist, it has a twist inside it.

fergs gravatar image fergs  ( 2020-08-25 07:59:26 -0500 )edit

Oh ok!! I've been trying to add the import but I don't seem to find it. Do you have any idea what the import may be? Just one more thing that is in my mind... As VelCmd contains Twist inside do I just need to import this message type or do I still need to "transform" the data from Twist to VelCmd? TIA

nmpm gravatar image nmpm  ( 2020-08-25 11:04:57 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2020-08-25 05:53:21 -0500

Seen: 2,342 times

Last updated: Aug 25 '20