epos_manager.cpp
Go to the documentation of this file.
00001 #include "epos_hardware/epos_manager.h"
00002 #include <boost/foreach.hpp>
00003 
00004 namespace epos_hardware {
00005 
00006 EposManager::EposManager(hardware_interface::ActuatorStateInterface& asi,
00007                          hardware_interface::VelocityActuatorInterface& avi,
00008                          hardware_interface::PositionActuatorInterface& api,
00009                          ros::NodeHandle& nh, ros::NodeHandle& pnh,
00010                          const std::vector<std::string>& motor_names)
00011   : asi_(&asi), avi_(&avi), api_(&api) {
00012   BOOST_FOREACH(const std::string& motor_name, motor_names) {
00013     ROS_INFO_STREAM("Loading EPOS: " << motor_name);
00014     ros::NodeHandle motor_config_nh(pnh, motor_name);
00015     boost::shared_ptr<Epos> motor(new Epos(motor_name, nh, motor_config_nh, &epos_factory, *asi_, *avi_, *api_));
00016     motors_.push_back(motor);
00017   }
00018 }
00019 
00020 
00021 bool EposManager::init() {
00022   bool success = true;
00023   BOOST_FOREACH(const boost::shared_ptr<Epos>& motor, motors_) {
00024     if(!motor->init()) {
00025       ROS_ERROR_STREAM("Could not configure motor: " << motor->name());
00026       success = false;
00027     }
00028   }
00029   return success;
00030 }
00031 
00032 void EposManager::update_diagnostics() {
00033   BOOST_FOREACH(const boost::shared_ptr<Epos>& motor, motors_) {
00034     motor->update_diagnostics();
00035   }
00036 }
00037 
00038 void EposManager::read() {
00039   BOOST_FOREACH(const boost::shared_ptr<Epos>& motor, motors_) {
00040     motor->read();
00041   }
00042 }
00043 
00044 void EposManager::write() {
00045   BOOST_FOREACH(const boost::shared_ptr<Epos>& motor, motors_) {
00046     motor->write();
00047   }
00048 }
00049 
00050 
00051 }


epos_hardware
Author(s): Mitchell Wills
autogenerated on Thu Jun 6 2019 20:43:10