[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

python evaluation of expressions in roslaunch #784

Merged
merged 1 commit into from
Apr 12, 2016

Conversation

rhaschke
Copy link
Contributor
@rhaschke rhaschke commented Apr 5, 2016

Retargeted #762 to kinetic.

@gerkey
Copy link
Contributor
gerkey commented Apr 11, 2016

+1

The test failures in test_rosbag look to me like they're unrelated. The underlying failure is a path/permissions issue, e.g.: Error opening file: /tmp/test_rosbag_random_record_54321.bag. @dirk-thomas, is that due to some issue on the build machines?

@gerkey
Copy link
Contributor
gerkey commented Apr 11, 2016

Btw, the test failures are indeed unrelated to this change: #787.

@gerkey
Copy link
Contributor
gerkey commented Apr 12, 2016

@ros-pull-request-builder retest this please

@@ -46,6 +46,7 @@

import rosgraph.names
import rospkg
import loader
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this referring to the relative module roslaunch.loader? Then please use absolute import names (optionally with from and updating the usage) and insert them in alphabetical order. E.g.:

import rosgraph.names
from roslaunch.loader import convert_value
import rospkg

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't relative imports of the folloing form better, since they don't rely on roslaunch referring to the parent module (ie, if the pythonpath has two modules with that name)

from .loader import convert_value

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PEP 8 recommends absolute imports (see https://www.python.org/dev/peps/pep-0008/#imports). If you use the from syntax it needs to be absolute.

(Also I don't think any code within this repo uses relative imports currently?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use the from syntax it needs to be absolute

Not sure what you mean by that, but thanks for pointing out to me that PEP8 says "Standard library code should avoid complex package layouts and always use absolute imports"

@dirk-thomas
Copy link
Member

Beside the small comments this looks good. Can you please squash the commits after updating.

@rhaschke
Copy link
Contributor Author

@dirk-thomas Fixed the PEP8 issues. Shall I squash? It's getting harder to follow the changes then... I guess, it's better when you do during merging.

@dirk-thomas
Copy link
Member

If I squash and merge using the GitHub interface the single commit won't have any reference to this ticket. Therefore I think it would be better that you squash the commits on this branch and we do a normal merge commit.

- evaluation of expressions of the form $(eval ...)
- functions env(), optenv(), anon(), find(), arg() map onto corresponding $-substitutions
- implicit access to args using their name, i.e. name instead of arg('name')
@rhaschke rhaschke force-pushed the roslaunch-python-evaluation branch from d0a6e5e to 98b1829 Compare April 12, 2016 20:03
@rhaschke
Copy link
Contributor Author

@dirk-thomas Squashed into a single commit as requested.

@dirk-thomas dirk-thomas merged commit 4d90a95 into ros:kinetic-devel Apr 12, 2016
@dirk-thomas
Copy link
Member

Can you please make sure to document this new functionality in the wiki for the Kinetic version of roslaunch (and post the link here). Even though it doesn't require any migration step I think it would also be great to mentioned on this page: http://wiki.ros.org/kinetic/Migration

@eric-wieser
Copy link
Contributor

Would it be desirable to expose math in the _eval_dict (or more questionably everything within it), so that $(eval math.pi) can be used in parameters?

@rhaschke
Copy link
Contributor Author

Would it be desirable to expose |math| in the |_eval_dict|, so that
|$(eval math.pi)| can be used in parameters?

If that is desired, it's easy to do. We have exposed math symbols as
well as ['list', 'dict', 'map', 'str', 'float', 'int'] in xacro.

@eric-wieser
Copy link
Contributor

I'd say there's a strong argument for making the environment be identical in .launch files and .xacro for the sake of consistency

@rhaschke
Copy link
Contributor Author

Can you please make sure to document this new functionality in the
wiki for the /Kinetic/ version of roslaunch. Even though it doesn't
require any migration step I think it would also be great to mentioned
on this page: http://wiki.ros.org/kinetic/Migration

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants