combined_robot_hw_sim.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2018, Open Source Robotics Foundation
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of the Open Source Robotics Foundation
18  * nor the names of its contributors may be
19  * used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *********************************************************************/
35 
36 #ifndef _GAZEBO_ROS_CONTROL__COMBINED_ROBOT_HW_SIM_H_
37 #define _GAZEBO_ROS_CONTROL__COMBINED_ROBOT_HW_SIM_H_
38 
39 #include <list>
40 #include <map>
41 #include <typeinfo>
48 #include <ros/console.h>
49 #include <ros/node_handle.h>
50 
51 namespace gazebo_ros_control
52 {
54 
62 class CombinedRobotHWSim : public gazebo_ros_control::RobotHWSim
63 {
64  protected:
67  std::vector<gazebo_ros_control::RobotHWSimSharedPtr> robot_hw_list_;
68 
72  void filterControllerList(const std::list<hardware_interface::ControllerInfo>& list,
73  std::list<hardware_interface::ControllerInfo>& filtered_list,
75 
76  public:
78 
79  virtual ~CombinedRobotHWSim()
80  {
81  }
82 
85  // Reads in configuration for multiple RobotHWSim classes by reading
86  // the robot_hardware parameter in the robotNamespace set in the sdf.
87  // Example:
88  // <rosparam ns="my_robot">
89  // robot_hardware:
90  // - my_hardware
91  // - custom_hardware
92  // my_hardware:
93  // type: gazebo_ros_control/DefaultRobotHWSim
94  // pid_gains:
95  // my_joint:
96  // p: 0.1
97  // i: 0.001
98  // d: 0
99  // custom_hardware
100  // type: my_package/MyPackageRobotHWSim
101  // <rosparam>
109  virtual bool initSim(const std::string& robot_namespace, ros::NodeHandle model_nh,
110  gazebo::physics::ModelPtr parent_model, const urdf::Model* const urdf_model,
111  std::vector<transmission_interface::TransmissionInfo> transmissions);
112 
119  virtual void readSim(ros::Time time, ros::Duration period);
120 
127  virtual void writeSim(ros::Time time, ros::Duration period);
128 
134  virtual void eStopActive(const bool active)
135  {
136  }
137 
143  virtual bool prepareSwitch(const std::list<hardware_interface::ControllerInfo>& start_list,
144  const std::list<hardware_interface::ControllerInfo>& stop_list);
145 
150  virtual void doSwitch(const std::list<hardware_interface::ControllerInfo>& start_list,
151  const std::list<hardware_interface::ControllerInfo>& stop_list);
152 };
153 }
154 
155 #endif
demangle_symbol.h
gazebo_ros_control::CombinedRobotHWSim::class_loader_t
pluginlib::ClassLoader< gazebo_ros_control::RobotHWSim > class_loader_t
Definition: combined_robot_hw_sim.h:98
node_handle.h
boost::shared_ptr< gazebo_ros_control::RobotHWSim >
gazebo_ros_control::CombinedRobotHWSim::robot_hw_list_
std::vector< gazebo_ros_control::RobotHWSimSharedPtr > robot_hw_list_
Definition: combined_robot_hw_sim.h:100
gazebo_ros_control::CombinedRobotHWSim::initSim
virtual bool initSim(const std::string &robot_namespace, ros::NodeHandle model_nh, gazebo::physics::ModelPtr parent_model, const urdf::Model *const urdf_model, std::vector< transmission_interface::TransmissionInfo > transmissions)
Initialize the simulated robot hardware.
Definition: combined_robot_hw_sim.cpp:80
gazebo_ros_control::CombinedRobotHWSim::eStopActive
virtual void eStopActive(const bool active)
Set the emergency stop state.
Definition: combined_robot_hw_sim.h:167
gazebo_ros_control::RobotHWSimSharedPtr
boost::shared_ptr< gazebo_ros_control::RobotHWSim > RobotHWSimSharedPtr
Definition: combined_robot_hw_sim.h:86
urdf::Model
gazebo_ros_control::RobotHWSim
hardware_interface.h
gazebo_ros_control::CombinedRobotHWSim::filterControllerList
void filterControllerList(const std::list< hardware_interface::ControllerInfo > &list, std::list< hardware_interface::ControllerInfo > &filtered_list, gazebo_ros_control::RobotHWSimSharedPtr robot_hw)
Filters the start and stop lists so that they only contain the controllers and resources that corresp...
Definition: combined_robot_hw_sim.cpp:207
gazebo_ros_control::CombinedRobotHWSim::doSwitch
virtual void doSwitch(const std::list< hardware_interface::ControllerInfo > &start_list, const std::list< hardware_interface::ControllerInfo > &stop_list)
Definition: combined_robot_hw_sim.cpp:172
robot_hw_sim.h
console.h
gazebo_ros_control
gazebo_ros_control::CombinedRobotHWSim::class_loader_
class_loader_t class_loader_
Definition: combined_robot_hw_sim.h:99
interface_manager.h
gazebo_ros_control::CombinedRobotHWSim::readSim
virtual void readSim(ros::Time time, ros::Duration period)
Read state data from the simulated robot hardware.
Definition: combined_robot_hw_sim.cpp:189
pluginlib::ClassLoader< gazebo_ros_control::RobotHWSim >
class_loader.hpp
gazebo_ros_control::CombinedRobotHWSim::prepareSwitch
virtual bool prepareSwitch(const std::list< hardware_interface::ControllerInfo > &start_list, const std::list< hardware_interface::ControllerInfo > &stop_list)
Definition: combined_robot_hw_sim.cpp:154
gazebo_ros_control::CombinedRobotHWSim::writeSim
virtual void writeSim(ros::Time time, ros::Duration period)
Write commands to the simulated robot hardware.
Definition: combined_robot_hw_sim.cpp:198
ros::Time
robot_hw.h
gazebo_ros_control::CombinedRobotHWSim::CombinedRobotHWSim
CombinedRobotHWSim()
Definition: combined_robot_hw_sim.cpp:76
ros::Duration
ros::NodeHandle
gazebo_ros_control::CombinedRobotHWSim::~CombinedRobotHWSim
virtual ~CombinedRobotHWSim()
Definition: combined_robot_hw_sim.h:112


qb_device_gazebo
Author(s): qbroboticsĀ®
autogenerated on Thu Apr 27 2023 02:36:26