Hi Ken, Thanks for the help. I just have a small question regarding this example node. The callback function takes in a 'data' argument. Does this mean that the message being published has a 'data' attribute? Is it true for all messages? On Mon, Apr 19, 2010 at 3:55 AM, Ken Conley wrote: > Hi Hitesh, > > Please look at the "Writing the Subscriber Node" section here: > > > http://www.ros.org/wiki/rospy_tutorials/Tutorials/WritingPublisherSubscriber#Writing_the_Subscriber_Node > > Your subscriber has no callback. The callback is what receives the > message instance. > > Hope this helps, > Ken > > On Sun, Apr 18, 2010 at 12:51 PM, hitesh dhiman > wrote: > > Hi Ken, > > Actually i started out by following the tutorials. > > Here's the code I'm using: > > > > velocity = rospy.Subscriber("cmd_vel", Twist) > > > > I checked using rxgraph, my node is subscribing to cmd_vel. I also used > > rostopic echo /cmd_vel, i can see the velocities being published. Now the > > problem is, how to extract the information from the message. > > > > If i try to type : > > > > print velocity.linear.x > > > > I get an error: velocity has no attribute x > > > > Even if i just do velocity.linear[0], or simply velocity.linear, i get > the > > error: > > > > velocity has no attribute linear > > > > The cmd_vel topic has a type Twist message, that means two cpp vectors, > each > > for linear and angular velocities. I'm not able to get the correct format > to > > access these vectors. > > > > On Mon, Apr 19, 2010 at 3:00 AM, Ken Conley > wrote: > >> > >> Hi Hitesh, > >> > >> If you follow the rospy tutorials for publishing and subscribing [1] > >> you will be able to subscribe to any type of ROS topic, including > >> cmd_vel, and extract the fields that you want. > >> > >> [1] http://www.ros.org/wiki/rospy/Tutorials > >> > >> - Ken > >> > >> On Sun, Apr 18, 2010 at 11:55 AM, hitesh dhiman > >> wrote: > >> > Hi ken, > >> > Well I think you're correct. If I just do a print vel, it says > >> > subscriber > >> > object at 'address'...Basically what I'm doing is getting the cmd_vel > >> > published from navigation stack. > >> > On this note, is it possible to find out the correct way to get the > >> > linear > >> > and angular velocities from cmd_vel ? > >> > > >> > On Apr 19, 2010 2:34 AM, "Ken Conley" wrote: > >> > > >> > Hi hitesh, > >> > > >> > It would help if you cut and paste the exact error message and include > a > >> > sample program. I suspect that the program is using the subscriber > >> > object > >> > instead of the message object, but this is hard to tell without more > >> > information. > >> > > >> > Ken > >> > > >> >> > On Apr 18, 2010 9:43 AM, "hitesh dhiman" > >> >> > > >> >> > wrote: > > Hi all, > I'... > >> > > >> > > >> > > ------------------------------------------------------------------------------ > >> > Download Intel® Parallel Studio Eval > >> > Try the new software tools for yourself. Speed compiling, find bugs > >> > proactively, and fine-tune applications for parallel performance. > >> > See why Intel Parallel Studio got high marks during beta. > >> > http://p.sf.net/sfu/intel-sw-dev > >> > _______________________________________________ > >> > ros-users mailing list > >> > ros-users@lists.sourceforge.net > >> > https://lists.sourceforge.net/lists/listinfo/ros-users > >> > > >> > _______________________________________________ > >> > ros-users mailing list > >> > ros-users@code.ros.org > >> > https://code.ros.org/mailman/listinfo/ros-users > >> > > >> > > >> > _______________________________________________ > >> > ros-users mailing list > >> > ros-users@code.ros.org > >> > https://code.ros.org/mailman/listinfo/ros-users > >> > > >> > > >> > _______________________________________________ > >> > ros-users mailing list > >> > ros-users@code.ros.org > >> > https://code.ros.org/mailman/listinfo/ros-users > >> > > >> > > >> _______________________________________________ > >> ros-users mailing list > >> ros-users@code.ros.org > >> https://code.ros.org/mailman/listinfo/ros-users > > > > > > > > -- > > Regards, > > Hitesh Dhiman > > Electrical Engineering > > National University of Singapore > > > > _______________________________________________ > > ros-users mailing list > > ros-users@code.ros.org > > https://code.ros.org/mailman/listinfo/ros-users > > > > > _______________________________________________ > ros-users mailing list > ros-users@code.ros.org > https://code.ros.org/mailman/listinfo/ros-users > -- Regards, Hitesh Dhiman Electrical Engineering National University of Singapore