Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions hardware_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ find_package(TinyXML2 REQUIRED)
add_library(
hardware_interface
SHARED
src/components/actuator.cpp
src/components/sensor.cpp
src/components/system.cpp
src/actuator.cpp
src/component_parser.cpp
src/resource_manager.cpp
src/sensor.cpp
src/system.cpp
)
target_include_directories(
hardware_interface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef HARDWARE_INTERFACE__COMPONENTS__ACTUATOR_HPP_
#define HARDWARE_INTERFACE__COMPONENTS__ACTUATOR_HPP_
#ifndef HARDWARE_INTERFACE__ACTUATOR_HPP_
#define HARDWARE_INTERFACE__ACTUATOR_HPP_

#include <memory>
#include <string>
Expand All @@ -27,8 +27,6 @@

namespace hardware_interface
{
namespace components
{

class ActuatorInterface;

Expand Down Expand Up @@ -75,6 +73,5 @@ class Actuator final
std::unique_ptr<ActuatorInterface> impl_;
};

} // namespace components
} // namespace hardware_interface
#endif // HARDWARE_INTERFACE__COMPONENTS__ACTUATOR_HPP_
#endif // HARDWARE_INTERFACE__ACTUATOR_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef HARDWARE_INTERFACE__COMPONENTS__ACTUATOR_INTERFACE_HPP_
#define HARDWARE_INTERFACE__COMPONENTS__ACTUATOR_INTERFACE_HPP_
#ifndef HARDWARE_INTERFACE__ACTUATOR_INTERFACE_HPP_
#define HARDWARE_INTERFACE__ACTUATOR_INTERFACE_HPP_

#include <memory>
#include <string>
Expand All @@ -26,8 +26,6 @@

