moveit2
The MoveIt Motion Planning Framework for ROS 2.
Loading...
Searching...
No Matches
moveit_ros
trajectory_cache
test
fixtures
warehouse_fixture.cpp
Go to the documentation of this file.
1
// Copyright 2024 Intrinsic Innovation LLC.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
19
#include <thread>
20
21
#include <gtest/gtest.h>
22
#include <rclcpp/rclcpp.hpp>
23
#include <
moveit/warehouse/moveit_message_storage.hpp
>
24
25
#include "
warehouse_fixture.hpp
"
26
27
WarehouseFixture::WarehouseFixture
() : node_(
rclcpp
::Node::make_shared(
"warehouse_fixture"
))
28
{
29
node_
->declare_parameter<std::string>(
"warehouse_plugin"
,
"warehouse_ros_sqlite::DatabaseConnection"
);
30
}
31
32
WarehouseFixture::~WarehouseFixture
()
33
{
34
is_spinning_ =
false
;
35
if
(spin_thread_.joinable())
36
{
37
spin_thread_.join();
38
}
39
}
40
41
void
WarehouseFixture::SetUp
()
42
{
43
is_spinning_ =
true
;
44
spin_thread_ = std::thread(&WarehouseFixture::spinNode,
this
);
45
46
db_
=
moveit_warehouse::loadDatabase
(
node_
);
47
db_
->setParams(
":memory:"
, 1);
48
ASSERT_TRUE(
db_
->connect());
49
}
50
51
void
WarehouseFixture::TearDown
()
52
{
53
db_
.reset();
54
is_spinning_ =
false
;
55
spin_thread_.join();
56
}
57
58
void
WarehouseFixture::spinNode()
59
{
60
while
(is_spinning_ && rclcpp::ok())
61
{
62
rclcpp::spin_some(
node_
);
63
}
64
}
WarehouseFixture::~WarehouseFixture
~WarehouseFixture() override
Definition
warehouse_fixture.cpp:32
WarehouseFixture::node_
rclcpp::Node::SharedPtr node_
Definition
warehouse_fixture.hpp:37
WarehouseFixture::db_
warehouse_ros::DatabaseConnection::Ptr db_
Definition
warehouse_fixture.hpp:38
WarehouseFixture::WarehouseFixture
WarehouseFixture()
Definition
warehouse_fixture.cpp:27
WarehouseFixture::TearDown
void TearDown() override
Definition
warehouse_fixture.cpp:51
WarehouseFixture::SetUp
void SetUp() override
Definition
warehouse_fixture.cpp:41
moveit_message_storage.hpp
moveit_warehouse::loadDatabase
warehouse_ros::DatabaseConnection::Ptr loadDatabase(const rclcpp::Node::SharedPtr &node)
Load a database connection.
Definition
moveit_message_storage.cpp:64
rclcpp
Definition
rclcpp_utils.hpp:34
warehouse_fixture.hpp
Generated by
1.9.8