@@ -35,13 +35,14 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP
35
35
36
36
#include < tesseract_environment/core/types.h>
37
37
#include < tesseract_environment/core/commands.h>
38
+ #include < tesseract_environment/core/state_solver.h>
39
+ #include < tesseract_environment/core/manipulator_manager.h>
38
40
#include < tesseract_collision/core/discrete_contact_manager.h>
39
41
#include < tesseract_collision/core/discrete_contact_manager_factory.h>
40
42
#include < tesseract_collision/core/continuous_contact_manager.h>
41
43
#include < tesseract_collision/core/continuous_contact_manager_factory.h>
42
44
#include < tesseract_scene_graph/graph.h>
43
- #include < tesseract_environment/core/state_solver.h>
44
- #include < tesseract_environment/manipulator_manager/manipulator_manager.h>
45
+ #include < tesseract_scene_graph/utils.h>
45
46
46
47
namespace tesseract_environment
47
48
{
@@ -70,7 +71,7 @@ class Environment
70
71
*/
71
72
template <typename S>
72
73
bool init (const tesseract_scene_graph::SceneGraph& scene_graph,
73
- tesseract_scene_graph::SRDFModel::Ptr srdf_model = nullptr )
74
+ const tesseract_scene_graph::SRDFModel::ConstPtr& srdf_model = nullptr )
74
75
{
75
76
initialized_ = false ;
76
77
revision_ = 0 ;
@@ -88,6 +89,9 @@ class Environment
88
89
return false ;
89
90
}
90
91
92
+ if (srdf_model != nullptr )
93
+ processSRDFAllowedCollisions (*scene_graph_, *srdf_model);
94
+
91
95
// Add this to the command history. This should always the the first thing in the command history
92
96
++revision_;
93
97
commands_.push_back (std::make_shared<AddSceneGraphCommand>(scene_graph, nullptr , " " ));
@@ -111,15 +115,22 @@ class Environment
111
115
return false ;
112
116
}
113
117
118
+ manipulator_manager_ = std::make_shared<ManipulatorManager>();
114
119
if (!srdf_model)
115
120
{
116
121
CONSOLE_BRIDGE_logDebug (" Environment is being initialized without an SRDF Model. Manipulators will not be "
117
122
" registered" );
118
- srdf_model = std::make_shared<tesseract_scene_graph::SRDFModel>();
119
- srdf_model->getName () = scene_graph_->getName ();
123
+ manipulator_manager_->init (scene_graph_, tesseract_scene_graph::KinematicsInformation ());
124
+ }
125
+ else
126
+ {
127
+ manipulator_manager_->init (scene_graph_, srdf_model->getKinematicsInformation ());
120
128
}
121
- manipulator_manager_ = std::make_shared<ManipulatorManager>();
122
- manipulator_manager_->init (scene_graph_, srdf_model);
129
+
130
+ // Add this to the command history.
131
+ ++revision_;
132
+ commands_.push_back (
133
+ std::make_shared<AddKinematicsInformationCommand>(manipulator_manager_->getKinematicsInformation ()));
123
134
124
135
is_contact_allowed_fn_ = std::bind (&tesseract_scene_graph::SceneGraph::isCollisionAllowed,
125
136
scene_graph_,
@@ -175,13 +186,13 @@ class Environment
175
186
* @brief Get the current revision number
176
187
* @return Revision number
177
188
*/
178
- int getRevision () const { return revision_; }
189
+ int getRevision () const ;
179
190
180
191
/* *
181
192
* @brief Get Environment command history post initialization
182
193
* @return List of commands
183
194
*/
184
- const Commands& getCommandHistory () const { return commands_; }
195
+ const Commands& getCommandHistory () const ;
185
196
186
197
/* *
187
198
* @brief Applies the commands to the environment
@@ -211,25 +222,44 @@ class Environment
211
222
* @brief Check if environment has been initialized
212
223
* @return True if initialized otherwise false
213
224
*/
214
- virtual bool checkInitialized () const { return initialized_; }
225
+ virtual bool checkInitialized () const ;
215
226
216
227
/* *
217
228
* @brief Get the Scene Graph
218
229
* @return SceneGraphConstPtr
219
230
*/
220
- virtual const tesseract_scene_graph::SceneGraph::ConstPtr& getSceneGraph () const { return scene_graph_const_; }
231
+ virtual const tesseract_scene_graph::SceneGraph::ConstPtr& getSceneGraph () const ;
221
232
222
- ManipulatorManager::Ptr getManipulatorManager () { return manipulator_manager_; }
223
- ManipulatorManager::ConstPtr getManipulatorManager () const { return manipulator_manager_; }
233
+ /* *
234
+ * @brief Get the manipulator manager
235
+ * @todo This should go away and should expose methods for adding and removing objects from the manager and storing
236
+ * as commands
237
+ * @warning Changes made to the manager are not capture in the command history.
238
+ * @return The manipulator manager
239
+ */
240
+ virtual ManipulatorManager::Ptr getManipulatorManager ();
241
+
242
+ /* *
243
+ * @brief Get the manipulator manager const
244
+ * @return The manipulator manager const
245
+ */
246
+ virtual ManipulatorManager::ConstPtr getManipulatorManager () const ;
247
+
248
+ /* *
249
+ * @brief Add kinematics information to the environment
250
+ * @param kin_info The kinematics information
251
+ * @return true if successful, otherwise false
252
+ */
253
+ virtual bool addKinematicsInformation (const tesseract_scene_graph::KinematicsInformation& kin_info);
224
254
225
255
/* * @brief Give the environment a name */
226
- virtual void setName (const std::string& name) { scene_graph_-> setName (name); }
256
+ virtual void setName (const std::string& name);
227
257
228
258
/* * @brief Get the name of the environment
229
259
*
230
260
* This may be empty, if so check urdf name
231
261
*/
232
- virtual const std::string& getName () const { return scene_graph_-> getName (); }
262
+ virtual const std::string& getName () const ;
233
263
234
264
/* *
235
265
* @brief Set the current state of the environment
@@ -258,7 +288,7 @@ class Environment
258
288
const Eigen::Ref<const Eigen::VectorXd>& joint_values) const ;
259
289
260
290
/* * @brief Get the current state of the environment */
261
- virtual EnvState::ConstPtr getCurrentState () const { return current_state_; }
291
+ virtual EnvState::ConstPtr getCurrentState () const ;
262
292
263
293
/* *
264
294
* @brief Adds a link to the environment
@@ -531,12 +561,7 @@ class Environment
531
561
virtual bool setActiveDiscreteContactManager (const std::string& name);
532
562
533
563
/* * @brief Get a copy of the environments active discrete contact manager */
534
- virtual tesseract_collision::DiscreteContactManager::Ptr getDiscreteContactManager () const
535
- {
536
- if (!discrete_manager_)
537
- return nullptr ;
538
- return discrete_manager_->clone ();
539
- }
564
+ virtual tesseract_collision::DiscreteContactManager::Ptr getDiscreteContactManager () const ;
540
565
541
566
/* * @brief Get a copy of the environments available discrete contact manager by name */
542
567
virtual tesseract_collision::DiscreteContactManager::Ptr getDiscreteContactManager (const std::string& name) const ;
@@ -549,12 +574,7 @@ class Environment
549
574
virtual bool setActiveContinuousContactManager (const std::string& name);
550
575
551
576
/* * @brief Get a copy of the environments active continuous contact manager */
552
- virtual tesseract_collision::ContinuousContactManager::Ptr getContinuousContactManager () const
553
- {
554
- if (!continuous_manager_)
555
- return nullptr ;
556
- return continuous_manager_->clone ();
557
- }
577
+ virtual tesseract_collision::ContinuousContactManager::Ptr getContinuousContactManager () const ;
558
578
559
579
/* * @brief Get a copy of the environments available continuous contact manager by name */
560
580
virtual tesseract_collision::ContinuousContactManager::Ptr getContinuousContactManager (const std::string& name) const ;
@@ -566,10 +586,7 @@ class Environment
566
586
* in the environment.
567
587
*/
568
588
bool registerDiscreteContactManager (const std::string& name,
569
- tesseract_collision::DiscreteContactManagerFactory::CreateMethod create_function)
570
- {
571
- return discrete_factory_.registar (name, std::move (create_function));
572
- }
589
+ tesseract_collision::DiscreteContactManagerFactory::CreateMethod create_function);
573
590
574
591
/* *
575
592
* @brief Set the discrete contact manager
@@ -579,10 +596,7 @@ class Environment
579
596
*/
580
597
bool
581
598
registerContinuousContactManager (const std::string& name,
582
- tesseract_collision::ContinuousContactManagerFactory::CreateMethod create_function)
583
- {
584
- return continuous_factory_.registar (name, std::move (create_function));
585
- }
599
+ tesseract_collision::ContinuousContactManagerFactory::CreateMethod create_function);
586
600
587
601
/* * @brief Merge a graph into the current environment
588
602
* @param scene_graph Const ref to the graph to be merged (said graph will be copied)
0 commit comments