Borrar filtros
Borrar filtros

ROS Subscriber does not return correct value from the topic

2 visualizaciones (últimos 30 días)
Marcelino Almeida
Marcelino Almeida el 22 de Feb. de 2017
Respondida: Marcelino Almeida el 23 de Feb. de 2017
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

Respuestas (1)

Marcelino Almeida
Marcelino Almeida el 23 de Feb. de 2017
I just updated my Matlab to R2016b (I had R2016a before) and the problem remains.
Running echo in matlab:
rostopic echo /mavros/state
Connected : 1
Armed : 0
Guided : 0
Mode : AUTO.LOITER
Header
Seq : 3483
FrameId :
Stamp
Sec : 1487832172
Nsec : 513096941
Running in a Linux terminal:
header:
seq: 3483
stamp:
secs: 1487832172
nsecs: 513096941
frame_id: ''
connected: True
armed: True
guided: True
mode: AUTO.LOITER
Again, all values are precisely equal in both, except for "Guided" and "Armed". I can't make much sense of this except accept that this is a Matlab bug.

Categorías

Más información sobre ROS Log Files and Transformations en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by