Ask Your Question
1

4 frame positioned relative to each other

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

Ervin gravatar image

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

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 imageFelix Endres ( 2017-05-03 05:38:06 -0600 )edit
Ervin gravatar imageErvin ( 2017-05-03 05:44:04 -0600 )edit

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

Felix Endres gravatar imageFelix Endres ( 2017-05-03 09:45:47 -0600 )edit

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

gvdhoorn gravatar imagegvdhoorn ( 2017-05-03 09:52:35 -0600 )edit

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

Ervin gravatar imageErvin ( 2017-05-03 09:56:41 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 43 times

Last updated: May 03 '17