Giter VIP home page Giter VIP logo

Comments (12)

ernestmc avatar ernestmc commented on August 18, 2024

I would like to start working on this issue. How can I test the code to see this failure?

from rosidl.

jacquelinekay avatar jacquelinekay commented on August 18, 2024

@wjwwood will contact you about starting this issue

from rosidl.

ernestmc avatar ernestmc commented on August 18, 2024

I've added back the line referenced in #27 and when building everything I get the following error:

Generating C++ code for ROS interfaces
Traceback (most recent call last):
  File "/home/ecorbellini/repos/osrf/ros2_ws/install/lib/rosidl_generator_c/rosidl_generator_c", line 25, in <module>
    sys.exit(main())
  File "/home/ecorbellini/repos/osrf/ros2_ws/install/lib/rosidl_generator_c/rosidl_generator_c", line 20, in main
    args.generator_arguments_file,
  File "/home/ecorbellini/repos/osrf/ros2_ws/install/lib/python3.4/site-packages/rosidl_generator_c/__init__.py", line 53, in generate_c
    minimum_timestamp=latest_target_timestamp)
  File "/home/ecorbellini/repos/osrf/ros2_ws/install/lib/python3.4/site-packages/rosidl_cmake/__init__.py", line 89, in expand_template
    interpreter.file(h)
  File "/usr/lib/python3/dist-packages/em.py", line 2326, in file
    self.safe(scanner, done, locals)
  File "/usr/lib/python3/dist-packages/em.py", line 2368, in safe
    self.parse(scanner, locals)
  File "/usr/lib/python3/dist-packages/em.py", line 2388, in parse
    token.run(self, locals)
  File "/usr/lib/python3/dist-packages/em.py", line 1403, in run
    interpreter.execute(self.code, locals)
  File "/usr/lib/python3/dist-packages/em.py", line 2565, in execute
    exec(statements, self.globals)
  File "<string>", line 7, in <module>
KeyError: 'PrimitivesBounded'
Exception ignored in: <bound method Interpreter.__del__ of <empy pseudomodule/interpreter at 0x2b4086ab6b70>>
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/em.py", line 2063, in __del__
  File "/usr/lib/python3/dist-packages/em.py", line 2126, in shutdown
  File "/usr/lib/python3/dist-packages/em.py", line 2619, in finalize
  File "/usr/lib/python3/dist-packages/em.py", line 2169, in push
AttributeError: '_io.TextIOWrapper' object has no attribute 'push'
make[2]: *** [rosidl_generator_c/rosidl_generator_cpp/msg/bounded_array_bounded.h] Error 1
make[1]: *** [CMakeFiles/rosidl_generator_cpp__c.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 66%] Built target rosidl_generator_cpp__cpp
make: *** [all] Error 2

I believe that's the error that @dirk-thomas mentioned to occur in the template. I'll keep checking from here.

from rosidl.

wjwwood avatar wjwwood commented on August 18, 2024

@ernestmc That looks like a good place to start.

A more general improvement would be to have tests which generated a wide array of message types and tested them out, similar to: https://github.com/ros2/rosidl/blob/master/rosidl_generator_cpp/test/test_interfaces.cpp

from rosidl.

ernestmc avatar ernestmc commented on August 18, 2024

Traced error to
https://github.com/ros2/rosidl/blob/master/rosidl_generator_c/resource/msg__struct.h.template#L48

    print('ROSIDL_GENERATE_STATIC_ARRAY(%s, %s, %s, %s);' %
          (c_full_name, field.name, MSG_TYPE_TO_C[field.type.type], field.type.array_size))

for a non primitive type field.type.type is the name of the message that defines it and it fails as MSG_TYPE_TO_C does not contain that key.

from rosidl.

dirk-thomas avatar dirk-thomas commented on August 18, 2024

For a non-primitive types this line never gets executed because of the condition two lines above: https://github.com/ros2/rosidl/blob/master/rosidl_generator_c/resource/msg__struct.h.template#L46

from rosidl.

ernestmc avatar ernestmc commented on August 18, 2024

@dirk-thomas I understand that condition was added to avoid this issue. I took it off for my testings.
I'm not sure if the parser is the issue or the template should be modified for this case.

from rosidl.

ernestmc avatar ernestmc commented on August 18, 2024

Implemented the following fix and now it seems to be working:
ernestmc@cf4b21a
I'll go on and implement some tests to check that the headers are generated correctly.

from rosidl.

ernestmc avatar ernestmc commented on August 18, 2024

After speaking with @wjwwood I left the [Type] parameter back in the macro and modified the template to handle separate cases for primitive and non primitive types. The appropriate type is passed in each case.
ernestmc@c650549
ernestmc@13a11ea

from rosidl.

wjwwood avatar wjwwood commented on August 18, 2024

@ernestmc Those changes seem reasonable, can you push them to a branch on the rosidl repository and open a pull request? That way we can review the changes and run CI over them.

from rosidl.

ernestmc avatar ernestmc commented on August 18, 2024

Sure, I'll prepare the PR.
I'm working on a test for the generated C headers but I think we should open a new issue for that. Do you agree?

from rosidl.

wjwwood avatar wjwwood commented on August 18, 2024

Sure, either would work. If these changes fix a problem and the tests aren't ready, go ahead and open two pr's.

from rosidl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.