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

4 frame positioned relative to each other

asked 2017-05-03 03:36:11 -0500

Ervin gravatar image

updated 2017-05-03 07:24:12 -0500

Hi!

Recently, I have started to play in ROS and now I am trying to display 4 frames in RVIZ without success. The problem is that, the frames should be positioned relative to each other and me, with my ignorant brain cant realize the mistake.

static tf2_ros::TransformBroadcaster br;
for (int i = 1; i <= myRobot->getJointNumber(); i++) {
    stringstream name, prevName;
    name << "{" << i << "}";
    prevName << "{" << (i-1) << "}";
    geometry_msgs::TransformStamped transformStamped;
    transformStamped.header.stamp = ros::Time::now();

    transformStamped.header.frame_id = prevName.str();
    transformStamped.child_frame_id = name.str();

    transformStamped.transform.translation.x = 0.0;
    transformStamped.transform.translation.y = 0.0;
    transformStamped.transform.translation.z = 0.0;
    tf2::Quaternion q;
    q.setRPY(0, 0, 0);
    transformStamped.transform.rotation.x = q.x();
    transformStamped.transform.rotation.y = q.y();
    transformStamped.transform.rotation.z = q.z();
    transformStamped.transform.rotation.w = q.w();

    frames.push_back(transformStamped);
    br.sendTransform(transformStamped);
}

Only one or two frames shows up, which are directly linked to the fixed frame.

And here is two image to see how it is shown: image descriptionhttps://drive.google.com/file/d/0By6a...

rosrun tf view_frames : https://drive.google.com/file/d/0By6a...

edit retag flag offensive close merge delete

Comments

What does the pdf output look like if you run rosrun tf view_frames

Felix Endres gravatar image Felix Endres  ( 2017-05-03 05:38:06 -0500 )edit
Ervin gravatar image Ervin  ( 2017-05-03 05:44:04 -0500 )edit

That looks correct. As does your code. Maybe your 30khz update rate is overburdening rviz.

Felix Endres gravatar image Felix Endres  ( 2017-05-03 09:45:47 -0500 )edit

There is no +1 funny, otherwise I would've used it here :)

gvdhoorn gravatar image gvdhoorn  ( 2017-05-03 09:52:35 -0500 )edit

Thanks Felix, I found the problem, it is working now!

Ervin gravatar image Ervin  ( 2017-05-03 09:56:41 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-05-03 09:55:14 -0500

Ervin gravatar image

Finally, I found the problem... I wrote an other broadcaster function too, which is updating the frames from the frames-vector. This updater function didn't have the header.stamp... so the problem come from here.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2017-05-03 03:12:02 -0500

Seen: 296 times

Last updated: May 03 '17