RobotTrajectoryDesignerTestEnvironment.h
Go to the documentation of this file.
1#include <VirtualRobot/XML/RobotIO.h>
2
5#include <ArmarXCore/core/test/IceTestHelper.h>
6
7#include <RobotTrajectoryDesigner/gui-plugins/RobotTrajectoryDesignerGuiPlugin/RobotTrajectoryDesignerGuiPluginGuiPlugin.h>
8
10{
11public:
12 RobotTrajectoryDesignerTestEnvironment(const std::string& testName,
13 int registryPort = 11220,
14 bool addObjects = true)
15 {
18 const std::string project = "RobotAPI";
19 armarx::CMakePackageFinder finder(project);
20
21 if (!finder.packageFound())
22 {
23 ARMARX_ERROR << "ArmarX Package " << project << " has not been found!";
24 }
25 else
26 {
28 }
29
30 std::string fn = "RobotAPI/robots/Armar3/ArmarIII.xml";
31 ArmarXDataPath::getAbsolutePath(fn, fn);
32 std::string robotFilename = fn;
33
34 _spaceSavePath = test::getCmakeValue("PROJECT_BINARY_DIR") + "/Testing/Temporary/spaces/";
35
36 if (loadSpaces)
37 {
38 properties->setProperty("ArmarX.RobotIK.ReachabilitySpacesFolder", _spaceSavePath);
39 properties->setProperty("ArmarX.RobotIK.InitialReachabilitySpaces",
40 "testReachabilitySpace.bin");
41 }
42
43 _iceTestHelper = new IceTestHelper(registryPort, registryPort + 1);
44 _iceTestHelper->startEnvironment();
45
46 // The manager allows you to create new ArmarX components
47 _manager = new TestArmarXManager(testName, _iceTestHelper->getCommunicator(), properties);
48 if (addObjects)
49 {
50 // This is how you create components.
52 _manager->createComponentAndRun<YourComponent, YourComponentInterfacePrx>(
53 "ArmarX", "RobotTrajectoryDesigner");
54 }
55
57 VirtualRobot::RobotIO::loadRobot(robotFilename, VirtualRobot::RobotIO::eStructure);
58 }
59
64
65 // In your tests, you can access your component through this proxy
66 RobotTrajectoryDesignerInterfacePrx _robotTrajectoryDesigner;
67 TestArmarXManagerPtr _manager;
68 IceTestHelperPtr _iceTestHelper;
70};
71
73 std::shared_ptr<RobotTrajectoryDesignerTestEnvironment>;
std::shared_ptr< RobotTrajectoryDesignerTestEnvironment > RobotTrajectoryDesignerTestEnvironmentPtr
RobotTrajectoryDesignerTestEnvironment(const std::string &testName, int registryPort=11220, bool addObjects=true)
static void LoadDefaultConfig(Ice::PropertiesPtr properties)
static void addDataPaths(const std::string &dataPathList)
The CMakePackageFinder class provides an interface to the CMake Package finder capabilities.
bool packageFound() const
Returns whether or not this package was found with cmake.
#define ARMARX_ERROR
The logging level for unexpected behaviour, that must be fixed.
Definition Logging.h:196
Ice::PropertiesPtr createProperties()
::IceInternal::Handle<::Ice::Properties > PropertiesPtr
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19