Closed philianeles closed 2 years ago
I think there's a misunderstanding with the values expected by the Time()
default constructor. It expects two integers, and there are several lines in your example that use floats, which I guess end up in some rather invalid state of the class. We should add validation to raise a clearer error if this happens thou, but in the meantime, the following lines should be double checked:
time = roslibpy.Time(1, 0.1).now()
: this works, but it is not correct. now
should be called as a static method: roslibpy.Time.now()
time = roslibpy.Time(time.to_sec() + 5, 0)
: I guess this is meant to be time = roslibpy.Time.from_sec(time.to_sec() + 5)
time = roslibpy.Time(0, 0).from_sec(time.to_sec() + 1)
: this one works, but can be shorter: time = roslibpy.Time.from_sec(time.to_sec() + 1)
and then, when you're creating the messages, why not use the class Header
and Time
there as well? So instead of manually turning them into dicts, which I guess leaves room for mistakes (e.g. when you append to the pose_array
, the value of stamp
is set to 'stamp': time.to_sec()
which I doubt converts correctly to a time type, you can do something like:
time = roslibpy.Time.from_sec(time.to_sec() + 1)
seq += 1
message = publisher.publish({'header': roslibpy.Header(seq=seq, stamp=time, frame_id='odom'), 'poses': pose_array})
and same thing goes for the lines with pose_array.append(
Thank you @gonzalocasas! all these seem to fix the problem!
cool! thx! I'm adding #91 so that this situation is easier to catch in the future!
Hi, I am trying to increment
secs
in the message below, which seems to be not changing at all:The code that publishes the message is like this: