MoveIt Pro Behavior
Core Behaviors for MoveIt Pro
Loading...
Searching...
No Matches
moveit_studio::test_utils Namespace Reference

Classes

class  WithActionBehavior
 
class  WithBehavior
 Adds testing capabilities of Behaviors with context to any test fixture. More...
 
class  WithBehaviorWithoutContext
 Adds testing capabilities of Behaviors without context to any test fixture. More...
 
class  WrongBehaviorPortsException
 Exception thrown by Behavior testing classes when the Behavior does not define exactly the expected ports. More...
 

Typedefs

using PortSetter = std::function< void(BT::Blackboard &, const std::string &)>
 A callable that sets a Behavior port in a blackboard.
 
using PortSetterMap = std::map< std::string, PortSetter >
 A map associating port names to their setters.
 
using PortSetterMapGenerator = const PortSetterMap &(*)(void)
 A function generating a map of port setters.
 

Functions

BT::NodeConfiguration createNodeConfig (const std::set< std::string > &input_port_ids, const std::set< std::string > &output_port_ids)
 
std::string joinStrings (const std::set< std::string > &input)
 
std::set< std::string > getPortIDsWithDirection (const BT::PortsList &ports, const BT::PortDirection direction)
 
std::string comparePortIds (const std::set< std::string > &actual, const std::set< std::string > &expected)
 
void checkBehaviorPortExpectations (const std::string &behavior_name, const BT::PortsList &actual_port_list, const PortSetterMap &expected_input_port_setters, const PortSetterMap &expected_output_port_setters)
 
std::set< std::string > getPortIDs (const PortSetterMap &map, bool only_mandatory=false)
 Returns port IDs in a port setter map.
 

Variables

constexpr auto kPortNotSetTestsMaxTimeBehaviorIsInRunningStatus = std::chrono::milliseconds(100)
 

Typedef Documentation

◆ PortSetter

using moveit_studio::test_utils::PortSetter = typedef std::function<void(BT::Blackboard&, const std::string&)>

A callable that sets a Behavior port in a blackboard.

◆ PortSetterMap

using moveit_studio::test_utils::PortSetterMap = typedef std::map<std::string, PortSetter>

A map associating port names to their setters.

◆ PortSetterMapGenerator

A function generating a map of port setters.

Setters for input and output ports are passed to the Behavior testing classes and macros to automatically generate port tests.

Function Documentation

◆ checkBehaviorPortExpectations()

void moveit_studio::test_utils::checkBehaviorPortExpectations ( const std::string &  behavior_name,
const BT::PortsList &  actual_port_list,
const PortSetterMap expected_input_port_setters,
const PortSetterMap expected_output_port_setters 
)

◆ comparePortIds()

std::string moveit_studio::test_utils::comparePortIds ( const std::set< std::string > &  actual,
const std::set< std::string > &  expected 
)

◆ createNodeConfig()

BT::NodeConfiguration moveit_studio::test_utils::createNodeConfig ( const std::set< std::string > &  input_port_ids,
const std::set< std::string > &  output_port_ids 
)

◆ getPortIDs()

std::set< std::string > moveit_studio::test_utils::getPortIDs ( const PortSetterMap map,
bool  only_mandatory = false 
)

Returns port IDs in a port setter map.

Parameters
mapThe map from which to retrieve port IDs.
only_mandatoryif true, does not return IDs for optional ports.
Returns
If only_mandatory is false, IDs of all ports in the map; if only_mandatory is true, only IDs of mandatory ports.

◆ getPortIDsWithDirection()

std::set< std::string > moveit_studio::test_utils::getPortIDsWithDirection ( const BT::PortsList &  ports,
const BT::PortDirection  direction 
)

◆ joinStrings()

std::string moveit_studio::test_utils::joinStrings ( const std::set< std::string > &  input)

Variable Documentation

◆ kPortNotSetTestsMaxTimeBehaviorIsInRunningStatus

constexpr auto moveit_studio::test_utils::kPortNotSetTestsMaxTimeBehaviorIsInRunningStatus = std::chrono::milliseconds(100)
constexpr