Comments (12)
I would like to start working on this issue. How can I test the code to see this failure?
from rosidl.
@wjwwood will contact you about starting this issue
from rosidl.
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.
@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.
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.
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.
@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.
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.
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.
@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.
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.
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)
- rosidl generator cpp depreceation warning failing builds when using const values in msg definitions HOT 4
- Provide documented CMake exported namespace targets for consuming generated packages without ament_target_dependencies HOT 1
- Add non-default constructors to avoid initializing messages with dummy data HOT 7
- Different return types for resize_function in C/C++ introspection type support? HOT 2
- Inconsistent APIs between String and U16String HOT 1
- colcon build issue HOT 1
- ROSIDL - Support generating files for fastddsgen without multiple definition errors HOT 6
- Remove deprecated (and to be removed) std::allocator<void> HOT 1
- Can we have an extra field "priority" for every idl conversion with actions? HOT 1
- Binary deb message packages include many unecessary runtime dependencies HOT 2
- Colcon build fails with parsing errors in Humble but successful in Foxy HOT 3
- `char` type in Python messages is of type uint8_t not str. HOT 2
- Humble branch of rosidl does not contain the path rosidl_pycommon HOT 1
- Incompatibility with EmPy 4.0 HOT 2
- :farmer: `test_multi_nested_message_introspection` flaky test in windows repeated
- rosidl_adapter HOT 3
- Add [[nodiscard]] attribute to C++ headers that return values, such as operators [Jazzy] HOT 1
- Support min/max attribute on primitive types HOT 2
- :farmer: `rosidl_generator_cpp.cpplint_rosidl_generated_cpp` test timeout after parallel executor HOT 1
- BoundedVector::data() is unusable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rosidl.