66 Commits

Author SHA1 Message Date
han J
bb37faab17
add ros_plugin native start shell (#104)
Co-authored-by: hanjun <hanjun@agibot.com>
2024-11-15 15:27:31 +08:00
zhangyi1357
e9d5fe05ed
fix: handle timer exceptions in grpc and http rpc backends (#102)
Improve error handling for async wait operations in both RPC backends by catching system errors, ensuring robustness against unexpected cancellations. This change addresses potential crashes and enhances stability during RPC service registration.
2024-11-15 14:51:12 +08:00
wtudio
eaa7c97557
feat: executor sys clock (#101)
* feat: executor sys clock
2024-11-14 15:32:50 +08:00
han J
d4eefad587
minor modification to benchmark (#100)
Co-authored-by: hanjun <hanjun@agibot.com>
2024-11-14 14:31:41 +08:00
han J
b9d861c327
fix: optimize reconnection steps. (#93)
* Optimize reconnection steps.

* Using condition variables to establish a connection with the broker.

* use aimrt's light_signal

* add condition variable  for channel and rpc

* Change the notify timing to the start phase

* Remove redundancy

* Modify the timing of the sleep call

---------

Co-authored-by: hanjun <hanjun@agibot.com>
2024-11-13 19:33:12 +08:00
zhangyi1357
7534ac360a
build: add external proto path for source directory (#99)
Configure the build system to include the source directory in the proto path for all relevant targets, ensuring improved resolution of proto files during code generation.
2024-11-13 13:48:48 +08:00
zhangyi1357
bb68f77f67
build: enhance build options for modular components (#97)
* build: enhance build options for modular components

Add dependent options for building various plugins and components, allowing finer control over runtime and external library usage. This change improves flexibility and ensures that components are only built when their dependencies are active, optimizing the build process.

* build: update grpc plugin dependency condition

Remove protobuf dependency requirement for the grpc plugin, simplifying its build configuration. This improves flexibility by allowing the grpc plugin to be built independently of the protobuf option.

---------

Co-authored-by: zhangyi <zhangyi@agibot.com>
2024-11-13 13:48:28 +08:00
ATT_POWER
94af04fcb7
fix: add recordplayback example shell (#94) 2024-11-12 16:35:31 +08:00
wtudio
dac046b3fe
fix: runtime/core/util (#91) 2024-11-08 17:01:04 +08:00
han J
5b01f4e9e1
feat: Asynchronous connection to mqtt broker (#85)
* feat: Asynchronous connection to mqtt  broker

* add new option: client_key_password

* add example for mqtt plugin with ssl/tls

* add new info at release notes

* Make minor formatting adjustments.

* Improve  mqtt_plugin's README documentation

---------

Co-authored-by: hanjun <hanjun@agibot.com>
2024-11-08 16:13:10 +08:00
ATT_POWER
e01333313f
feat(rosbag_trans): add support to convert multiple aimrt bags into a single ROS bag (#90)
* feat: add functionality to convert multiple aimrt bags into a single ROS bag

* refactor(rosbag_trans): add DatabaseManager class to unify database operations

* fix: format the code

* fix: format code

* feat(bagtrans_tool): Update Command Line Tool Documentation
2024-11-08 15:53:21 +08:00
zhangyi1357
29eb541fd6
fix: add error handling for local protoc compiler detection (#89)
* build: add error handling for local protoc compiler detection

Ensure that the local `protoc` compiler is found when `AIMRT_USE_LOCAL_PROTOC_COMPILER` is enabled. This improves setup reliability by providing clear feedback if `protoc` is missing, helping users avoid runtime issues.

* build: include YamlCpp for enhanced configuration support

Add support for YamlCpp to improve configuration handling alongside ROS2 dependencies.

* chore: remove redundant gflag setting

Clean up the CMake configuration by removing the unnecessary gflag setting for testing, streamlining the build process.
2024-11-08 09:46:05 +08:00
zhangyi1357
0a63cb9fe1
build: refactor CMake scripts to use functions for variable scope (#87)
* build: refactor CMake scripts to use functions for variable scope

Wrap multiple CMake scripts in functions to restrict variable scope and prevent unintended resets. This ensures better modularity and maintainability in the build process while adhering to modern CMake best practices.

* refactor: simplify opentelemetry fetch logic

Streamline the handling of OpenTelemetry dependencies by removing unnecessary function wrappers and directly implementing the fetching logic. This improves readability and maintainability while ensuring that relevant variables are correctly set within the proper scope.

* refactor: encapsulate OpenTelemetry configuration in a function

Wrap the OpenTelemetry setup in a function to limit variable scope, improving code organization and maintainability.
2024-11-07 21:17:34 +08:00
zhangyi1357
8b6283e684
docs: update release notes for v0.8.2 and v0.8.3 (#86)
Add entries for the latest versions to keep documentation current and informative for users.
2024-11-07 11:10:18 +08:00
wtudio
3771a907b6
feat: improve modulebase (#84) 2024-11-06 19:51:31 +08:00
ATT_POWER
7b56221af4
docs: add echo_plugin to example plugin list (#83)
Co-authored-by: yuguanlin <yuguanlin@agibot.com>
2024-11-06 09:30:43 +08:00
zhangyi1357
9c53b663a8
feat: add timer support based on executor's ExecuteAt (#73)
* feat: add timer module integration

Integrate the new timer module into the executor package, enhancing functionality and providing more precise timing capabilities within the system.

* feat: add timer class for periodic task scheduling

Implement a Timer class that enables users to schedule recurring tasks with configurable periods. This enhances the executor functionality by allowing more precise timing control and task management within the AimRT framework.

* refactor: replace WallTimer with aimrt::executor::Timer and enhance logging

Streamline the timer module by removing the custom WallTimer implementation in favor of the built-in aimrt::executor::Timer. Improve logging to track execution intervals, providing clearer insights into task execution frequency.

* feat: enhance timer functionality and behavior

Introduce a shortened sleep duration for task execution and add cancellation capability for timers, improving responsiveness and efficiency in managing timer events.

* feat: enhance timer functionality with flexible period handling

Refine the timer by allowing a customizable reset period, improving task scheduling accuracy, and ensuring that callbacks execute only when appropriate. This update addresses potential timing issues when the timer is reset, enhancing overall reliability in task execution.

* feat: improve timer module functionality and simplify timer creation

Enhance the timer module by updating the logging to microseconds, refactoring timer creation for improved clarity, and adjusting timing intervals for better performance and maintainability.

* feat: add utility for comparing function argument types

Introduce a new utility to compare argument types of functions, enhancing type safety and flexibility in the Timer implementation. Update Timer module to integrate this utility for improved argument type checks. Additionally, adjust timer intervals for more appropriate timing behavior.

* test: add comprehensive tests for SameArguments trait functionality

Introduce a series of tests to validate the behavior of the SameArguments trait across various function types, member functions, function objects, lambda functions, and complex argument types. This ensures compatibility and correctness in argument matching, enhancing type safety and reliability in code usage.

* style: format function definitions for clarity

Improve the readability of the TimerBase class by formatting function definitions to align with standard coding style.

Expand timer functionality to support const reference callbacks, enhancing flexibility in task management.

* style: ensure newline at end of file and tidy up CMakeLists.txt

Update formatting for consistency and readability by adding a newline at the end of the file and improving the organization of the CMakeLists.txt.

* chore: update include paths for consistency

Refactor the include statement for the same_arg_trait to follow the new directory structure, promoting better organization and maintainability.

* fix: clarify comment on task execution timing

Ensure that the executor guarantees all tasks are executed after their planned time to handle timer resets more effectively.

* refactor: simplify cancellation check in timer execution

Improve code clarity by replacing direct access of a member variable with a method call for cancellation checks. This enhances maintainability and encapsulates the cancellation logic.

* refactor: enhance timer interface to support configurable period

Revise the TimerBase and Timer classes to allow starting and resetting with a specific duration. This improves flexibility, prevents duplicate callbacks on resets, and ensures more accurate callback scheduling.

* feat: improve timer functionality and logging

Enhance the timer with more precise intervals and additional logging for better tracking of execution and reset events. Adjust execution periods for improved timing accuracy and introduce dynamic start behavior for better flow control.

* refactor: adjust timer periods for improved performance

Update timer initialization and execution intervals to enhance timing accuracy and operational efficiency.

* refactor: rename callback method for clarity

Update the timer interface to use "ExecuteTask" instead of "ExecuteCallback" for improved readability and accuracy in describing the method's purpose. Ensure that task cancellation is properly handled when auto-start is disabled.

* docs: enhance timer documentation and add usage examples

Clarify the timer interface and its functionality, including creation, scheduling, and task execution. Provide practical usage examples to improve understanding and facilitate integration into projects.

* chore: update copyright information to reflect current year and new authors

Ensure compliance with licensing requirements by revising the copyright and license details in the CMake configuration.

* fix: address potential duplicate callback executions on timer reset

Remove commented FIXME notes regarding edge case of duplicate callbacks when the timer is reset to the same time point.

* fix: adjust timer intervals for improved timing accuracy

Reduce timer intervals from seconds to milliseconds to enhance responsiveness of the timer functionality. Implement a sleep in the shutdown process to ensure all timer executor tasks complete properly before shutdown.

* refactor: simplify timer restart logic

Consolidate timer actions by removing redundant cancellation and restart statements. Adjust logging to reflect the accurate restart timing, enhancing clarity and reducing unnecessary latency.

* fix: add cancellation check in timer execution loop

Ensure that the timer's execution loop properly checks for cancellation, optimizing performance and preventing unnecessary operations when the timer is no longer needed.

* refactor: update time point calculations for accuracy

Improve the handling of time point arithmetic in the Timer class to ensure precision during execution and scheduling. This revision clarifies the time calculations, preventing potential errors in scheduling tasks.

* feat: add synchronization support to Timer class

Implement SyncWait method to allow for synchronous waiting on timer tasks, enhancing task execution control and reliability.

* refactor: streamline timer execution logging

Improve timer execution logging by incrementing the execution count directly within the log statement. Ensure the timer synchronously waits during shutdown to enhance reliability.

* feat: add SyncWait method to TimerBase for safer resource cleanup

Improve timer behavior by introducing SyncWait to ensure resources are correctly released after cancellation before the next execution point. Update timer intervals for enhanced responsiveness and logging clarity.

* feat: add timer based on executor for scheduled tasks

Introduce a new feature to facilitate scheduled task execution with an executor-based timer, enhancing the flexibility and usability of the task management capabilities.

* refactor: streamline timer initialization and assertion handling

Remove inline assertions from the TimerBase constructor and relocate assertions to the CreateTimer function, enhancing clarity and maintaining execution flow. This simplifies timer initialization while ensuring that critical checks occur before timer creation.

* refactor: simplify timer task management and logging

Improve timer initialization and task execution by streamlining start and reset processes. Enhance logging clarity by aligning messages with timepoints and ensuring the timer cancels correctly after reaching execution limits.

* docs: simplify TimerBase interface documentation

Clarify method descriptions and refine behavior explanation to enhance understanding of TimerBase functionality, particularly around the Reset and Start methods.

* refactor: optimize task forwarding in Timer constructor

Improve task handling by using std::forward to perfect-forward the task parameter, ensuring efficient movement semantics and reducing potential overhead.

---------

Co-authored-by: zhangyi <zhangyi@agibot.com>
v0.9.0-rc1
2024-11-05 17:49:24 +08:00
zfei
5b7d76d788
fix: repair kLvlNameArray oversize (#82)
* fix: repair kLvlNameArraySize overflow

* format last code
2024-11-05 15:08:20 +08:00
zhangyi1357
ac7715e424
feat: add json and ros2 serialization support for grpc plugin (#81)
* feat: enhance gRPC content-type handling and serialization support

Improve content-type validation in gRPC request headers to support additional types, allowing for JSON serialization. Update the serialization logic to dynamically set the type based on incoming headers, ensuring better compatibility and error handling.

* feat: support ros2 service function names

Enhance service function registration to accept names starting with 'ros2:' in addition to 'pb:'. Update URL path handling and content type mappings accordingly to ensure compatibility with ROS 2 services, improving integration capabilities.

* feat: add gRPC plugin configuration and startup scripts

Introduce configuration files for the gRPC client and server plugins, allowing for easier setup and management of RPC communication. Add shell scripts to launch the client and server with the specified configurations, streamlining the development process.

* refactor: improve service function name validation and error handling

Enhance the clarity of service function name registration by separating the function name variable for improved readability. Update error messages for better guidance on valid prefixes and standardize maps for content types and serialization types. This increases maintainability and reduces the risk of errors during registration.

* refactor: streamline client option lookup and improve code clarity

Simplify the client option lookup by replacing `std::find_if` with `std::ranges::find_if`. Also, enhance readability by cleaning up comment formatting and unnecessary whitespace.

* chore: update copyright information in configuration files

Revise copyright year and licensing details to reflect the current ownership and license for the AimRT project.

* refactor: improve validation logic in options

Enhance option verification by using standard algorithms for consistency and readability. This ensures minimum thresholds for connection numbers and timer durations are respected, improving robustness in client and server configurations.

* docs: update release notes and plugin documentation

Add support for grpc plugin serialization with ros2 messages and json format, enhancing flexibility in data handling. Remove outdated protobuf-only restriction to improve compatibility and user experience.

* docs: add ros2 rpc example details and usage instructions

Expand the README to include a new section on using the grpc plugin with a ros2-based RPC interface. Provide explicit instructions on configuration, core code references, and running the server and client. Enhance the documentation to clarify the differences from the protobuf RPC example.

---------

Co-authored-by: zhangyi <zhangyi@agibot.com>
2024-11-05 11:44:25 +08:00
wtudio
7ba8f93fdf
fix: update logger (#80) 2024-11-04 18:54:47 +08:00
ATT_POWER
076f76394e
refactor(echo_plugin): Remove executor configuration and simplify echo logic (#78)
* refactor(echo_plugin): Remove executor configuration and simplify echo logic

- Removed executor field from echo_plugin configuration
- Simplified echo message handling process by processing directly in main thread
- Updated example configurations and descriptions in documentation

* refactor(echo_plugin): Refactor EchoPlugin class

- Remove get_type_support_func_ member variable, replace with direct GetTypeSupport method call in RegisterEchoChannel
- Merge EchoFunc creation and subscription callback logic to reduce intermediate variables

* refactor(echo_plugin): Remove GetTypeSupport function, directly access type_support_map where needed

* refactor(echo_plugin): Remove unused headers and member functions

* refactor(echo_plugin): Remove unnecessary 'this' capture in lambda expression

* refactor(echo_plugin): optimize buffer handling logic in EchoPlugin

* format

* fix(echo_plugin):  add release_callback func before return in sub_wrapper.callback

---------

Co-authored-by: yuguanlin <yuguanlin@agibot.com>
2024-11-04 17:18:00 +08:00
ATT_POWER
fe409b822b
example: add recordplayback example and remove unnecessary codes in echo plugin (#72)
* example: add recordplayback example about ros msg

- Optimize configuration files and script naming
- Modify EchoPlugin, remove unnecessary checks

* fix: remove unused code and unnecessary dependencies

---------

Co-authored-by: yuguanlin <yuguanlin@agibot.com>
2024-11-01 17:35:07 +08:00
ATT_POWER
b2fd9cb78b
refactor(tools): Restructure bagtrans tool and integrate into aimrt_cli (#68)
* CI: change build worlflow image tag from v20240927 to latest

* refactor(tools): Restructure bagtrans tool and integrate into aimrt_cli

- Integrate bagtrans functionality into aimrt_cli
- Update CMakeLists.txt and documentation to reflect these changes

* choro: format the code

* choro: change the document

* choro: remove the bagtrans options

---------

Co-authored-by: yuguanlin <yuguanlin@agibot.com>
2024-10-31 21:46:25 +08:00
wtudio
acf57080c2
feat: update log examples & doc (#69) 2024-10-31 21:26:55 +08:00
ATT_POWER
7e4b5460c2
feat: add a new plugin: echo (#51)
* CI: change build worlflow image tag from v20240927 to latest

* feat/plugins: Add echo plugin

- Add echo plugin for message pass-through and logging
- Implement loading and management of different types of support packages
- Add support for multi-threaded executors
- Optimize log initialization and management logic
- Add support for YAML configuration files

* build: Update build scripts and enable Echo plugin

- Add build options for Echo plugin in build.bat, build.sh, test.bat, and test.sh scripts
- Optimize JSON serialization error handling and log output in echo_plugin.cc

* chore: Add Echo plugin related documentation

- Update release notes with Echo plugin feature description
- Add Echo plugin usage documentation
- Add Echo plugin example configuration and running instructions

* chore: format the code
- Add thread safety checks for Echo executor
- Optimize code structure to improve readability and maintainability

* choro: restructure JSON parsing logic

- Replace json-c with jsoncpp library
- Rewrite json_to_yaml function to improve code readability and robustness

* choro: adapt CMakeLists for Windows compatibility

* choro : turn off the echo plugin in windows

* feat(echo_plugin): Support YAML format message echo

- Modify GetYamlCpp.cmake to enable yaml-cpp installation
- Add yaml_convert.h and yaml_convert_test.cc in ros2_util
- Update echo_plugin to support YAML format message serialization and deserialization
- Add YAML serialization type support in aimrt_module_ros2_interface

* choro: Fix documentation

* choro : fix format and delete the extra support for echo about pb message type

* choro : format

* choro: add ros2 example for echo plugin and delete useless code

* choro: rename the echo example shell

* choro: fix some mistake

* chore: refactor type support package loader and migrate to core module

- Migrate TypeSupportPkgLoader from echo_plugin and record_playback_plugin to core/util directory
- Optimize log output, replace printf with AIMRT_INFO

* choro: replace the aimrt::common::util::AimRTException() to AIMRT_ASSERT

---------

Co-authored-by: yuguanlin <yuguanlin@agibot.com>
2024-10-31 20:03:42 +08:00
han J
929a105bd0
log format (#57)
* log format

* Modify the logic of log formatting output

* Remove redundant parts.

* log format:

-Improve the log configuration documentation

-More flexible log formatting output structure

* log fotmat

- Use std::string instead of fmt to achieve formatted output,;

- add unit test

- add exception checking.

* Add estimated_size  & optimize unit tests

---------

Co-authored-by: hanjun <hanjun@agibot.com>
2024-10-31 19:39:35 +08:00
wtudio
a1fda52c37
fix: misc adjustments (#66)
* fix: misc

* doc: update misc
2024-10-31 17:57:47 +08:00
zhangyi1357
56ca4d438e
docs: update rpc documentation to clarify package name requirement (#65)
Remove outdated note about file generation failure due to missing package name in proto files to enhance clarity and usability for developers.

Co-authored-by: zhangyi <zhangyi@agibot.com>
2024-10-31 11:22:46 +08:00
ATT_POWER
6b74dbe7af
CI: add document ignore and quick-ci mode (#63)
* CI: change build worlflow image tag from v20240927 to latest

* ci: Optimize GitHub Actions workflow triggers and test execution

- Ignore changes in the .github and document directories to avoid unnecessary workflow triggers
- Add 'quick-ci' label to control test execution and improve CI efficiency

* choro: add quick ci mode

---------

Co-authored-by: yuguanlin <yuguanlin@agibot.com>
2024-10-30 22:06:39 +08:00
zhangyi1357
4181a74eba
refactor: streamline message type naming (#62)
Enhance the generation of message type names by ensuring proper handling of package and message components, eliminating excess separators for cleaner output.
2024-10-30 22:05:45 +08:00
ChuheZhang
018646d6bf
Refactor coroutine request handling and ensure unique client keys (#61)
* Refactor coroutine request handling and ensure unique client keys

* Refactor client_key to use ClientKey struct with custom hash to ensure uniqueness and support IPv6
2024-10-30 22:04:50 +08:00
zhangyi1357
69b83817cd
feat: add frequency information to benchmark report (#60)
Include frequency details in the benchmark report when using fixed frequency mode to enhance clarity and analysis of performance metrics.
2024-10-29 14:29:51 +08:00
zhangyi1357
5051051b00
chore: update author email for Zhang Yi (#59)
Change the email address of Zhang Yi to reflect current contact information.
2024-10-29 10:52:42 +08:00
zhangyi1357
328a99512b
docs: add aimrt_py rpc context (#58)
* docs: clarify context type enumeration description

Enhance the explanation of the `aimrt_channel_context_type_t` enumeration to clearly indicate its role in defining publisher and subscriber contexts. This improves understanding for users implementing the interface.

* feat: enhance RpcContext with additional features

Add new methods for managing context metadata, timeout settings, and target addresses. Improve logging to provide better visibility into RPC calls and responses, aiding in debugging and performance monitoring.

* feat: enhance RPC context logging with metadata

Add the ability to log metadata in RPC calls, improving traceability and debugging. Update the client to set a metadata value and enhance server logging to print out all metadata associated with requests.

* feat: add RPC context types to Python bindings

Introduce enum values for client and server RPC context types in Python bindings to enhance type support and improve clarity in interactions with RPC features.
2024-10-28 21:10:22 +08:00
zhangyi1357
0b2427dc75
docs: add aimrt_py channel context (#56)
* feat: set default serialization type for context reference

Ensure that the serialization type defaults to "pb" when it is not explicitly set in the context reference. This improves compatibility and prevents potential errors related to serialization handling.

* docs: enhance message publishing and context usage documentation

Clarify the usage of the `Publish` function by adding context and serialization options. Introduce `Context` and `ContextRef` details for improved understanding. Adjust subscriber callback signatures and remove deprecated notes for a cleaner documentation experience.

* feat: enhance event publishing with context and serialization options

Add support for publishing events with various configurations, including without context, with JSON serialization, and with context references. Improve logging for better debugging and clarity in event handling.

* feat: add enumeration for channel context types

Introduce enumeration for `aimrt_channel_context_type_t` to better categorize channel contexts, improving readability and usability in Python bindings.

* docs: clarify context type description

Enhance documentation by simplifying the explanation of the context type and explicitly defining the associated enumeration values for better understanding.
2024-10-28 20:27:00 +08:00
zhangyi1357
66829ca820
fix: standardize timestamp handling with time.time_ns() (#55)
* refactor: standardize timestamp handling with time.time_ns()

Update timestamp handling in both publishing and subscribing modules to use time.time_ns() instead of time.perf_counter_ns(). This change improves consistency in timestamp precision and ensures uniformity across the system's message timing functionalities.

* perf: improve timing measurements with nanosecond precision

Enhance performance tracking by switching from `time.time()` to `time.perf_counter_ns()`, providing more accurate duration calculations.
2024-10-28 15:50:00 +08:00
zhangyi1357
430f4f61b2
fix: aimrt_py channel benchmark for large data packets (#54)
* fix: ensure subscriber receives all messages before ending

Add a short sleep to guarantee the subscriber has enough time to process all published messages before signaling completion. This prevents potential missed messages during the benchmarking process.

* perf: optimize timestamp retrieval for benchmarking

Use high-resolution `perf_counter_ns` instead of `time.time` for better accuracy in message timestamps across publisher, subscriber, and RPC client modules.
2024-10-25 18:56:08 +08:00
zhangyi1357
3594abc28e
refactor: remove shutdown peer logic from publisher and subscriber (#52)
* refactor: remove shutdown peer logic from publisher and subscriber

Streamline benchmarking process by eliminating shutdown peer signal handling, simplifying the code and improving clarity.

* docs: clarify benchmark termination process

Update the README to specify that benchmark results will be output in the subscriber terminal and that the process can be terminated in both terminals using `Ctrl+C`. This improves user guidance for smoother execution.
2024-10-25 11:52:55 +08:00
ATT_POWER
42ba5be784
fix: bagtrans options bugs (#49)
* CI: change build worlflow image tag from v20240927 to latest

* fix:  fix bagtrans tool support

- Add AIMRT_BUILD_BAGTRANS option in CMakeLists.txt
- Update build.bat, build.sh, test.bat and test.sh scripts to include bagtrans build option
- Modify CMakeLists.txt in bagtrans directory to simplify build logic
- Remove autopep8 dependency from bagtrans/requirements.txt

* format : format the code

* fix: Turn off the bagtrans compilation option on Windows

* feat(tools): Update bagtrans tool build method

- Change the build method of bagtrans tool from PyInstaller to using the build module to generate wheel files
- Update CMakeLists.txt and setup.py files to adapt to the new build method
- Update release notes, adding new information about the bagtrans tool

* fix: format

---------

Co-authored-by: yuguanlin <yuguanlin@agibot.com>
2024-10-24 21:14:13 +08:00
han J
25c8b2e5bb
Ros2 plugin custom naming (#46)
* add remapping function for ros2 plugin

* Optimize the logical structure of remapping.

* Optimize the remapping's  logic

* Simplify details

* - update the ROS2 plugin documentation to correct the description of the remapping rules and optimize examples;

- enhance the Ros2RpcBackend class by adding exception handling logic to the GetRemappedFuncName method;

- add a function initialization report feature;

- write unit test cases for GetRemappedFuncName covering various scenarios.

* Update the table format in the documentation, correcting the regular expression capturing groups for function names

* Decrease Redundancy

* simplify the function : GetRealRosFuncName

* Optimized the way of obtaining the message type, reducing unnecessary string constructions.

---------

Co-authored-by: hanjun <hanjun@agibot.com>
2024-10-24 19:31:41 +08:00
zhangyi1357
cb01a34047
feat: enhance aimrt_py rpc context handling and method overloads (#48)
* feat: add new methods to RpcContext and RpcContextRef

Enhance functionality by introducing CheckUsed, SetUsed, Reset, GetFunctionName, and SetFunctionName methods for better state management and function identification.

* feat: add RPC service details to ServiceBase class

Enhance the ServiceBase class by adding methods to retrieve RPC type and service name, along with the ability to set the service name. This improves accessibility and flexibility for RPC configurations.

* feat: simplify service function type definition

Introduce type aliases for service function return and parameter types to enhance code readability and maintainability. This change reduces redundancy and clarifies the expected function signatures, streamlining future development.

* feat: enhance RPC framework with proxy support

Add support for `ProxyBase` in the RPC framework, enabling more flexible service management and context handling in Python. Update the `RpcContext` definition to use shared pointers for better memory management.

* feat: enhance rpc context handling and method overloads

Improve the handling of RPC context by adding overloads for method arguments, ensuring type safety and clarity in usage. This change simplifies the implementation of service proxies and makes it easier to work with different context types.

* feat: enhance context handling in RPC proxy

Add default context reference to the `NewContextSharedPtr` method, simplifying context management in RPC calls for improved usability.
2024-10-24 15:49:40 +08:00
zhangyi1357
e2e77060af
feat: enhance aimrt_py channel with ctx functionality (#44)
* chore: reorganize imports for consistency

Refactor the import statements across multiple modules to improve readability and maintain consistency. Ensure all relevant libraries are imported in a coherent manner.

* feat: add GetTopic method to PublisherRef and SubscriberRef

Expose the GetTopic method for both PublisherRef and SubscriberRef to improve topic management and enhance usability within the Python interface.

* feat: add context handling in publishing

Introduce new context management methods for publishing messages with context support. Enhance the Python bindings to allow for better integration with context references, improving the flexibility and usability of the publisher functionality.

* feat: enhance subscription with context support

Add a new subscription method that includes context handling for better message processing. This improves the flexibility of message serialization formats and error handling during callback execution.

* refactor: clean up publish and subscribe methods

Improve code readability by removing unnecessary blank lines and ensuring consistent formatting in the publish and subscribe functions.

* style: update ASCII art formatting in example runner

Improve visual consistency of the ASCII banner in the output, enhancing readability.

* chore: improve type annotations for publisher and subscriber functions

Enhance the type hints in the RegisterPublishType, Publish, and Subscribe functions to improve code clarity and maintainability. This facilitates better integration with type-checking tools and helps prevent potential runtime errors.

* feat: support multiple serialization types in publisher

Enhance the publishing functionality to handle both protobuf and JSON serialization types. This improves flexibility and allows for broader compatibility with different data formats. Add error handling for invalid serialization types to ensure robustness.

* fix: correct serialization type prefix

Update the serialization type from "pb" to "json" when publishing JSON messages, ensuring accurate format differentiation for better clarity and preventing potential processing errors.

* refactor: streamline serialization handling in PublishWithCtx

Improve message serialization by consolidating logic and enhancing readability. Ensure error handling for unsupported types remains clear.

* feat: add Context support for aimrt_py channel functionality

Enhance channel functionality in aimrt_py by providing Context support, improving usability and enabling better resource management during operations.

* refactor: streamline serialization type handling

Improve clarity by formatting the serialization type in the publish method. This enhances readability and ensures consistent output in message formatting.

* refactor: rename publish function and improve argument handling

Enhance the Publish function to accept different argument configurations and simplify the serialization process, ensuring clearer logic and improved usability.

* feat: enhance publishing with customizable serialization

Allow publishers to specify serialization type (protobuf or JSON) when publishing messages. Update method signatures to improve clarity and error handling for serialization type validation.

* feat: enhance Publish function documentation

Clarify usage and expectations for the Publish function, including argument types and potential exceptions. This improves maintainability and usability for future developers.

* refactor: simplify protobuf serialization handling

Streamline the protobuf message serialization and deserialization processes by separating concerns into dedicated functions. Improve callback handling for subscriber methods to enhance code readability and maintainability.

* refactor: streamline serialization and deserialization methods

Simplify the process of message serialization and deserialization by consolidating functions and improving code clarity. This enhances maintainability and reduces redundancy in handling protobuf messages.

* refactor: remove unused subscription method

Eliminate the `PySubscribeWithSerializationType` function to streamline the code and improve maintainability, as it is not being used in the current implementation.

* refactor: streamline callback parameter handling

Simplify the validation and handling of callback parameters in the subscription process. Ensure the callback adheres to a clear signature expectation, enhancing code maintainability and reducing potential errors.

* chore: streamline imports for clarity

Optimize import statements by specifying only required components, improving readability and maintainability.

* feat: enhance protobuf registration and subscription documentation

Improve docstrings for registering and subscribing to protobuf message types, clarifying parameter details and callback expectations to aid developer understanding and usage.
2024-10-22 20:09:15 +08:00
zhangyi1357
7811ecc7cc
build: enable position-independent code (#43)
Set CMAKE_POSITION_INDEPENDENT_CODE to ON to ensure compatibility with shared libraries and enhance portability across different architectures. Removed explicit compiler flags for PIC that were previously set.
2024-10-21 21:58:36 +08:00
han J
f22a869be3
Run all aimrt example (#42)
* run all examples of aimrt and generate the report

* Handle the runtime environment and dependencies.

* Format Check

---------

Co-authored-by: hanjun <hanjun@agibot.com>
2024-10-21 15:20:21 +08:00
ATT_POWER
9d148527a4
feat: add 'trans' command to aimrt_cli for converting aimrtbag to rosbag (#39)
* feat: support translate aimrtbag to rosbag

* feat: 添加数据包转换工具

* CI: change build worlflow image tag from v20240927 to latest

* feat: now support transfer aimrtbag to rosbag

* feat: Adjust the build and installation process of aimrt_cli , copy ROS2 plugin proto files when building aimrt_cli

* chore: format the code style

* chore: format code

* feat: Differentiate between aimrt-cli and transbag, make transbag an independent tool; add documentation for transbag

* chore: Update CI trigger from label "ci ready" to "ci"

* chore: format code

* choro: feat:  compile bagtrans module only when bagrecord and ros2 plugin are enabled; improve documentation

* choro: Modify activation method for bagtrans

---------

Co-authored-by: yuguanlin <yuguanlin@agibot.com>
2024-10-18 20:19:00 +08:00
zhangyi1357
e2c70c2c07
docs: add package specification and generation note for proto files (#40)
Clarify the requirement for specifying a package name in proto files to ensure successful RPC code generation in Python.
2024-10-18 19:04:09 +08:00
han J
d1ea3b4e13
run all examples of aimrt and generate the report (#34)
* run all examples of aimrt and generate the report

* add example items  of cpp and python

* add release_notes

* Modify copyright statement

---------

Co-authored-by: hanjun <hanjun@agibot.com>
2024-10-18 16:41:25 +08:00
zhangyi1357
1186d81a07
feat: add aimrt_py rpc benchmark example (#37)
* feat: add python benchmark example and update dependencies

Introduce an aimrt_py benchmark example for Python testing. Replace boost dependency with the standalone asio library to reduce overall dependencies and enhance configuration options for zenoh and mqtt.

* feat: add RPC benchmark client and configuration

Introduce a new benchmark client module and accompanying scripts to facilitate testing and performance measurement of RPC services. Include configuration for parallel execution and adjustable benchmarking parameters.

* docs: add benchmark process for protobuf RPC

Include detailed instructions for reproducing the crash issue and running benchmarks effectively to streamline troubleshooting and performance evaluation.

* chore: include string header

Add the string header to enable potential future string manipulations within the RPC handling code. This sets the stage for improved functionality and cleaner code integration down the line.

* feat: enhance benchmark reporting and logging

Improve performance benchmarking by logging detailed results, including latency metrics and error rates. Ensure more precise measurements by using microseconds for task duration and substituting print statements with structured logging.

* chore: update benchmark configurations for clarity and accuracy

Refine the benchmark plans to provide clearer settings. Adjust parameters for the fixed-frequency mode to ensure more relevant testing scenarios.

* chore: add script and config files for HTTP server examples

Include new symbolic links for server configuration and application scripts to streamline example setup and ensure consistency across projects.

* docs: update README for better clarity on python RPC benchmark setup

Enhance the README to provide a clearer guide on using the protobuf RPC benchmark example, including setup instructions, core files, and configuration details. This improves user experience and facilitates easier implementation for developers.

* style: correct casing in module name

Standardize the module name casing for improved consistency and readability in the RPC server application.

* docs: add pb_rpc_bench example link

Include the link to the pb_rpc_bench example for better accessibility and completeness in the tutorial.

* style: clean up code formatting

Remove unnecessary blank lines to improve readability in the benchmark RPC client module.

* docs: modify aimrt_py rpc release note
2024-10-18 16:33:58 +08:00
zhangyi1357
5ca412c339
fix: add GIL for pybind11::bytes object accessing (#35)
* fix: add GIL for pybind11::bytes object accessing

Protect the access to the pybind11::bytes object with a GIL lock to avoid potential memory errors, and unify the handling of empty and non-empty strings. Eliminate unused functions for empty byte objects in the export channel and export RPC modules to enhance code clarity.

* docs: resolve occasional server crash during multi-threaded RPC calls

Address a rare issue causing server crashes in aimrt_py under multi-threaded RPC operations, enhancing stability and reliability.
2024-10-17 18:52:28 +08:00
wtudio
fabac84bb0
feat: Allow custom RPC names for some plugins (#33)
* Allow custom RPC names for some plugins
2024-10-17 16:39:35 +08:00