0
$\begingroup$

Rosanswers logo

ROS nub

I found https://index.ros.org/p/angles/ and ros2-foxy-angles got installed by rosdep from my package.xml:

  <exec_depend>angles</exec_depend>

The git says it hasn't changed but there are no foxy "API Docs" and the ROS1 docs only show C++.

Where can I find a Python example for what to import?

# get degrees to radians func
from ??? import from_degrees

        self.msg_field_of_view = from_degrees(25.0)     # +/- 12.5 degree FOV (~60cm at max range)

I'm starting to think Foxy does not support angles in Python. (the ROS2 setup.py refers to catkin ) My temp workaround since I only need the degrees to radians func at the moment:

# get degrees to radians func
from math import radians

        self.msg_field_of_view = radians(25.0)     # +/- 12.5 degree FOV (~60cm at max range)

Originally posted by RobotDreams on ROS Answers with karma: 327 on 2021-07-13

Post score: 0


Original comments

Comment by gvdhoorn on 2021-07-14:
If all else fails, it's easiest to look at the source code.

Given that angles isn't really that complex (it's essentially a single file) and all functions are pretty well documented, that should provide you with the information you're looking for.

Comment by RobotDreams on 2021-07-14:
Thank you for responding, but nowhere in the source code does anything tell me where ROS2 installs the source code.

Case in point: looking at the source for std_msgs.msg.Float32 nowhere does it say to:

  • place <exec_depends>std_msgs</exec_depends> in package.xml
  • run rosdep install -i --from-path src in your ros2 workspace root
  • place "from std_msgs.msg import Float32" in your Python program
    and life will be great, but I figured that out from the source code AND the similarity to the ROS2 pub/sub tutorial which publishes a "String" by "from std_msgs.msg import String"

ROS2 angles python setup codeseems to indicate the Python package is "angles", and suggest "from angles import from_degrees" BUT

  • build succeeds

  • execution says:

    from angles import from_degrees ModuleNotFoundError: No module named 'angles'

Comment by gvdhoorn on 2021-07-14:\

but nowhere in the source code does anything tell me where ROS2 installs the source code.

Not the specific link I referred you to, no.

But angles/CMakeLists.txt does. And so does angles/setup.py, but that's indeed pre-ROS 2.

But in any case: I did not point you "the source code" to figure out where things are installed. I understood your question as asking "what functionality is offered by this package?".

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I'm not sure I understand what you're asking in this case. From your question it appeared you were wondering how to use the angles package, once you've installed it (you wrote "ros2-foxy-angles got installed by rosdep from my package.xml").

I don't understand how std_msgs.msg.Float32 is related.

The link to the source repository is displayed on the ROS Index page you already linked. See #q381559.

but nowhere in the source code does anything tell me where ROS2 installs the source code. [..] I'm starting to think Foxy does not support angles in Python.

While there is nothing in the package itself (ie: the actual business code) that would make it impossible to use this package on ROS 2, it does currently not install the Python-side. The setup.py is indeed pre-ament (meaning: catkin).

The angles package installed by rosdep for you is the C++ side.

If you have a need to use functionality right now, you could copy the relevant function(s) from the __init__.py and use them like that.

It would be nicer however if the Python side could be included in the next release.

I would recommend you open an issue on the tracker to discuss what would be needed to get it released. I would expect it would only take an update of the setup.py and perhaps the CMakeLists.txt.

It could also be the maintainers would like to split the Python and C++ versions of the packages. That would require slightly more changes, but would still not be too much work.


Originally posted by gvdhoorn with karma: 86574 on 2021-07-14

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by RobotDreams on 2021-07-14:
Thank you for looking deeper into my original question: "Where can I find a Python example for what to import? (after installing ros2-angles-foxy)"

Indeed - the answer is "there is no example, and ros2 foxy does not support Python interface to angles"

As a ROS2 nub, tackling the port of ROS1 gopigo3_node to ROS2 seems to be exposing me to some ROS2 bleeding edges (migrating launch arguments documentation, and now Python angles not yet.)

Comment by gvdhoorn on 2021-07-14:\

"Where can I find a Python example for what to import? (after installing ros2-angles-foxy)"

just to be extra clear: there would be nothing special about angles necessarily. It would just be another Python package. The fact it's used with ROS (1 or 2) does not really matter.

Comment by gvdhoorn on 2021-07-14:
And it seems you opened an issue on the tracker: ros/angles#26.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.