Robotics StackExchange | Archived questions

How can i order axes[] in Joy message ?

Question is how can i order axes of this msg. http://docs.ros.org/indigo/api/sensor_msgs/html/msg/Joy.html

if i write this code.

self.remoteMsg.header.stamp = rospy.Time.now()-self.time_start
            self.remoteMsg.buttons = {d[0],d[1],d[2],d[3],d[4],d[5]}
            print 'r1:', str(d[0])[:4] ,'r2:' , str(d[1])[:4] ,'r3:' , str(d[2])[:4] ,'r4:' , str(d[3])[:4] ,'r5:' , str(d[4])[:4] ,'r6:' , str(d[5])[:4]

It seem to correct order when it print out screen , but not when it on topic. Sorry for my bad english skill. Thank you advanced. :D

Asked by Thanabadee on 2015-06-14 03:23:30 UTC

Comments

Answers

It looks like you're assigning a map into a message that should actually be an array.

Try:

self.remoteMsg.buttons = d[0:6]

Asked by ahendrix on 2015-06-14 10:57:07 UTC

Comments

Oh .. it work. Thx u very much :D

Asked by Thanabadee on 2015-06-15 04:43:06 UTC