Re: [ros-users] cmd_vel topic has no attribute linear

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: hitesh dhiman
Date:  
To: ros-users
Subject: Re: [ros-users] cmd_vel topic has no attribute linear
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&#174; 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
> >
> > https://lists.sourceforge.net/lists/listinfo/ros-users
> >
> > _______________________________________________
> > ros-users mailing list
> >
> > https://code.ros.org/mailman/listinfo/ros-users
> >
> >
> > _______________________________________________
> > ros-users mailing list
> >
> > https://code.ros.org/mailman/listinfo/ros-users
> >
> >
> > _______________________________________________
> > ros-users mailing list
> >
> > https://code.ros.org/mailman/listinfo/ros-users
> >
> >
> _______________________________________________
> ros-users mailing list
>
> https://code.ros.org/mailman/listinfo/ros-users
>




--
Regards,
Hitesh Dhiman
Electrical Engineering
National University of Singapore