Hi Ken,<div>Thanks for the help. </div><div>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?<br>
<br><div class="gmail_quote">On Mon, Apr 19, 2010 at 3:55 AM, Ken Conley <span dir="ltr"><<a href="mailto:kwc@willowgarage.com">kwc@willowgarage.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Hitesh,<br>
<br>
Please look at the "Writing the Subscriber Node" section here:<br>
<br>
<a href="http://www.ros.org/wiki/rospy_tutorials/Tutorials/WritingPublisherSubscriber#Writing_the_Subscriber_Node" target="_blank">http://www.ros.org/wiki/rospy_tutorials/Tutorials/WritingPublisherSubscriber#Writing_the_Subscriber_Node</a><br>

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