Skip to content

Commit 771e3f1

Browse files
Add modify allowed collisions command
1 parent a90b97d commit 771e3f1

14 files changed

+234
-345
lines changed

tesseract_environment/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CUR
7777
add_library(
7878
${PROJECT_NAME}_commands
7979
src/command.cpp
80-
src/commands/add_allowed_collision_command.cpp
8180
src/commands/add_contact_managers_plugin_info_command.cpp
8281
src/commands/add_kinematics_information_command.cpp
8382
src/commands/add_link_command.cpp
@@ -90,9 +89,9 @@ add_library(
9089
src/commands/change_link_collision_enabled_command.cpp
9190
src/commands/change_link_origin_command.cpp
9291
src/commands/change_link_visibility_command.cpp
92+
src/commands/modify_allowed_collisions_command.cpp
9393
src/commands/move_joint_command.cpp
9494
src/commands/move_link_command.cpp
95-
src/commands/remove_allowed_collision_command.cpp
9695
src/commands/remove_allowed_collision_link_command.cpp
9796
src/commands/remove_joint_command.cpp
9897
src/commands/remove_link_command.cpp

tesseract_environment/include/tesseract_environment/command.h

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,18 @@ enum class CommandType
4949
CHANGE_JOINT_ORIGIN = 6,
5050
CHANGE_LINK_COLLISION_ENABLED = 7,
5151
CHANGE_LINK_VISIBILITY = 8,
52-
ADD_ALLOWED_COLLISION = 9,
53-
REMOVE_ALLOWED_COLLISION = 10,
54-
REMOVE_ALLOWED_COLLISION_LINK = 11,
55-
ADD_SCENE_GRAPH = 12,
56-
CHANGE_JOINT_POSITION_LIMITS = 13,
57-
CHANGE_JOINT_VELOCITY_LIMITS = 14,
58-
CHANGE_JOINT_ACCELERATION_LIMITS = 15,
59-
ADD_KINEMATICS_INFORMATION = 16,
60-
REPLACE_JOINT = 17,
61-
CHANGE_COLLISION_MARGINS = 18,
62-
ADD_CONTACT_MANAGERS_PLUGIN_INFO = 19,
63-
SET_ACTIVE_DISCRETE_CONTACT_MANAGER = 20,
64-
SET_ACTIVE_CONTINUOUS_CONTACT_MANAGER = 21
52+
MODIFY_ALLOWED_COLLISIONS = 9,
53+
REMOVE_ALLOWED_COLLISION_LINK = 10,
54+
ADD_SCENE_GRAPH = 11,
55+
CHANGE_JOINT_POSITION_LIMITS = 12,
56+
CHANGE_JOINT_VELOCITY_LIMITS = 13,
57+
CHANGE_JOINT_ACCELERATION_LIMITS = 14,
58+
ADD_KINEMATICS_INFORMATION = 15,
59+
REPLACE_JOINT = 16,
60+
CHANGE_COLLISION_MARGINS = 17,
61+
ADD_CONTACT_MANAGERS_PLUGIN_INFO = 18,
62+
SET_ACTIVE_DISCRETE_CONTACT_MANAGER = 19,
63+
SET_ACTIVE_CONTINUOUS_CONTACT_MANAGER = 20
6564
};
6665

6766
template <class Archive>
@@ -79,7 +78,7 @@ class Command
7978
using Ptr = std::shared_ptr<Command>;
8079
using ConstPtr = std::shared_ptr<const Command>;
8180

82-
Command(CommandType type = CommandType::UNINITIALIZED) : type_(type){};
81+
Command(CommandType type = CommandType::UNINITIALIZED);
8382
virtual ~Command() = default;
8483
Command(const Command&) = default;
8584
Command& operator=(const Command&) = default;

tesseract_environment/include/tesseract_environment/commands.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#ifndef TESSERACT_ENVIRONMENT_COMMANDS_H
2929
#define TESSERACT_ENVIRONMENT_COMMANDS_H
3030

31-
#include <tesseract_environment/commands/add_allowed_collision_command.h>
3231
#include <tesseract_environment/commands/add_contact_managers_plugin_info_command.h>
3332
#include <tesseract_environment/commands/add_link_command.h>
3433
#include <tesseract_environment/commands/add_kinematics_information_command.h>
@@ -40,9 +39,9 @@
4039
#include <tesseract_environment/commands/change_link_collision_enabled_command.h>
4140
#include <tesseract_environment/commands/change_link_origin_command.h>
4241
#include <tesseract_environment/commands/change_link_visibility_command.h>
42+
#include <tesseract_environment/commands/modify_allowed_collisions_command.h>
4343
#include <tesseract_environment/commands/move_joint_command.h>
4444
#include <tesseract_environment/commands/move_link_command.h>
45-
#include <tesseract_environment/commands/remove_allowed_collision_command.h>
4645
#include <tesseract_environment/commands/remove_allowed_collision_link_command.h>
4746
#include <tesseract_environment/commands/remove_joint_command.h>
4847
#include <tesseract_environment/commands/remove_link_command.h>

tesseract_environment/include/tesseract_environment/commands/add_allowed_collision_command.h

Lines changed: 0 additions & 83 deletions
This file was deleted.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
* @file modify_allowed_collision_command.h
3+
* @brief Used to modify an allowed collision to the environment
4+
*
5+
* @author Levi Armstrong
6+
* @date Dec 18, 2017
7+
* @version TODO
8+
* @bug No known bugs
9+
*
10+
* @copyright Copyright (c) 2017, Southwest Research Institute
11+
*
12+
* @par License
13+
* Software License Agreement (Apache License)
14+
* @par
15+
* Licensed under the Apache License, Version 2.0 (the "License");
16+
* you may not use this file except in compliance with the License.
17+
* You may obtain a copy of the License at
18+
* http://www.apache.org/licenses/LICENSE-2.0
19+
* @par
20+
* Unless required by applicable law or agreed to in writing, software
21+
* distributed under the License is distributed on an "AS IS" BASIS,
22+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23+
* See the License for the specific language governing permissions and
24+
* limitations under the License.
25+
*/
26+
#ifndef TESSERACT_ENVIRONMENT_MODIFY_ALLOWED_COLLISIONS_MATRIX_COMMAND_H
27+
#define TESSERACT_ENVIRONMENT_MODIFY_ALLOWED_COLLISIONS_MATRIX_COMMAND_H
28+
29+
#include <tesseract_common/macros.h>
30+
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
31+
#include <boost/serialization/access.hpp>
32+
#include <memory>
33+
#include <string>
34+
TESSERACT_COMMON_IGNORE_WARNINGS_POP
35+
36+
#include <tesseract_environment/command.h>
37+
#include <tesseract_common/allowed_collision_matrix.h>
38+
39+
namespace tesseract_environment
40+
{
41+
enum class ModifyAllowedCollisionsType
42+
{
43+
ADD,
44+
REMOVE,
45+
REPLACE
46+
};
47+
48+
class ModifyAllowedCollisionsCommand : public Command
49+
{
50+
public:
51+
using Ptr = std::shared_ptr<ModifyAllowedCollisionsCommand>;
52+
using ConstPtr = std::shared_ptr<const ModifyAllowedCollisionsCommand>;
53+
54+
ModifyAllowedCollisionsCommand();
55+
56+
ModifyAllowedCollisionsCommand(tesseract_common::AllowedCollisionMatrix acm, ModifyAllowedCollisionsType type);
57+
58+
ModifyAllowedCollisionsType getModifyType() const;
59+
const tesseract_common::AllowedCollisionMatrix& getAllowedCollisionMatrix() const;
60+
61+
bool operator==(const ModifyAllowedCollisionsCommand& rhs) const;
62+
bool operator!=(const ModifyAllowedCollisionsCommand& rhs) const;
63+
64+
private:
65+
ModifyAllowedCollisionsType type_{ ModifyAllowedCollisionsType::ADD };
66+
tesseract_common::AllowedCollisionMatrix acm_;
67+
68+
friend class boost::serialization::access;
69+
template <class Archive>
70+
void serialize(Archive& ar, const unsigned int version); // NOLINT
71+
};
72+
} // namespace tesseract_environment
73+
74+
#include <boost/serialization/export.hpp>
75+
#include <boost/serialization/tracking.hpp>
76+
BOOST_CLASS_EXPORT_KEY2(tesseract_environment::ModifyAllowedCollisionsCommand, "ModifyAllowedCollisionsCommand")
77+
78+
#endif // TESSERACT_ENVIRONMENT_MODIFY_ALLOWED_COLLISIONS_MATRIX_COMMAND_H

tesseract_environment/include/tesseract_environment/commands/remove_allowed_collision_command.h

Lines changed: 0 additions & 78 deletions
This file was deleted.

tesseract_environment/include/tesseract_environment/environment.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,8 +709,7 @@ class Environment
709709
bool applyChangeJointOriginCommand(const ChangeJointOriginCommand::ConstPtr& cmd);
710710
bool applyChangeLinkCollisionEnabledCommand(const ChangeLinkCollisionEnabledCommand::ConstPtr& cmd);
711711
bool applyChangeLinkVisibilityCommand(const ChangeLinkVisibilityCommand::ConstPtr& cmd);
712-
bool applyAddAllowedCollisionCommand(const AddAllowedCollisionCommand::ConstPtr& cmd);
713-
bool applyRemoveAllowedCollisionCommand(const RemoveAllowedCollisionCommand::ConstPtr& cmd);
712+
bool applyModifyAllowedCollisionsCommand(const ModifyAllowedCollisionsCommand::ConstPtr& cmd);
714713
bool applyRemoveAllowedCollisionLinkCommand(const RemoveAllowedCollisionLinkCommand::ConstPtr& cmd);
715714
bool applyAddSceneGraphCommand(AddSceneGraphCommand::ConstPtr cmd);
716715
bool applyChangeJointPositionLimitsCommand(const ChangeJointPositionLimitsCommand::ConstPtr& cmd);

tesseract_environment/src/command.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP
3636

3737
namespace tesseract_environment
3838
{
39+
Command::Command(CommandType type) : type_(type) {}
40+
3941
template <class Archive>
4042
void save(Archive& ar, const CommandType& g, const unsigned int /*version*/)
4143
{

0 commit comments

Comments
 (0)