namespace hardware_interface
{
namespace components
{

/**
* \brief Virtual Class to implement when integrating a 1 DoF actuator into ros2_control.
Expand Down Expand Up @@ -129,6 +127,5 @@ class ActuatorInterface
return_type write() = 0;
};

} // namespace components
} // namespace hardware_interface
#endif // HARDWARE_INTERFACE__COMPONENTS__ACTUATOR_INTERFACE_HPP_
#endif // HARDWARE_INTERFACE__ACTUATOR_INTERFACE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef HARDWARE_INTERFACE__COMPONENTS__BASE_INTERFACE_HPP_
#define HARDWARE_INTERFACE__COMPONENTS__BASE_INTERFACE_HPP_
#ifndef HARDWARE_INTERFACE__BASE_INTERFACE_HPP_
#define HARDWARE_INTERFACE__BASE_INTERFACE_HPP_

#include <string>

Expand All @@ -23,8 +23,6 @@

namespace hardware_interface
{
namespace components
{

template<class InterfaceType>
class BaseInterface : public InterfaceType
Expand Down Expand Up @@ -57,7 +55,6 @@ class BaseInterface : public InterfaceType
status status_;
};

} // namespace components
} // namespace hardware_interface

#endif // HARDWARE_INTERFACE__COMPONENTS__BASE_INTERFACE_HPP_
#endif // HARDWARE_INTERFACE__BASE_INTERFACE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@

namespace hardware_interface
{
namespace components
{
class ActuatorInterface;
class SensorInterface;
class SystemInterface;
} // namespace components

class ResourceStorage;

class ResourceManager
Expand Down Expand Up @@ -152,8 +148,7 @@ class ResourceManager
* externally and prior to the call to import.
* \param actuator pointer to the actuator interface.
*/
void import_component(
std::unique_ptr<components::ActuatorInterface> actuator);
void import_component(std::unique_ptr<ActuatorInterface> actuator);

/// Return the number of loaded sensor components.
/**
Expand All @@ -171,7 +166,7 @@ class ResourceManager
* externally and prior to the call to import.
* \param sensor pointer to the sensor interface.
*/
void import_component(std::unique_ptr<components::SensorInterface> sensor);
void import_component(std::unique_ptr<SensorInterface> sensor);

/// Return the number of loaded system components.
/**
Expand All @@ -189,7 +184,7 @@ class ResourceManager
* externally and prior to the call to import.
* \param system pointer to the system interface.
*/
void import_component(std::unique_ptr<components::SystemInterface> system);
void import_component(std::unique_ptr<SystemInterface> system);

/// Return status for all components.
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef HARDWARE_INTERFACE__COMPONENTS__SENSOR_HPP_
#define HARDWARE_INTERFACE__COMPONENTS__SENSOR_HPP_
#ifndef HARDWARE_INTERFACE__SENSOR_HPP_
#define HARDWARE_INTERFACE__SENSOR_HPP_

#include <memory>
#include <string>
Expand All @@ -28,8 +28,6 @@

namespace hardware_interface
{
namespace components
{

class SensorInterface;

Expand Down Expand Up @@ -70,6 +68,5 @@ class Sensor final
std::unique_ptr<SensorInterface> impl_;
};

} // namespace components
} // namespace hardware_interface
#endif // HARDWARE_INTERFACE__COMPONENTS__SENSOR_HPP_
#endif // HARDWARE_INTERFACE__SENSOR_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef HARDWARE_INTERFACE__COMPONENTS__SENSOR_INTERFACE_HPP_
#define HARDWARE_INTERFACE__COMPONENTS__SENSOR_INTERFACE_HPP_
#ifndef HARDWARE_INTERFACE__SENSOR_INTERFACE_HPP_
#define HARDWARE_INTERFACE__SENSOR_INTERFACE_HPP_

#include <memory>
#include <string>
Expand All @@ -27,8 +27,6 @@

namespace hardware_interface
{
namespace components
{

/**
* \brief Virtual Class to implement when integrating a stand-alone sensor into ros2_control.
Expand Down Expand Up @@ -108,6 +106,5 @@ class SensorInterface
return_type read() = 0;
};

} // namespace components
} // namespace hardware_interface
#endif // HARDWARE_INTERFACE__COMPONENTS__SENSOR_INTERFACE_HPP_
#endif // HARDWARE_INTERFACE__SENSOR_INTERFACE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef HARDWARE_INTERFACE__COMPONENTS__SYSTEM_HPP_
#define HARDWARE_INTERFACE__COMPONENTS__SYSTEM_HPP_
#ifndef HARDWARE_INTERFACE__SYSTEM_HPP_
#define HARDWARE_INTERFACE__SYSTEM_HPP_

#include <memory>
#include <string>
Expand All @@ -28,8 +28,6 @@

namespace hardware_interface
{
namespace components
{

class SystemInterface;

Expand Down Expand Up @@ -74,6 +72,5 @@ class System final
std::unique_ptr<SystemInterface> impl_;
};

} // namespace components
} // namespace hardware_interface
#endif // HARDWARE_INTERFACE__COMPONENTS__SYSTEM_HPP_
#endif // HARDWARE_INTERFACE__SYSTEM_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef HARDWARE_INTERFACE__COMPONENTS__SYSTEM_INTERFACE_HPP_
#define HARDWARE_INTERFACE__COMPONENTS__SYSTEM_INTERFACE_HPP_
#ifndef HARDWARE_INTERFACE__SYSTEM_INTERFACE_HPP_
#define HARDWARE_INTERFACE__SYSTEM_INTERFACE_HPP_

#include <memory>
#include <string>
Expand All @@ -27,8 +27,6 @@

namespace hardware_interface
{
namespace components
{

/**
* \brief Virtual Class to implement when integrating a complex system into ros2_control.
Expand Down Expand Up @@ -132,6 +130,5 @@ class SystemInterface
return_type write() = 0;
};

} // namespace components
} // namespace hardware_interface
#endif // HARDWARE_INTERFACE__COMPONENTS__SYSTEM_INTERFACE_HPP_
#endif // HARDWARE_INTERFACE__SYSTEM_INTERFACE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include <utility>
#include <vector>

#include "hardware_interface/components/actuator.hpp"
#include "hardware_interface/components/actuator_interface.hpp"
#include "hardware_interface/actuator.hpp"
#include "hardware_interface/actuator_interface.hpp"

#include "hardware_interface/handle.hpp"
#include "hardware_interface/hardware_info.hpp"
Expand All @@ -28,8 +28,6 @@

namespace hardware_interface
{
namespace components
{

Actuator::Actuator(std::unique_ptr<ActuatorInterface> impl)
: impl_(std::move(impl))
Expand Down Expand Up @@ -82,5 +80,4 @@ return_type Actuator::write()
return impl_->write();
}

} // namespace components
} // namespace hardware_interface
48 changes: 24 additions & 24 deletions hardware_interface/src/resource_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
#include <unordered_map>
#include <utility>

#include "hardware_interface/components/actuator.hpp"
#include "hardware_interface/components/actuator_interface.hpp"
#include "hardware_interface/components/sensor.hpp"
#include "hardware_interface/components/sensor_interface.hpp"
#include "hardware_interface/components/system.hpp"
#include "hardware_interface/components/system_interface.hpp"
#include "hardware_interface/actuator.hpp"
#include "hardware_interface/actuator_interface.hpp"
#include "hardware_interface/sensor.hpp"
#include "hardware_interface/sensor_interface.hpp"
#include "hardware_interface/system.hpp"
#include "hardware_interface/system_interface.hpp"
#include "hardware_interface/component_parser.hpp"

#include "pluginlib/class_loader.hpp"
Expand All @@ -38,11 +38,11 @@ class ResourceStorage
static constexpr const char * pkg_name = "hardware_interface";

static constexpr const char * actuator_interface_name =
"hardware_interface::components::ActuatorInterface";
"hardware_interface::ActuatorInterface";
static constexpr const char * sensor_interface_name =
"hardware_interface::components::SensorInterface";
"hardware_interface::SensorInterface";
static constexpr const char * system_interface_name =
"hardware_interface::components::SystemInterface";
"hardware_interface::SystemInterface";

public:
ResourceStorage()
Expand Down Expand Up @@ -98,7 +98,7 @@ class ResourceStorage
const HardwareInfo & hardware_info,
std::unordered_map<std::string, bool> & claimed_command_interface_map)
{
initialize_hardware<components::Actuator, components::ActuatorInterface>(
initialize_hardware<Actuator, ActuatorInterface>(
hardware_info, actuator_loader_, actuators_);
if (return_type::OK != actuators_.back().configure(hardware_info)) {
throw std::runtime_error(std::string("failed to configure ") + hardware_info.name);
Expand All @@ -109,7 +109,7 @@ class ResourceStorage

void initialize_sensor(const HardwareInfo & hardware_info)
{
initialize_hardware<components::Sensor, components::SensorInterface>(
initialize_hardware<Sensor, SensorInterface>(
hardware_info, sensor_loader_, sensors_);
if (return_type::OK != sensors_.back().configure(hardware_info)) {
throw std::runtime_error(std::string("failed to configure ") + hardware_info.name);
Expand All @@ -121,7 +121,7 @@ class ResourceStorage
const HardwareInfo & hardware_info,
std::unordered_map<std::string, bool> & claimed_command_interface_map)
{
initialize_hardware<components::System, components::SystemInterface>(
initialize_hardware<System, SystemInterface>(
hardware_info, system_loader_, systems_);
if (return_type::OK != systems_.back().configure(hardware_info)) {
throw std::runtime_error(std::string("failed to configure ") + hardware_info.name);
Expand All @@ -131,13 +131,13 @@ class ResourceStorage
}

// hardware plugins
pluginlib::ClassLoader<components::ActuatorInterface> actuator_loader_;
pluginlib::ClassLoader<components::SensorInterface> sensor_loader_;
pluginlib::ClassLoader<components::SystemInterface> system_loader_;
pluginlib::ClassLoader<ActuatorInterface> actuator_loader_;
pluginlib::ClassLoader<SensorInterface> sensor_loader_;
pluginlib::ClassLoader<SystemInterface> system_loader_;

std::vector<components::Actuator> actuators_;
std::vector<components::Sensor> sensors_;
std::vector<components::System> systems_;
std::vector<Actuator> actuators_;
std::vector<Sensor> sensors_;
std::vector<System> systems_;

std::unordered_map<std::string, status> hardware_status_map_;

Expand Down Expand Up @@ -257,10 +257,10 @@ bool ResourceManager::command_interface_exists(const std::string & key) const
resource_storage_->command_interface_map_.end();
}

void ResourceManager::import_component(std::unique_ptr<components::ActuatorInterface> actuator)
void ResourceManager::import_component(std::unique_ptr<ActuatorInterface> actuator)
{
resource_storage_->actuators_.emplace_back(
components::Actuator(std::move(actuator)));
Actuator(std::move(actuator)));
resource_storage_->import_state_interfaces(resource_storage_->actuators_.back());
resource_storage_->import_command_interfaces(
resource_storage_->actuators_.back(), claimed_command_interface_map_);
Expand All @@ -271,9 +271,9 @@ size_t ResourceManager::actuator_components_size() const
return resource_storage_->actuators_.size();
}

void ResourceManager::import_component(std::unique_ptr<components::SensorInterface> sensor)
void ResourceManager::import_component(std::unique_ptr<SensorInterface> sensor)
{
resource_storage_->sensors_.emplace_back(components::Sensor(std::move(sensor)));
resource_storage_->sensors_.emplace_back(Sensor(std::move(sensor)));
resource_storage_->import_state_interfaces(resource_storage_->sensors_.back());
}

Expand All @@ -282,9 +282,9 @@ size_t ResourceManager::sensor_components_size() const
return resource_storage_->sensors_.size();
}

void ResourceManager::import_component(std::unique_ptr<components::SystemInterface> system)
void ResourceManager::import_component(std::unique_ptr<SystemInterface> system)
{
resource_storage_->systems_.emplace_back(components::System(std::move(system)));
resource_storage_->systems_.emplace_back(System(std::move(system)));
resource_storage_->import_state_interfaces(resource_storage_->systems_.back());
resource_storage_->import_command_interfaces(
resource_storage_->systems_.back(), claimed_command_interface_map_);
Expand Down
Loading