Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tf_echo behavior when echo rate <= 0 #159

Closed
lucasw opened this issue Feb 18, 2018 · 2 comments
Closed

tf_echo behavior when echo rate <= 0 #159

lucasw opened this issue Feb 18, 2018 · 2 comments

Comments

@lucasw
Copy link
Contributor

lucasw commented Feb 18, 2018

The parameter is passed straight into rate()

If echo_rate is 0 there is a core dump (doesn't matter if frame1 is valid):

rosrun tf tf_echo map frame1 0
terminate called after throwing an instance of 'std::runtime_error'
  what():  Duration is out of dual 32-bit range
Aborted (core dumped)

That is undesirable. What I was actually hoping to find is a way to print a single transform then exit. Would 0 be acceptable for that, or should it be a different parameter for a single output?

If rate is negative then the rate.sleep() doesn't sleep and a lot of stdout results, eating up a lot of cpu:

rosrun tf tf_echo map frame1 -1
At time 1518933331.795
- Translation: [1.500, 0.000, 0.000]
- Rotation: in Quaternion [0.149, 0.000, 0.000, 0.989]
            in RPY (radian) [0.300, -0.000, 0.000]
            in RPY (degree) [17.189, -0.000, 0.000]
At time 1518933331.795
- Translation: [1.500, 0.000, 0.000]
- Rotation: in Quaternion [0.149, 0.000, 0.000, 0.989]
            in RPY (radian) [0.300, -0.000, 0.000]
            in RPY (degree) [17.189, -0.000, 0.000]
At time 1518933331.795
- Translation: [1.500, 0.000, 0.000]
- Rotation: in Quaternion [0.149, 0.000, 0.000, 0.989]
            in RPY (radian) [0.300, -0.000, 0.000]
            in RPY (degree) [17.189, -0.000, 0.000]
At time 1518933331.795
- Translation: [1.500, 0.000, 0.000]
- Rotation: in Quaternion [0.149, 0.000, 0.000, 0.989]
            in RPY (radian) [0.300, -0.000, 0.000]
            in RPY (degree) [17.189, -0.000, 0.000]
...

The max speed updating is possibly desirable, but ought to be documented.
Though if the tf hasn't actually changed when the loop loops it shouldn't bother printing it out again, unless additional information about when the query was made was also printed? I'll make a pr for one or both possibilities.

I'm interested in tf_echo now, but does Rate deserve an issue for this also?

@tfoote
Copy link
Member

tfoote commented Feb 21, 2018

Certainly adding a range check to give a better error if a zero or negative rate is provided to clearly state that it's outside of a valid range.

For the single output and only updating on change that also makes sense. But I'd suggest that these would be best implemented as arguments similar to vcs logs. Like -l, --limit=1 and --changed-values-only. And to do that I would suggest that reimplementing this in python might make sense. Obviously this would be a big change, but it would be a good reason to migrate from tf to tf2_tools where the new python implementation could live. Using argparse and python will make this much simpler to implement.

For the rate it could throw it's own runtime_error with the message that a zero rate causes a divide by zero error, instead of having it fail at the next step where it gets a nan as the duration.

@tfoote
Copy link
Member

tfoote commented Feb 21, 2018

Patched here, and discussion open on ros/geometry2#287 so I'm going to close.

@tfoote tfoote closed this as completed Feb 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants