ros-drivers / audio_common

Common code for working with audio in ROS
BSD 3-Clause "New" or "Revised" License
86 stars 151 forks source link

Can't get ROS 2 branch to work in ROS2 humble #227

Open dgarcu opened 1 year ago

dgarcu commented 1 year ago

Hi there,

I would like to add sounds to my projects. I am trying to use the ROS 2 branch, more precisely the sound_play package. I'm working with Humble distro and Ubuntu 22.04.

First of all, I cannot manage to compile unless I change from this (In CMakeLists.txt)

[...]
rosidl_generate_interfaces(${PROJECT_NAME}
[...]

To something like this:

[...]
rosidl_generate_interfaces(<custom_name>
[...]

Essentially, everywhere where ${PROJECT_NAME} appears. This is how I've compiled it, BTW (after doing the same with audio_common_msgs with no issues):

colcon build --symlink-install --packages-select sound_play

I figured out because CMake complained about a duplicate target name, which is sound_play, a directory inside the sound_play package root directory, sounds like a duplicate to me. OFC, changing those lines breaks the package so badly that it does not work at all despite of successful build. I've also tried to rename that directory to something else. Trying to run any script results on missed files (Because the path of some modules changed to the <custom_name>)

I'm kinda new to ROS and I do not know how to proceed. I am clearly missing some steps. How can I install sound_play in ROS 2 properly? I know this branch is still in development, but I think that I am the issue here.

Thanks in advance! Cheers.

knorth55 commented 1 year ago

Hi, humble rosidl_python has serious bug reported below. https://github.com/ros2/rosidl_python/issues/141

the issue can be solved by the following two PRs, but not merged yet. https://github.com/ros2/rosidl_python/pull/187

212

Can you try https://github.com/ros2/rosidl_python/pull/187 and #212 ? If your problem solved, can you add a comment in https://github.com/ros2/rosidl_python/pull/187 ?

dgarcu commented 1 year ago

Sorry, I'm kinda new to Github too and I forget to chek PR's. I'm giving it a try right now.

dgarcu commented 1 year ago

Sorry, I'm kinda new to Github too and I forget to chek PR's. I'm giving it a try right now.

I'm stuck again with https://github.com/ros2/rosidl_python/pull/187. Apparently now I lack from a module called rosidl_pycommon. I managed to found it in the source ROS repos, but in the Humble branch this module is missing, hence I do not have it installed. Since I have installed ROS Humble from binaries, I do not know exactly how to proceed.

Sorry to bother you, clearly this is not an issue with audio_common at all. I feel like this kind of problems need to be answered somewhere else. Sorry!

Thanks for your fast reply, btw. :smile:

knorth55 commented 1 year ago

my colcon workspace config is as below yaml.

repositories:
  audio_common:
    type: git
    url: https://github.com/knorth55/audio_common.git
    version: ros2-idl-bugfix
  rosidl:
    type: git
    url: https://github.com/ros2/rosidl.git
    version: 3.3.1
  rosidl_python:
    type: git
    url: https://github.com/knorth55/rosidl_python.git
    version: fix-141

You can copy this yaml to audio.repos, and run vcs import < audio.repos to apply this config to your workspace. you can install vcs command with python3-vcstools.

root@3655dde8c0dd:~# mkdir tmp_ws/src -p
root@3655dde8c0dd:~# cd tmp_ws/src/
root@3655dde8c0dd:~/tmp_ws/src# ls
root@3655dde8c0dd:~/tmp_ws/src# vcs import < ~/audio.repos 
...
=== ./audio_common (git) ===
Cloning into '.'...
=== ./rosidl (git) ===
Cloning into '.'...
=== ./rosidl_python (git) ===
Cloning into '.'...
root@3655dde8c0dd:~/tmp_ws/src# ls
audio_common  rosidl  rosidl_python
root@3655dde8c0dd:~/tmp_ws/src# rosdep install --from-paths . -y -r -i
...
root@3655dde8c0dd:~/tmp_ws/src# colcon build
...
dgarcu commented 1 year ago

I owe you a beer! :smile:

https://user-images.githubusercontent.com/92941081/227008380-0f3a5825-4ba9-429e-aa74-9f3aef977bda.mp4

knorth55 commented 1 year ago

@dgarcu hahaha, I'm glad that you finally find the solution :smile: . Can you also write a comment in https://github.com/ros2/rosidl_python/pull/187 to speed up the review and merge ?

dgarcu commented 1 year ago

@dgarcu hahaha, I'm glad that you finally find the solution smile . Can you also write a comment in ros2/rosidl_python#187 to speed up the review and merge ?

Sure, I'm doing it right now. Thanks again.

Viral-Doshi-Conigital commented 1 year ago

Hello, I have a query on the similar lines as the one above. If that's okay, my question is as follows: I'm working on a project in which need audio (wav files to be executed). I'm using the ROS 2 branch of audio_common and intend to use sound_play module. I'm working with Humble on a docker and Ubuntu 20.04 LTS. I had similar issues as above, which did get resolved. Thanks to the above thread.

The issue, when executing sound_play command followed by the absolute path of wav file, the play.py prints that it is playing the file. However, no audio can be heard (its the same for a string input). The docker has access to device soundcard.

The commands that I have been using: ros2 run sound_play play.py /path/to/file.wav ros2 run sound_play say.py 'Hello'

Any suggestion of what mistakes I could have done and its possible solution.

In addition, let me know if its no relevant to the above thread and needs a new issue to be raised.

Thanks

knorth55 commented 1 year ago

@dviral13 it may be different issue so can you open a new issue? also can you try playing the sound from alsa or pulse audio in docker, not using this package. you wrote that the sound cards were listed but im not sure the sound card ls were correctly recognized or not.

Viral-Doshi-Conigital commented 1 year ago

@knorth55 I have tried aplay command, not sure if it the same, but that commands works.

dgarcu commented 1 year ago

@dviral13

Maybe I am late. But for me to run both of your commands I have to previously run this one:

ros2 run sound_play soundplay_node.py

Please @knorth55 correct me if I am wrong, but soundplay_node.py it is neccesary to be launched since both play.py and say.py do not "play" directly from said nodes, but asks soundplay_node.py as a ros-service to do so. Here is the output of soundplay_node.py when say.py runs.

Screenshot from 2023-04-22 11-43-01

Same goes for play.py, at least in my case.

Greetings!

hello-chintan commented 11 months ago

@knorth55 Any update on this? I am facing the same issue as @dgarcu while building audio_common in ROS 2 Iron.

Do you still recommend building ros_idl and rosidl_python branches with your fixes from source?

knorth55 commented 11 months ago

i dont get good response from ros2 idl python repo, so the issue still remains. i recommend you to use my fork, if you are in hurry.

hello-chintan commented 11 months ago

Thanks for the quick response. If your proposed fix is not in line with what the maintainer requested, what is the path forward?

knorth55 commented 11 months ago

I propose a path to solve the issue, but i dont get a response. the maintainer wants to solve the issue from the fundamental ros2 cmake structure, but i dont have enough time to look into that. but maybe i will do later, or some volunteer will solve the issue before.

https://github.com/ros2/rosidl_python/pull/187#issuecomment-1582106506

antbono commented 3 months ago

Hello everyone!

I tried to the workspace configuration suggested by @knorth55, but it seems not working with ros iron. In my workspace I run

vcs import src < audio.repos
rosdep install --from-paths src -i
colcon build

but I get these errors with rosidl_generator_py

ImportError in template '/opt/ros/iron/share/rosidl_typesupport_fastrtps_c/resource/msg__type_support_c.cpp.em': cannot import name 'SERVICE_EVENT_MESSAGE_SUFFIX' from 'rosidl_parser.definition' (/home/toto/Desktop/lola_test/install/rosidl_parser/lib/python3.11/site-packages/rosidl_parser/definition.py)
ImportError when expanding 'idl__type_support_c.cpp.em' into '/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_fastrtps_c/rosidl_generator_py/msg/detail/builtin_type_sequences_idl__type_support_c.cpp': cannot import name 'SERVICE_EVENT_MESSAGE_SUFFIX' from 'rosidl_parser.definition' (/home/toto/Desktop/lola_test/install/rosidl_parser/lib/python3.11/site-packages/rosidl_parser/definition.py)
Error processing idl file: /home/toto/Desktop/lola_test/src/rosidl_python/rosidl_generator_py/msg/BuiltinTypeSequencesIdl.idl
Traceback (most recent call last):
  File "/opt/ros/iron/lib/rosidl_typesupport_fastrtps_c/rosidl_typesupport_fastrtps_c", line 33, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/ros/iron/lib/rosidl_typesupport_fastrtps_c/rosidl_typesupport_fastrtps_c", line 29, in main
    generate_typesupport_fastrtps_c(args.generator_arguments_file)
  File "/opt/ros/iron/lib/python3.10/site-packages/rosidl_typesupport_fastrtps_c/__init__.py", line 24, in generate_typesupport_fastrtps_c
    return generate_files(generator_arguments_file, mapping)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/toto/Desktop/lola_test/install/rosidl_pycommon/lib/python3.10/site-packages/rosidl_pycommon/__init__.py", line 96, in generate_files
    raise(e)
  File "/home/toto/Desktop/lola_test/install/rosidl_pycommon/lib/python3.10/site-packages/rosidl_pycommon/__init__.py", line 87, in generate_files
    expand_template(
  File "/home/toto/Desktop/lola_test/install/rosidl_pycommon/lib/python3.10/site-packages/rosidl_pycommon/__init__.py", line 149, in expand_template
    interpreter.string(template_content, template_path, locals=data)
  File "/usr/lib/python3/dist-packages/em.py", line 2391, in string
    self.safe(scanner, True, locals)
  File "/usr/lib/python3/dist-packages/em.py", line 2401, in safe
    self.parse(scanner, locals)
  File "/usr/lib/python3/dist-packages/em.py", line 2421, in parse
    token.run(self, locals)
  File "/usr/lib/python3/dist-packages/em.py", line 1547, in run
    self.subrun(info[0][1], interpreter, locals)
  File "/usr/lib/python3/dist-packages/em.py", line 1631, in subrun
    token.run(interpreter, locals)
  File "/usr/lib/python3/dist-packages/em.py", line 1425, in run
    interpreter.execute(self.code, locals)
  File "/usr/lib/python3/dist-packages/em.py", line 2596, in execute
    _exec(statements, self.globals, locals)
  File "<string>", line 2, in <module>
  File "/home/toto/Desktop/lola_test/install/rosidl_pycommon/lib/python3.10/site-packages/rosidl_pycommon/__init__.py", line 198, in _expand_template
    interpreter.string(content, str(template_path), kwargs)
  File "/usr/lib/python3/dist-packages/em.py", line 2391, in string
    self.safe(scanner, True, locals)
  File "/usr/lib/python3/dist-packages/em.py", line 2401, in safe
    self.parse(scanner, locals)
  File "/usr/lib/python3/dist-packages/em.py", line 2421, in parse
    token.run(self, locals)
  File "/usr/lib/python3/dist-packages/em.py", line 1425, in run
    interpreter.execute(self.code, locals)
  File "/usr/lib/python3/dist-packages/em.py", line 2596, in execute
    _exec(statements, self.globals, locals)
  File "<string>", line 14, in <module>
ImportError: cannot import name 'SERVICE_EVENT_MESSAGE_SUFFIX' from 'rosidl_parser.definition' (/home/toto/Desktop/lola_test/install/rosidl_parser/lib/python3.11/site-packages/rosidl_parser/definition.py)
Exception ignored in: <function Interpreter.__del__ at 0x702b99996340>
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/em.py", line 2094, in __del__
  File "/usr/lib/python3/dist-packages/em.py", line 2157, in shutdown
  File "/usr/lib/python3/dist-packages/em.py", line 2647, in finalize
  File "/usr/lib/python3/dist-packages/em.py", line 2200, in push
AttributeError: '_io.TextIOWrapper' object has no attribute 'push'
gmake[2]: *** [CMakeFiles/rosidl_generator_py_custom__rosidl_typesupport_fastrtps_c.dir/build.make:96: rosidl_typesupport_fastrtps_c/rosidl_generator_py/msg/detail/builtin_type_sequences_idl__rosidl_typesupport_fastrtps_c.h] Error 1
gmake[2]: *** Deleting file 'rosidl_typesupport_fastrtps_c/rosidl_generator_py/msg/detail/builtin_type_sequences_idl__rosidl_typesupport_fastrtps_c.h'
gmake[1]: *** [CMakeFiles/Makefile2:335: CMakeFiles/rosidl_generator_py_custom__rosidl_typesupport_fastrtps_c.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/bounded_sequences__type_support.cpp:76:4: error: ‘rosidl_generator_py__msg__BoundedSequences__get_type_hash’ was not declared in this scope; did you mean ‘rosidl_generator_py__msg__BoundedSequences__are_equal’?
   76 |   &rosidl_generator_py__msg__BoundedSequences__get_type_hash,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rosidl_generator_py__msg__BoundedSequences__are_equal
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/bounded_sequences__type_support.cpp:77:4: error: ‘rosidl_generator_py__msg__BoundedSequences__get_type_description’ was not declared in this scope; did you mean ‘rosidl_generator_py__msg__BoundedSequences__Sequence__destroy’?
   77 |   &rosidl_generator_py__msg__BoundedSequences__get_type_description,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rosidl_generator_py__msg__BoundedSequences__Sequence__destroy
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/bounded_sequences__type_support.cpp:78:4: error: ‘rosidl_generator_py__msg__BoundedSequences__get_type_description_sources’ was not declared in this scope; did you mean ‘rosidl_generator_py__msg__BoundedSequences__Sequence__destroy’?
   78 |   &rosidl_generator_py__msg__BoundedSequences__get_type_description_sources,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rosidl_generator_py__msg__BoundedSequences__Sequence__destroy
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/bounded_sequences__type_support.cpp:79:1: error: too many initializers for ‘const rosidl_message_type_support_t’
   79 | };
      | ^
gmake[2]: *** [CMakeFiles/rosidl_generator_py_custom__rosidl_typesupport_c.dir/build.make:198: CMakeFiles/rosidl_generator_py_custom__rosidl_typesupport_c.dir/rosidl_typesupport_c/rosidl_generator_py/msg/bounded_sequences__type_support.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/arrays__type_support.cpp:76:4: error: ‘rosidl_generator_py__msg__Arrays__get_type_hash’ was not declared in this scope; did you mean ‘rosidl_generator_py__msg__Arrays__are_equal’?
   76 |   &rosidl_generator_py__msg__Arrays__get_type_hash,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rosidl_generator_py__msg__Arrays__are_equal
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/arrays__type_support.cpp:77:4: error: ‘rosidl_generator_py__msg__Arrays__get_type_description’ was not declared in this scope; did you mean ‘rosidl_generator_py__msg__Arrays__Sequence__destroy’?
   77 |   &rosidl_generator_py__msg__Arrays__get_type_description,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rosidl_generator_py__msg__Arrays__Sequence__destroy
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/basic_types__type_support.cpp:76:4: error: ‘rosidl_generator_py__msg__BasicTypes__get_type_hash’ was not declared in this scope; did you mean ‘rosidl_generator_py__msg__BasicTypes__are_equal’?
   76 |   &rosidl_generator_py__msg__BasicTypes__get_type_hash,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rosidl_generator_py__msg__BasicTypes__are_equal
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/constants__type_support.cpp:76:4: error: ‘rosidl_generator_py__msg__Constants__get_type_hash’ was not declared in this scope; did you mean ‘rosidl_generator_py__msg__Constants__are_equal’?
   76 |   &rosidl_generator_py__msg__Constants__get_type_hash,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rosidl_generator_py__msg__Constants__are_equal
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/basic_types__type_support.cpp:77:4: error: ‘rosidl_generator_py__msg__BasicTypes__get_type_description’ was not declared in this scope; did you mean ‘rosidl_generator_py__msg__BasicTypes__Sequence__destroy’?
   77 |   &rosidl_generator_py__msg__BasicTypes__get_type_description,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rosidl_generator_py__msg__BasicTypes__Sequence__destroy
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/constants__type_support.cpp:77:4: error: ‘rosidl_generator_py__msg__Constants__get_type_description’ was not declared in this scope; did you mean ‘rosidl_generator_py__msg__Constants__Sequence__destroy’?
   77 |   &rosidl_generator_py__msg__Constants__get_type_description,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rosidl_generator_py__msg__Constants__Sequence__destroy
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/basic_types__type_support.cpp:78:4: error: ‘rosidl_generator_py__msg__BasicTypes__get_type_description_sources’ was not declared in this scope; did you mean ‘rosidl_generator_py__msg__BasicTypes__Sequence__destroy’?
   78 |   &rosidl_generator_py__msg__BasicTypes__get_type_description_sources,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rosidl_generator_py__msg__BasicTypes__Sequence__destroy
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/basic_types__type_support.cpp:79:1: error: too many initializers for ‘const rosidl_message_type_support_t’
   79 | };
      | ^
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/constants__type_support.cpp:78:4: error: ‘rosidl_generator_py__msg__Constants__get_type_description_sources’ was not declared in this scope; did you mean ‘rosidl_generator_py__msg__Constants__Sequence__destroy’?
   78 |   &rosidl_generator_py__msg__Constants__get_type_description_sources,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rosidl_generator_py__msg__Constants__Sequence__destroy
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/constants__type_support.cpp:79:1: error: too many initializers for ‘const rosidl_message_type_support_t’
   79 | };
      | ^
gmake[2]: *** [CMakeFiles/rosidl_generator_py_custom__rosidl_typesupport_c.dir/build.make:212: CMakeFiles/rosidl_generator_py_custom__rosidl_typesupport_c.dir/rosidl_typesupport_c/rosidl_generator_py/msg/constants__type_support.cpp.o] Error 1
gmake[2]: *** [CMakeFiles/rosidl_generator_py_custom__rosidl_typesupport_c.dir/build.make:170: CMakeFiles/rosidl_generator_py_custom__rosidl_typesupport_c.dir/rosidl_typesupport_c/rosidl_generator_py/msg/basic_types__type_support.cpp.o] Error 1
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/bounded_plain_sequences__type_support.cpp:76:4: error: ‘rosidl_generator_py__msg__BoundedPlainSequences__get_type_hash’ was not declared in this scope; did you mean ‘rosidl_generator_py__msg__BoundedPlainSequences__are_equal’?
   76 |   &rosidl_generator_py__msg__BoundedPlainSequences__get_type_hash,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rosidl_generator_py__msg__BoundedPlainSequences__are_equal
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/arrays__type_support.cpp:78:4: error: ‘rosidl_generator_py__msg__Arrays__get_type_description_sources’ was not declared in this scope; did you mean ‘rosidl_generator_py__msg__Arrays__Sequence__destroy’?
   78 |   &rosidl_generator_py__msg__Arrays__get_type_description_sources,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rosidl_generator_py__msg__Arrays__Sequence__destroy
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/arrays__type_support.cpp:79:1: error: too many initializers for ‘const rosidl_message_type_support_t’
   79 | };
      | ^
gmake[2]: *** [CMakeFiles/rosidl_generator_py_custom__rosidl_typesupport_c.dir/build.make:156: CMakeFiles/rosidl_generator_py_custom__rosidl_typesupport_c.dir/rosidl_typesupport_c/rosidl_generator_py/msg/arrays__type_support.cpp.o] Error 1
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/bounded_plain_sequences__type_support.cpp:77:4: error: ‘rosidl_generator_py__msg__BoundedPlainSequences__get_type_description’ was not declared in this scope; did you mean ‘rosidl_generator_py__msg__BoundedPlainSequences__Sequence__destroy’?
   77 |   &rosidl_generator_py__msg__BoundedPlainSequences__get_type_description,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rosidl_generator_py__msg__BoundedPlainSequences__Sequence__destroy
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/bounded_plain_sequences__type_support.cpp:78:4: error: ‘rosidl_generator_py__msg__BoundedPlainSequences__get_type_description_sources’ was not declared in this scope; did you mean ‘rosidl_generator_py__msg__BoundedPlainSequences__Sequence__destroy’?
   78 |   &rosidl_generator_py__msg__BoundedPlainSequences__get_type_description_sources,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rosidl_generator_py__msg__BoundedPlainSequences__Sequence__destroy
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/bounded_plain_sequences__type_support.cpp:79:1: error: too many initializers for ‘const rosidl_message_type_support_t’
   79 | };
      | ^
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/builtin_type_sequences_idl__type_support.cpp:76:4: error: ‘rosidl_generator_py__msg__BuiltinTypeSequencesIdl__get_type_hash’ was not declared in this scope; did you mean ‘rosidl_generator_py__msg__BuiltinTypeSequencesIdl__are_equal’?
   76 |   &rosidl_generator_py__msg__BuiltinTypeSequencesIdl__get_type_hash,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rosidl_generator_py__msg__BuiltinTypeSequencesIdl__are_equal
gmake[2]: *** [CMakeFiles/rosidl_generator_py_custom__rosidl_typesupport_c.dir/build.make:184: CMakeFiles/rosidl_generator_py_custom__rosidl_typesupport_c.dir/rosidl_typesupport_c/rosidl_generator_py/msg/bounded_plain_sequences__type_support.cpp.o] Error 1
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/builtin_type_sequences_idl__type_support.cpp:77:4: error: ‘rosidl_generator_py__msg__BuiltinTypeSequencesIdl__get_type_description’ was not declared in this scope; did you mean ‘rosidl_generator_py__msg__BuiltinTypeSequencesIdl__Sequence__destroy’?
   77 |   &rosidl_generator_py__msg__BuiltinTypeSequencesIdl__get_type_description,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rosidl_generator_py__msg__BuiltinTypeSequencesIdl__Sequence__destroy
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/builtin_type_sequences_idl__type_support.cpp:78:4: error: ‘rosidl_generator_py__msg__BuiltinTypeSequencesIdl__get_type_description_sources’ was not declared in this scope; did you mean ‘rosidl_generator_py__msg__BuiltinTypeSequencesIdl__Sequence__destroy’?
   78 |   &rosidl_generator_py__msg__BuiltinTypeSequencesIdl__get_type_description_sources,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rosidl_generator_py__msg__BuiltinTypeSequencesIdl__Sequence__destroy
/home/toto/Desktop/lola_test/build/rosidl_generator_py/rosidl_typesupport_c/rosidl_generator_py/msg/builtin_type_sequences_idl__type_support.cpp:79:1: error: too many initializers for ‘const rosidl_message_type_support_t’
   79 | };
      | ^
gmake[2]: *** [CMakeFiles/rosidl_generator_py_custom__rosidl_typesupport_c.dir/build.make:142: CMakeFiles/rosidl_generator_py_custom__rosidl_typesupport_c.dir/rosidl_typesupport_c/rosidl_generator_py/msg/builtin_type_sequences_idl__type_support.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:388: CMakeFiles/rosidl_generator_py_custom__rosidl_typesupport_c.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< rosidl_generator_py [25.2s, exited with code 2]
Aborted  <<< rosidl_generator_tests [25.9s]                                                                                                           
Aborted  <<< rosidl_typesupport_introspection_tests [40.0s]      

Does it happen to you, too?

knorth55 commented 3 months ago

@antbono Hi, I haven't tried on iron yet, so I haven't experienced that bug, sorry.

I just take a look, but it seems rosidl 3.3.1 does not have SERVICE_EVENT_MESSAGE_SUFFIX.

ImportError: cannot import name 'SERVICE_EVENT_MESSAGE_SUFFIX' from 'rosidl_parser.definition' (/home/toto/Desktop/lola_test/install/rosidl_parser/lib/python3.11/site-packages/rosidl_parser/definition.py)

can you try @rolker 's solution? https://github.com/ros-drivers/audio_common/pull/248 https://github.com/ament/ament_cmake/pull/517

knorth55 commented 3 months ago

@antbono you need this package in your workspace, too. https://github.com/ament/ament_cmake/pull/517

antbono commented 3 months ago

@knorth55 thank you for the quick reply.

I put here a vcs repos config file for @rolker 's solution

repositories:
  ament_cmake:
    type: git
    url: https://github.com/rolker/ament_cmake.git
    version: add_extend_existing_python
  audio_common:
    type: git
    url: https://github.com/rolker/audio_common.git
    version: add_extend_existing
kyle-redyeti commented 1 month ago

My configuration is a bit different I am trying to run the audio_common ros node in a Docker Container... on a RaspberryPi 5.... I am building a container with this in my Dockerfile: """ FROM ros:humble-ros-base RUN apt update && apt upgrade -y RUN apt-get update

RUN /bin/bash -c 'source /opt/ros/humble/setup.bash &&\ mkdir -p ~/ros2_ws/src &&\ cd ~/ros2_ws/src' """

building with: $ docker build -t ros2-humble-audio_common .

running it with: $ docker run -it --privileged --net=host --device /dev/snd -v /dev:/dev -v ./files/:/tmp/files/ ros2-humble-audio_common

I then went through the steps listed in above comments (I have tried to get them into the Dockerfile but was having issues so I figured fighting one fire at a time)

I modify soundplay_node.launch.xml from: arg name="device" default="" to: arg name="device" default="hw:3,0" ( I have tested and hw:3,0 works with aplay and a wav file) $ ros2 run sound_play soundplay_node.py

then in a second terminal I am going into the same docker container... $ docker exec -it /bin/bash $ ros2 run sound_play say.py 'Hello!' and I see... [INFO] [1718728024.338057534] [say8360]: Saying: Hello! [INFO] [1718728024.338573978] [say8360]: Voice: voice_kal_diphone [INFO] [1718728024.339035440] [say8360]: Volume: 1.0 but I don't hear anything?!?!?

Has anyone else figured this out??? Also I would really like to use a Seeed Studio Respeaker Mic Array V2 but that one seems to be yet another "extra challenge" so this is just a USB headset with microphone that I am testing with!

I appreciate any help you can provide!

knorth55 commented 1 month ago

@kyle-redyeti I think your issue is different from this issue. Docker can be the main cause when you want to access device. Can you first check you can play sound by alsa or pulseaudio from docker w/o audio_common? you can check available sound card by alsamixer or aplay -l you can test sound by sound-test command.

kyle-redyeti commented 1 month ago

yup I tried playing it just on the Raspberry Pi with arecord and aplay and then inside a Docker Container based on Ubuntu 22.04 and then on the ros:humble-ros-base containers.

I rebuilt it again and ran this as a test to make sure that the docker container could record and play wav files to my usb headset...

$ arecord -f S16_LE -c 2 -d 10 -r 48000 --device="hw:3,0" /tmp/test-mic.wav

$ aplay -f S16_LE -c 2 -d 10 -r 48000 --device="hw:3,0" /tmp/test-mic.wav

knorth55 commented 1 month ago
aplay -f S16_LE -c 2 -d 10 -r 48000 --device="hw:3,0" /tmp/test-mic.wav

did you change channel and depth as this is in launch? if so, I have no idea.

teapfw commented 2 weeks ago

While we wait for a proper resolution that everyone accepts, I've forked this package and attempted to incorporate a hotfix/workaround suggested by https://github.com/ament/ament_cmake/issues/514#issuecomment-2143488871.

https://github.com/teapfw/audio_common/tree/humble_hotfix

knorth55 commented 1 week ago

@teapfw Thank you. I expected that ROS2 community moves forward, and I proposed several solution, but they denied all of them and just left the issue. There may be no hope... I will think about how to resolve this issue only by ourselves. I know your solution works, but I also want to keep the package namespace like import sound_play to keep the backward compatibility. Let me think about the solution. If you have good idea, please let me know. Thank you.