@@ -58,26 +58,52 @@ CallbackReturn GenericSystem::on_init(const hardware_interface::HardwareInfo & i
5858 }
5959 };
6060
61- // check if to create fake command interface for sensor
62- auto it = info_.hardware_parameters .find (" fake_sensor_commands " );
61+ // check if to create mock command interface for sensor
62+ auto it = info_.hardware_parameters .find (" mock_sensor_commands " );
6363 if (it != info_.hardware_parameters .end ())
6464 {
65- use_fake_sensor_command_interfaces_ = hardware_interface::parse_bool (it->second );
65+ use_mock_sensor_command_interfaces_ = hardware_interface::parse_bool (it->second );
6666 }
6767 else
6868 {
69- use_fake_sensor_command_interfaces_ = false ;
69+ // check if fake_sensor_commands was set instead and issue warning.
70+ it = info_.hardware_parameters .find (" fake_sensor_commands" );
71+ if (it != info_.hardware_parameters .end ())
72+ {
73+ use_mock_sensor_command_interfaces_ = hardware_interface::parse_bool (it->second );
74+ RCUTILS_LOG_WARN_NAMED (
75+ " mock_generic_system" ,
76+ " Parameter 'fake_sensor_commands' has been deprecated from usage. Use"
77+ " 'mock_sensor_commands' instead." );
78+ }
79+ else
80+ {
81+ use_mock_sensor_command_interfaces_ = false ;
82+ }
7083 }
7184
72- // check if to create fake command interface for gpio
73- it = info_.hardware_parameters .find (" fake_gpio_commands " );
85+ // check if to create mock command interface for gpio
86+ it = info_.hardware_parameters .find (" mock_gpio_commands " );
7487 if (it != info_.hardware_parameters .end ())
7588 {
76- use_fake_gpio_command_interfaces_ = hardware_interface::parse_bool (it->second );
89+ use_mock_gpio_command_interfaces_ = hardware_interface::parse_bool (it->second );
7790 }
7891 else
7992 {
80- use_fake_gpio_command_interfaces_ = false ;
93+ // check if fake_gpio_commands was set instead and issue warning
94+ it = info_.hardware_parameters .find (" fake_gpio_commands" );
95+ if (it != info_.hardware_parameters .end ())
96+ {
97+ use_mock_gpio_command_interfaces_ = hardware_interface::parse_bool (it->second );
98+ RCUTILS_LOG_WARN_NAMED (
99+ " mock_generic_system" ,
100+ " Parameter 'fake_gpio_commands' has been deprecated from usage. Use"
101+ " 'mock_gpio_commands' instead." );
102+ }
103+ else
104+ {
105+ use_mock_gpio_command_interfaces_ = false ;
106+ }
81107 }
82108
83109 // process parameters about state following
@@ -162,14 +188,14 @@ CallbackReturn GenericSystem::on_init(const hardware_interface::HardwareInfo & i
162188 index_custom_interface_with_following_offset_ =
163189 std::distance (other_interfaces_.begin (), if_it);
164190 RCUTILS_LOG_INFO_NAMED (
165- " fake_generic_system " , " Custom interface with following offset '%s' found at index: %zu." ,
191+ " mock_generic_system " , " Custom interface with following offset '%s' found at index: %zu." ,
166192 custom_interface_with_following_offset_.c_str (),
167193 index_custom_interface_with_following_offset_);
168194 }
169195 else
170196 {
171197 RCUTILS_LOG_WARN_NAMED (
172- " fake_generic_system " ,
198+ " mock_generic_system " ,
173199 " Custom interface with following offset '%s' does not exist. Offset will not be applied" ,
174200 custom_interface_with_following_offset_.c_str ());
175201 }
@@ -188,7 +214,7 @@ CallbackReturn GenericSystem::on_init(const hardware_interface::HardwareInfo & i
188214 }
189215 }
190216 initialize_storage_vectors (
191- sensor_fake_commands_ , sensor_states_, sensor_interfaces_, info_.sensors );
217+ sensor_mock_commands_ , sensor_states_, sensor_interfaces_, info_.sensors );
192218
193219 // search for gpio interfaces
194220 for (const auto & gpio : info_.gpios )
@@ -200,10 +226,10 @@ CallbackReturn GenericSystem::on_init(const hardware_interface::HardwareInfo & i
200226 populate_non_standard_interfaces (gpio.state_interfaces , gpio_interfaces_);
201227 }
202228
203- // Fake gpio command interfaces
204- if (use_fake_gpio_command_interfaces_ )
229+ // Mock gpio command interfaces
230+ if (use_mock_gpio_command_interfaces_ )
205231 {
206- initialize_storage_vectors (gpio_fake_commands_ , gpio_states_, gpio_interfaces_, info_.gpios );
232+ initialize_storage_vectors (gpio_mock_commands_ , gpio_states_, gpio_interfaces_, info_.gpios );
207233 }
208234 // Real gpio command interfaces
209235 else
@@ -283,22 +309,22 @@ std::vector<hardware_interface::CommandInterface> GenericSystem::export_command_
283309 }
284310 }
285311
286- // Fake sensor command interfaces
287- if (use_fake_sensor_command_interfaces_ )
312+ // Mock sensor command interfaces
313+ if (use_mock_sensor_command_interfaces_ )
288314 {
289315 if (!populate_interfaces (
290- info_.sensors , sensor_interfaces_, sensor_fake_commands_ , command_interfaces, true ))
316+ info_.sensors , sensor_interfaces_, sensor_mock_commands_ , command_interfaces, true ))
291317 {
292318 throw std::runtime_error (
293319 " Interface is not found in the standard nor other list. This should never happen!" );
294320 }
295321 }
296322
297- // Fake gpio command interfaces (consider all state interfaces for command interfaces)
298- if (use_fake_gpio_command_interfaces_ )
323+ // Mock gpio command interfaces (consider all state interfaces for command interfaces)
324+ if (use_mock_gpio_command_interfaces_ )
299325 {
300326 if (!populate_interfaces (
301- info_.gpios , gpio_interfaces_, gpio_fake_commands_ , command_interfaces, true ))
327+ info_.gpios , gpio_interfaces_, gpio_mock_commands_ , command_interfaces, true ))
302328 {
303329 throw std::runtime_error (
304330 " Interface is not found in the gpio list. This should never happen!" );
@@ -375,15 +401,15 @@ return_type GenericSystem::read(const rclcpp::Time & /*time*/, const rclcpp::Dur
375401 }
376402 }
377403
378- if (use_fake_sensor_command_interfaces_ )
404+ if (use_mock_sensor_command_interfaces_ )
379405 {
380- mirror_command_to_state (sensor_states_, sensor_fake_commands_ );
406+ mirror_command_to_state (sensor_states_, sensor_mock_commands_ );
381407 }
382408
383409 // do loopback on all gpio interfaces
384- if (use_fake_gpio_command_interfaces_ )
410+ if (use_mock_gpio_command_interfaces_ )
385411 {
386- mirror_command_to_state (gpio_states_, gpio_fake_commands_ );
412+ mirror_command_to_state (gpio_states_, gpio_mock_commands_ );
387413 }
388414 else
389415 {
0 commit comments