Skip to content

Commit 4e8e445

Browse files
authored
Add utility for getting profiles (#412)
1 parent 3c84820 commit 4e8e445

File tree

20 files changed

+236
-180
lines changed

20 files changed

+236
-180
lines changed

tesseract/tesseract_planning/tesseract_command_language/include/tesseract_command_language/command_language.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
#include <tesseract_command_language/cartesian_waypoint.h>
3030
#include <tesseract_command_language/composite_instruction.h>
31+
#include <tesseract_command_language/constants.h>
3132
#include <tesseract_command_language/instruction_type.h>
3233
#include <tesseract_command_language/joint_waypoint.h>
3334
#include <tesseract_command_language/manipulator_info.h>

tesseract/tesseract_planning/tesseract_command_language/include/tesseract_command_language/composite_instruction.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
3434
TESSERACT_COMMON_IGNORE_WARNINGS_POP
3535

3636
#include <tesseract_command_language/core/instruction.h>
37+
#include <tesseract_command_language/constants.h>
3738
#include <tesseract_command_language/instruction_type.h>
3839
#include <tesseract_command_language/manipulator_info.h>
3940
#include <tesseract_command_language/null_instruction.h>
@@ -53,7 +54,7 @@ class CompositeInstruction
5354
using Ptr = std::shared_ptr<CompositeInstruction>;
5455
using ConstPtr = std::shared_ptr<const CompositeInstruction>;
5556

56-
CompositeInstruction(std::string profile = "DEFAULT",
57+
CompositeInstruction(std::string profile = DEFAULT_PROFILE_KEY,
5758
CompositeInstructionOrder order = CompositeInstructionOrder::ORDERED,
5859
ManipulatorInfo manipulator_info = ManipulatorInfo());
5960

@@ -226,7 +227,7 @@ class CompositeInstruction
226227
*
227228
* If it has a child composite instruction it uses the child composites profile for that section
228229
*/
229-
std::string profile_{ "DEFAULT" };
230+
std::string profile_{ DEFAULT_PROFILE_KEY };
230231

231232
/** @brief The order of the composite instruction */
232233
CompositeInstructionOrder order_{ CompositeInstructionOrder::ORDERED };
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* @file constants.h
3+
* @brief Containst Tesseract Command Language constants
4+
*
5+
* @par License
6+
* Software License Agreement (Apache License)
7+
* @par
8+
* Licensed under the Apache License, Version 2.0 (the "License");
9+
* you may not use this file except in compliance with the License.
10+
* You may obtain a copy of the License at
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
* @par
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
#ifndef TESSERACT_COMMAND_LANGUAGE_CONSTANTS_H
20+
#define TESSERACT_COMMAND_LANGUAGE_CONSTANTS_H
21+
22+
#include <tesseract_common/macros.h>
23+
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
24+
#include <string>
25+
TESSERACT_COMMON_IGNORE_WARNINGS_POP
26+
27+
namespace tesseract_planning
28+
{
29+
/** @brief Set to DEFAULT. Default profiles are given this name. */
30+
static const std::string DEFAULT_PROFILE_KEY = "DEFAULT";
31+
32+
} // namespace tesseract_planning
33+
#endif // TESSERACT_COMMAND_LANGUAGE_CONSTANTS_H

tesseract/tesseract_planning/tesseract_command_language/include/tesseract_command_language/move_instruction.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
3333
TESSERACT_COMMON_IGNORE_WARNINGS_POP
3434

3535
#include <tesseract_command_language/core/waypoint.h>
36+
#include <tesseract_command_language/constants.h>
3637
#include <tesseract_command_language/instruction_type.h>
3738
#include <tesseract_command_language/manipulator_info.h>
3839

@@ -54,7 +55,7 @@ class MoveInstruction
5455

5556
MoveInstruction(Waypoint waypoint,
5657
MoveInstructionType type,
57-
const std::string& profile = "DEFAULT",
58+
const std::string& profile = DEFAULT_PROFILE_KEY,
5859
ManipulatorInfo manipulator_info = ManipulatorInfo());
5960

6061
void setWaypoint(Waypoint waypoint);
@@ -97,7 +98,7 @@ class MoveInstruction
9798
std::string description_;
9899

99100
/** @brief The profile used for this move instruction */
100-
std::string profile_{ "DEFAULT" };
101+
std::string profile_{ DEFAULT_PROFILE_KEY };
101102

102103
/** @brief The assigned waypoint (Cartesian or Joint) */
103104
Waypoint waypoint_;

tesseract/tesseract_planning/tesseract_command_language/include/tesseract_command_language/plan_instruction.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
3434
TESSERACT_COMMON_IGNORE_WARNINGS_POP
3535

3636
#include <tesseract_command_language/core/waypoint.h>
37+
#include <tesseract_command_language/constants.h>
3738
#include <tesseract_command_language/instruction_type.h>
3839
#include <tesseract_command_language/manipulator_info.h>
3940

@@ -55,7 +56,7 @@ class PlanInstruction
5556

5657
PlanInstruction(Waypoint waypoint,
5758
PlanInstructionType type,
58-
std::string profile = "DEFAULT",
59+
std::string profile = DEFAULT_PROFILE_KEY,
5960
ManipulatorInfo manipulator_info = ManipulatorInfo());
6061

6162
void setWaypoint(Waypoint waypoint);
@@ -100,7 +101,7 @@ class PlanInstruction
100101
Waypoint waypoint_;
101102

102103
/** @brief The profile used for this plan instruction */
103-
std::string profile_{ "DEFAULT" };
104+
std::string profile_{ DEFAULT_PROFILE_KEY };
104105

105106
/** @brief Contains information about the manipulator associated with this instruction*/
106107
ManipulatorInfo manipulator_info_;

tesseract/tesseract_planning/tesseract_command_language/src/composite_instruction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void CompositeInstruction::setDescription(const std::string& description) { desc
5252

5353
void CompositeInstruction::setProfile(const std::string& profile)
5454
{
55-
profile_ = (profile.empty()) ? "DEFAULT" : profile;
55+
profile_ = (profile.empty()) ? DEFAULT_PROFILE_KEY : profile;
5656
}
5757
const std::string& CompositeInstruction::getProfile() const { return profile_; }
5858

tesseract/tesseract_planning/tesseract_command_language/src/move_instruction.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ void MoveInstruction::setManipulatorInfo(ManipulatorInfo info) { manipulator_inf
5858
const ManipulatorInfo& MoveInstruction::getManipulatorInfo() const { return manipulator_info_; }
5959
ManipulatorInfo& MoveInstruction::getManipulatorInfo() { return manipulator_info_; }
6060

61-
void MoveInstruction::setProfile(const std::string& profile) { profile_ = (profile.empty()) ? "DEFAULT" : profile; }
61+
void MoveInstruction::setProfile(const std::string& profile)
62+
{
63+
profile_ = (profile.empty()) ? DEFAULT_PROFILE_KEY : profile;
64+
}
6265
const std::string& MoveInstruction::getProfile() const { return profile_; }
6366

6467
int MoveInstruction::getType() const { return type_; }

tesseract/tesseract_planning/tesseract_command_language/src/plan_instruction.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ void PlanInstruction::setManipulatorInfo(ManipulatorInfo info) { manipulator_inf
4949
const ManipulatorInfo& PlanInstruction::getManipulatorInfo() const { return manipulator_info_; }
5050
ManipulatorInfo& PlanInstruction::getManipulatorInfo() { return manipulator_info_; }
5151

52-
void PlanInstruction::setProfile(const std::string& profile) { profile_ = (profile.empty()) ? "DEFAULT" : profile; }
52+
void PlanInstruction::setProfile(const std::string& profile)
53+
{
54+
profile_ = (profile.empty()) ? DEFAULT_PROFILE_KEY : profile;
55+
}
5356
const std::string& PlanInstruction::getProfile() const { return profile_; }
5457

5558
int PlanInstruction::getType() const { return type_; }

tesseract/tesseract_planning/tesseract_command_language/test/serialize_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ CompositeInstruction getProgram()
101101
transition_from_start.setDescription("transition_from_start");
102102
transition_from_start.push_back(plan_f1);
103103

104-
CompositeInstruction transitions("DEFAULT", CompositeInstructionOrder::UNORDERED);
104+
CompositeInstruction transitions(DEFAULT_PROFILE_KEY, CompositeInstructionOrder::UNORDERED);
105105
transitions.setDescription("transitions");
106106
transitions.push_back(transition_from_start);
107107
transitions.push_back(transition_from_end);
@@ -130,7 +130,7 @@ CompositeInstruction getProgram()
130130
transition_from_start.setDescription("transition_from_start");
131131
transition_from_start.push_back(plan_f1);
132132

133-
CompositeInstruction transitions("DEFAULT", CompositeInstructionOrder::UNORDERED);
133+
CompositeInstruction transitions(DEFAULT_PROFILE_KEY, CompositeInstructionOrder::UNORDERED);
134134
transitions.setDescription("transitions");
135135
transitions.push_back(transition_from_start);
136136
transitions.push_back(transition_from_end);

tesseract/tesseract_planning/tesseract_motion_planners/include/tesseract_motion_planners/descartes/impl/descartes_motion_planner.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
4545
TESSERACT_COMMON_IGNORE_WARNINGS_POP
4646

4747
#include <tesseract_motion_planners/descartes/descartes_motion_planner.h>
48+
#include <tesseract_motion_planners/descartes/profile/descartes_default_plan_profile.h>
4849
#include <tesseract_motion_planners/core/utils.h>
4950

5051
#include <tesseract_command_language/command_language.h>
@@ -56,6 +57,7 @@ template <typename FloatType>
5657
DescartesMotionPlanner<FloatType>::DescartesMotionPlanner(std::string name)
5758
: MotionPlanner(name), status_category_(std::make_shared<const DescartesMotionPlannerStatusCategory>(name))
5859
{
60+
plan_profiles[DEFAULT_PROFILE_KEY] = std::make_shared<DescartesDefaultPlanProfile<FloatType>>();
5961
}
6062

6163
template <typename FloatType>

0 commit comments

Comments
 (0)