Python messages pretty print and also you can check the fields and field types, so lets forward that to the C++ messages
(cpp_msg_class, py_msg_class)
| 463 | except Exception: |
| 464 | # Skip any objects that cause issues during inspection |
| 465 | continue |
| 466 | |
| 467 | print(f"Found {len(python_msgs)} Python ROS message classes: {list(python_msgs.keys())}") |
| 468 | |
| 469 | # Convert each Python message to C++ equivalent |
| 470 | for name, py_msg_class in python_msgs.items(): |
| 471 | try: |
| 472 | # Get the C++ equivalent |
| 473 | cpp_msg_type, cpp_msg_class = _resolve_message_type(py_msg_class) |
| 474 | |
| 475 | # Apply keyword argument monkey-patch |
| 476 | enable_kwargs_for_cpp_msg(cpp_msg_class) |
| 477 | |
| 478 | # Replace in globals |
| 479 | target_globals[name] = cpp_msg_class |
| 480 | print(f"Converted {name}: {py_msg_class} -> {cpp_msg_class}") |
| 481 | |
| 482 | except Exception as e: |
| 483 | print(f"Failed to convert {name}: {e}") |