@@ -130,41 +130,11 @@ class SystemInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNodeI
130130 CallbackReturn init (
131131 const HardwareInfo & hardware_info, rclcpp::Logger logger, rclcpp::Clock::SharedPtr clock)
132132 {
133- system_clock_ = clock;
134- system_logger_ = logger.get_child (" hardware_component.system." + hardware_info.name );
135- info_ = hardware_info;
136- if (info_.is_async )
137- {
138- RCLCPP_INFO_STREAM (
139- get_logger (), " Starting async handler with scheduler priority: " << info_.thread_priority );
140- async_handler_ = std::make_unique<realtime_tools::AsyncFunctionHandler<return_type>>();
141- async_handler_->init (
142- [this ](const rclcpp::Time & time, const rclcpp::Duration & period)
143- {
144- const auto read_start_time = std::chrono::steady_clock::now ();
145- const auto ret_read = read (time, period);
146- const auto read_end_time = std::chrono::steady_clock::now ();
147- read_return_info_.store (ret_read, std::memory_order_release);
148- read_execution_time_.store (
149- std::chrono::duration_cast<std::chrono::nanoseconds>(read_end_time - read_start_time),
150- std::memory_order_release);
151- if (ret_read != return_type::OK )
152- {
153- return ret_read;
154- }
155- const auto write_start_time = std::chrono::steady_clock::now ();
156- const auto ret_write = write (time, period);
157- const auto write_end_time = std::chrono::steady_clock::now ();
158- write_return_info_.store (ret_write, std::memory_order_release);
159- write_execution_time_.store (
160- std::chrono::duration_cast<std::chrono::nanoseconds>(write_end_time - write_start_time),
161- std::memory_order_release);
162- return ret_write;
163- },
164- info_.thread_priority );
165- async_handler_->start_thread ();
166- }
167- return on_init (hardware_info);
133+ hardware_interface::HardwareComponentParams params;
134+ params.hardware_info = hardware_info;
135+ params.clock = clock;
136+ params.logger = logger;
137+ return init (params);
168138 };
169139
170140 // / Initialization of the hardware interface from data parsed from the robot's URDF and also the
@@ -219,7 +189,7 @@ class SystemInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNodeI
219189 }
220190 hardware_interface::HardwareComponentInterfaceParams interface_params;
221191 interface_params.hardware_info = info_;
222- interface_params.executor = params.executor ;
192+ // interface_params.executor = params.executor;
223193 return on_init (interface_params);
224194 };
225195
@@ -231,13 +201,9 @@ class SystemInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNodeI
231201 */
232202 virtual CallbackReturn on_init (const HardwareInfo & hardware_info)
233203 {
234- info_ = hardware_info;
235- parse_state_interface_descriptions (info_.joints , joint_state_interfaces_);
236- parse_state_interface_descriptions (info_.sensors , sensor_state_interfaces_);
237- parse_state_interface_descriptions (info_.gpios , gpio_state_interfaces_);
238- parse_command_interface_descriptions (info_.joints , joint_command_interfaces_);
239- parse_command_interface_descriptions (info_.gpios , gpio_command_interfaces_);
240- return CallbackReturn::SUCCESS ;
204+ hardware_interface::HardwareComponentInterfaceParams params;
205+ params.hardware_info = hardware_info;
206+ return on_init (params);
241207 };
242208
243209 // / Initialization of the hardware interface from data parsed from the robot's URDF.
0 commit comments