10 #include <gtest/gtest.h> 25 const std::string& name,
26 const std::string& type,
37 const std::string& name,
38 const std::string& type,
47 const std::string& name,
48 const std::string& type,
58 :
public ::testing::TestWithParam<std::list<hardware_interface::ControllerInfo>> {
63 robot_->initParameters(root_nh, robot_hw_nh);
64 robot_->initROSInterfaces(robot_hw_nh);
65 robot_->setupParameterCallbacks(robot_hw_nh);
68 return robot_->checkForConflict(info_list);
71 return robot_->prepareSwitch(info_list, info_list);
75 std::unique_ptr<franka_hw::FrankaCombinableHW>
robot_;
79 :
public ::testing::TestWithParam<std::list<hardware_interface::ControllerInfo>> {
84 robot_->initParameters(root_nh, robot_hw_nh);
85 robot_->initROSInterfaces(robot_hw_nh);
86 robot_->setupParameterCallbacks(robot_hw_nh);
89 return robot_->checkForConflict(info_list);
92 return robot_->prepareSwitch(info_list, info_list);
96 std::unique_ptr<franka_hw::FrankaCombinableHW>
robot_;
100 std::string
jp_iface_str(
"hardware_interface::PositionJointInterface");
101 std::string
jv_iface_str(
"hardware_interface::VelocityJointInterface");
102 std::string
jt_iface_str(
"hardware_interface::EffortJointInterface");
103 std::string
cv_iface_str(
"franka_hw::FrankaVelocityCartesianInterface");
104 std::string
cp_iface_str(
"franka_hw::FrankaPoseCartesianInterface");
106 std::string
name_str(
"some_controller");
107 std::string
type_str(
"SomeControllerClass");
109 joint_names[4], joint_names[5], joint_names[6]};
149 combinableNonAdmissibleRequests,
151 ::testing::Values(std::list<hardware_interface::ControllerInfo>{no_id_info},
152 std::list<hardware_interface::ControllerInfo>{unknown_iface_info},
153 std::list<hardware_interface::ControllerInfo>{jp_info},
154 std::list<hardware_interface::ControllerInfo>{jv_info},
155 std::list<hardware_interface::ControllerInfo>{cv_info},
156 std::list<hardware_interface::ControllerInfo>{cp_info},
157 std::list<hardware_interface::ControllerInfo>{jt_jp_info},
158 std::list<hardware_interface::ControllerInfo>{jt_jv_info},
159 std::list<hardware_interface::ControllerInfo>{jt_jt_info},
160 std::list<hardware_interface::ControllerInfo>{jp_jp_info},
161 std::list<hardware_interface::ControllerInfo>{jp_jv_info},
162 std::list<hardware_interface::ControllerInfo>{jp_cv_info},
163 std::list<hardware_interface::ControllerInfo>{jp_cp_info},
164 std::list<hardware_interface::ControllerInfo>{jv_jv_info},
165 std::list<hardware_interface::ControllerInfo>{jv_cv_info},
166 std::list<hardware_interface::ControllerInfo>{jv_cp_info},
167 std::list<hardware_interface::ControllerInfo>{cv_cv_info},
168 std::list<hardware_interface::ControllerInfo>{cv_cp_info},
169 std::list<hardware_interface::ControllerInfo>{cp_cp_info},
170 std::list<hardware_interface::ControllerInfo>{jp_jp_jp_info},
171 std::list<hardware_interface::ControllerInfo>{jt_cv_info},
172 std::list<hardware_interface::ControllerInfo>{jt_cp_info}));
176 ::testing::Values(std::list<hardware_interface::ControllerInfo>{jt_info},
177 std::list<hardware_interface::ControllerInfo>{
180 TEST(FrankaCombinableHWTests, CanInitROSInterfaces) {
hardware_interface::ControllerInfo cp_cp_info
std::string jv_iface_str("hardware_interface::VelocityJointInterface")
std::unique_ptr< franka_hw::FrankaCombinableHW > robot_
hardware_interface::ControllerInfo jt_cv_info
hardware_interface::ControllerInfo jt_cp_info
hardware_interface::ControllerInfo jp_jv_info
hardware_interface::ControllerInfo jp_info
std::string cp_iface_str("franka_hw::FrankaPoseCartesianInterface")
std::set< std::string > joints_set
hardware_interface::InterfaceResources no_id_res(jp_iface_str, no_id_set)
hardware_interface::ControllerInfo cv_info
hardware_interface::ControllerInfo jv_cv_info
hardware_interface::ControllerInfo jt_jp_info
A hardware class for a Panda robot based on the ros_control framework.
hardware_interface::ControllerInfo jp_cp_info
bool callCheckForConflict(const std::list< hardware_interface::ControllerInfo > info_list)
void initROSInterfaces(ros::NodeHandle &robot_hw_nh) override
Initializes the class in terms of ros_control interfaces.
std::set< std::string > cartesian_arm2_set
std::string name_str("some_controller")
std::array< std::string, 7 > joint_names
hardware_interface::ControllerInfo jt_jt_info
hardware_interface::ControllerInfo cv_cv_info
CombinableControllerConflict()
hardware_interface::ControllerInfo jv_info
hardware_interface::InterfaceResources cp_res(cp_iface_str, cartesian_set)
std::string cv_iface_str("franka_hw::FrankaVelocityCartesianInterface")
hardware_interface::InterfaceResources jp_res(jp_iface_str, joints_set)
hardware_interface::InterfaceResources jt_res(jt_iface_str, joints_set)
std::vector< InterfaceResources > claimed_resources
TEST_P(CombinableControllerConflict, ConflictsForIncompatibleControllers)
hardware_interface::ControllerInfo jv_cp_info
hardware_interface::ControllerInfo cp_info
std::string arm_id2("panda2")
bool callPrepareSwitch(const std::list< hardware_interface::ControllerInfo > info_list)
hardware_interface::ControllerInfo cp_arm2_info
std::string jp_iface_str("hardware_interface::PositionJointInterface")
hardware_interface::ControllerInfo newInfo(const std::string &name, const std::string &type, const hardware_interface::InterfaceResources &resource1)
hardware_interface::InterfaceResources jv_res(jv_iface_str, joints_set)
hardware_interface::ControllerInfo unknown_iface_info
bool callCheckForConflict(const std::list< hardware_interface::ControllerInfo > info_list)
virtual bool initParameters(ros::NodeHandle &root_nh, ros::NodeHandle &robot_hw_nh)
Reads the parameterization of the hardware class from the ROS parameter server (e.g.
TEST(FrankaCombinableHWTests, CanInitROSInterfaces)
hardware_interface::ControllerInfo jp_cv_info
bool callPrepareSwitch(const std::list< hardware_interface::ControllerInfo > info_list)
hardware_interface::InterfaceResources unknown_iface_res(unknown_iface_str, joints_set)
std::string unknown_iface_str("hardware_interface::UnknownInterface")
std::string type_str("SomeControllerClass")
CombinableNoControllerConflict()
INSTANTIATE_TEST_CASE_P(combinableNonAdmissibleRequests, CombinableControllerConflict,::testing::Values(std::list< hardware_interface::ControllerInfo >{no_id_info}, std::list< hardware_interface::ControllerInfo >{unknown_iface_info}, std::list< hardware_interface::ControllerInfo >{jp_info}, std::list< hardware_interface::ControllerInfo >{jv_info}, std::list< hardware_interface::ControllerInfo >{cv_info}, std::list< hardware_interface::ControllerInfo >{cp_info}, std::list< hardware_interface::ControllerInfo >{jt_jp_info}, std::list< hardware_interface::ControllerInfo >{jt_jv_info}, std::list< hardware_interface::ControllerInfo >{jt_jt_info}, std::list< hardware_interface::ControllerInfo >{jp_jp_info}, std::list< hardware_interface::ControllerInfo >{jp_jv_info}, std::list< hardware_interface::ControllerInfo >{jp_cv_info}, std::list< hardware_interface::ControllerInfo >{jp_cp_info}, std::list< hardware_interface::ControllerInfo >{jv_jv_info}, std::list< hardware_interface::ControllerInfo >{jv_cv_info}, std::list< hardware_interface::ControllerInfo >{jv_cp_info}, std::list< hardware_interface::ControllerInfo >{cv_cv_info}, std::list< hardware_interface::ControllerInfo >{cv_cp_info}, std::list< hardware_interface::ControllerInfo >{cp_cp_info}, std::list< hardware_interface::ControllerInfo >{jp_jp_jp_info}, std::list< hardware_interface::ControllerInfo >{jt_cv_info}, std::list< hardware_interface::ControllerInfo >{jt_cp_info}))
hardware_interface::ControllerInfo jt_info
std::unique_ptr< franka_hw::FrankaCombinableHW > robot_
hardware_interface::ControllerInfo jp_jp_jp_info
std::set< std::string > cartesian_set
hardware_interface::ControllerInfo no_id_info
hardware_interface::InterfaceResources cv_res(cv_iface_str, cartesian_set)
std::set< std::string > no_id_set
hardware_interface::ControllerInfo jt_jv_info
std::string jt_iface_str("hardware_interface::EffortJointInterface")
hardware_interface::ControllerInfo jv_jv_info
hardware_interface::ControllerInfo jp_jp_info
hardware_interface::ControllerInfo cv_cp_info
hardware_interface::InterfaceResources cp_arm2_res(cp_iface_str, cartesian_arm2_set)