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

Changing TransformListener's transform

asked 2015-03-23 17:29:37 -0500

RosFan19 gravatar image

Hi,

So I'm trying to change the transform that I'm getting from a transform listener, but it doesn't seem to change.

When trying to set the values, they don't change. Here I'm declaring a const variable, since getRotation.getX returns a const:

const double scalarX = transform.getRotation().getX() + 0.1;
transform.getRotation().setX(scalarX);

Transform is acting like it's const, but it's not and so isn't getRotation, but I still can't change the values.

tf::StampedTransform transform;
listener.lookupTransform(*camera_depth, *base_link, ros::Time(0), transform);

cout << "Before added scalar: " << transform.getRotation().getX() << endl;

const double scalarX = transform.getRotation().getX() + 0.1;
transform.getRotation().setX(scalarX);
cout << "After added scalar: " << transform.getRotation().getX() << endl;
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-03-23 18:45:12 -0500

tfoote gravatar image

This is not operating as you expect because you are operating on a temporarily allocated Quaternion not on the transform object.

edit flag offensive delete link more

Comments

You are correct. Thanks for the answer!

RosFan19 gravatar image RosFan19  ( 2015-03-27 12:19:34 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-03-23 17:29:37 -0500

Seen: 285 times

Last updated: Mar 23 '15