ros2_control - foxy
Loading...
Searching...
No Matches
ign_system.hpp
1// Copyright 2021 Open Source Robotics Foundation, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15
16#ifndef IGN_ROS2_CONTROL__IGN_SYSTEM_HPP_
17#define IGN_ROS2_CONTROL__IGN_SYSTEM_HPP_
18
19#include <map>
20#include <memory>
21#include <string>
22#include <vector>
23
24#include "ign_ros2_control/ign_system_interface.hpp"
25
26namespace ign_ros2_control
27{
28// Forward declaration
29class IgnitionSystemPrivate;
30
31// These class must inherit `ign_ros2_control::IgnitionSystemInterface` which implements a
32// simulated `ros2_control` `hardware_interface::SystemInterface`.
33
35{
36public:
37 // Documentation Inherited
38 hardware_interface::return_type configure(const hardware_interface::HardwareInfo & system_info)
39 override;
40
41 // Documentation Inherited
42 std::vector<hardware_interface::StateInterface> export_state_interfaces() override;
43
44 // Documentation Inherited
45 std::vector<hardware_interface::CommandInterface> export_command_interfaces() override;
46
47 // Documentation Inherited
48 hardware_interface::return_type start() override;
49
50 // Documentation Inherited
51 hardware_interface::return_type stop() override;
52
53 // Documentation Inherited
54 hardware_interface::return_type read() override;
55
56 // Documentation Inherited
57 hardware_interface::return_type write() override;
58
59 // Documentation Inherited
60 bool initSim(
61 rclcpp::Node::SharedPtr & model_nh,
62 std::map<std::string, ignition::gazebo::Entity> & joints,
63 const hardware_interface::HardwareInfo & hardware_info,
64 ignition::gazebo::EntityComponentManager & _ecm,
65 int & update_rate) override;
66
67private:
68 // Register a sensor (for now just IMUs)
69 // \param[in] hardware_info hardware information where the data of
70 // the sensors is extract.
71 void registerSensors(
72 const hardware_interface::HardwareInfo & hardware_info);
73
75 std::unique_ptr<IgnitionSystemPrivate> dataPtr;
76};
77
78} // namespace ign_ros2_control
79
80#endif // IGN_ROS2_CONTROL__IGN_SYSTEM_HPP_
Definition ign_system_interface.hpp:77
Definition ign_system.hpp:35
hardware_interface::return_type configure(const hardware_interface::HardwareInfo &system_info) override
Configuration of the system from data parsed from the robot's URDF.
Definition ign_system.cpp:326
hardware_interface::return_type write() override
Write the current command values to the actuator within the system.
Definition ign_system.cpp:401
std::vector< hardware_interface::StateInterface > export_state_interfaces() override
Exports all state interfaces for this system.
Definition ign_system.cpp:335
std::vector< hardware_interface::CommandInterface > export_command_interfaces() override
Exports all command interfaces for this system.
Definition ign_system.cpp:341
hardware_interface::return_type start() override
Start exchange data with the hardware.
Definition ign_system.cpp:346
bool initSim(rclcpp::Node::SharedPtr &model_nh, std::map< std::string, ignition::gazebo::Entity > &joints, const hardware_interface::HardwareInfo &hardware_info, ignition::gazebo::EntityComponentManager &_ecm, int &update_rate) override
Initialize the system interface param[in] model_nh Pointer to the ros2 node param[in] joints Map with...
Definition ign_system.cpp:139
hardware_interface::return_type read() override
Read the current state values from the actuators and sensors within the system.
Definition ign_system.cpp:358
hardware_interface::return_type stop() override
Stop exchange data with the hardware.
Definition ign_system.cpp:352
This structure stores information about hardware defined in a robot's URDF.
Definition hardware_info.hpp:103