ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If I understand well what tfoote says, how come is your code not crashing as well while you assign odom.pose.pose.position.x = [something]?

In my case, I crash as soon as I try to assign a value as you do in your code:

msg = Odometry()
msg.pose.pose.position.x = 0.0
...
pub_odom.publish(msg)

always results in:

msg.pose.pose.position.x = 0.0
AttributeError: 'tuple' object has no attribute 'x'

From the documentation, I see that pose.pose.position is a Geometry_msgs/Point message. Should I cast my values in Point and then assign them to position?

Raph

If I understand well what tfoote Tully says, how come is your code not crashing as well while you assign odom.pose.pose.position.x = [something]?

In my case, I crash as soon as I try to assign a value as you do in your code:

msg = Odometry()
msg.pose.pose.position.x = 0.0
...
pub_odom.publish(msg)

always results in:

msg.pose.pose.position.x = 0.0
AttributeError: 'tuple' object has no attribute 'x'

From the documentation, I see that pose.pose.position is a Geometry_msgs/Point message. Should I cast my values in Point and then assign them to position?

Raph

If I understand well what Tully says, how come is your code not crashing as well while like mine does when you assign odom.pose.pose.position.x = [something]?

In my case, I crash as soon as I try to assign a value as you do in your code:

msg = Odometry()
msg.pose.pose.position.x = 0.0
...
pub_odom.publish(msg)

always results in:

msg.pose.pose.position.x = 0.0
AttributeError: 'tuple' object has no attribute 'x'

From the documentation, I see that pose.pose.position is a Geometry_msgs/Point message. Should I cast my values in Point and then assign them to position?

Raph

If I understand well what Tully says, how come is your code not crashing like mine does when you assign odom.pose.pose.position.x = [something]?

In my case, I crash as soon as I try to assign a value as you do in your code:

msg = Odometry()
msg.pose.pose.position.x = 0.0
...
pub_odom.publish(msg)

always results in:

msg.pose.pose.position.x = 0.0
AttributeError: 'tuple' object has no attribute 'x'

From the documentation, I see that pose.pose.position is a Geometry_msgs/Point message. Should I cast my values in Point and then assign them to position?

Raph

==================

UDPATE

Here is my solution:

msg = Odometry()
msg.pose.pose.position = Point(x,y,0.0)
...
pub_odom.publish(msg)

If I understand well what Tully says, how come is your code not crashing like mine does when you assign odom.pose.pose.position.x = [something]?

In my case, I crash as soon as I try to assign a value as you do in your code:

msg = Odometry()
msg.pose.pose.position.x = 0.0
...
pub_odom.publish(msg)

always results in:

msg.pose.pose.position.x = 0.0
AttributeError: 'tuple' object has no attribute 'x'

From the documentation, I see that pose.pose.position is a Geometry_msgs/Point message. Should I cast my values in Point and then assign them to position?

Raph

==================

UDPATE

Here is my solution:

from geometry_msgs.msg import Point
...
msg = Odometry()
msg.pose.pose.position = Point(x,y,0.0)
...
pub_odom.publish(msg)