ROS Subscriber does not return correct value from the topic
Afficher commentaires plus anciens
Hi,
I've been using the Robotics Toolbox for a while now and I've never seen something like this before. It looks like a Matlab bug, but I don't know if I am doing something wrong.
In summary, I have a simulation running in gazebo that publishes to the topic: '/mavros/state' I created a simple subscriber as follows:
rosinit;
stateSub = rossubscriber('mavros/state');
msg = receive(stateSub)
The msg I received was the following:
MessageType: 'mavros_msgs/State'
Header: [1x1 Header]
Connected: 1
Armed: 0
Guided: 0
Mode: 'AUTO.RTL'
However, at the same time I was running the following command in a linux terminal:
rostopic echo /mavros/state
The echoed value in this terminal for the topic '/mavros/state' was the following:
header:
seq: 1230
stamp:
secs: 1487749325
nsecs: 495354524
frame_id: ''
connected: True
armed: True
guided: True
mode: AUTO.RTL
Note that there is a disparity between the value that I got in Matlab and the one I got in the terminal: Matlab says that the Armed and Guided properties are 0 (false), while the terminal says their values are 1 (true).
I know for a fact that the values expected from Armed and Guided are 1 (true), which means that the receive function is returning the wrong value for these properties.
Is this a Matlab bug? Any idea why this would be happening?
Observation: the message type for 'mavros/state' is of the type 'mavros_msgs/State', with the following definitions (obtained from running rosmsg info mavros_msgs/State in a matlab terminal):
std_msgs/Header Header
logical Connected
logical Armed
logical Guided
char Mode
Réponses (1)
Marcelino Almeida
le 23 Fév 2017
Catégories
En savoir plus sur Code Generation dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!