mirror of
https://github.com/moveit/moveit_task_constructor.git
synced 2025-11-04 14:49:57 +08:00
keep RobotModelLoader around
Otherwise the robot_model_ does not remain valid
This commit is contained in:
parent
a745f55ab7
commit
1a4f6c0e57
@ -51,6 +51,10 @@ namespace moveit { namespace core {
|
||||
MOVEIT_CLASS_FORWARD(RobotState)
|
||||
}}
|
||||
|
||||
namespace robot_model_loader {
|
||||
MOVEIT_CLASS_FORWARD(RobotModelLoader)
|
||||
}
|
||||
|
||||
namespace moveit { namespace task_constructor {
|
||||
|
||||
MOVEIT_CLASS_FORWARD(Stage)
|
||||
@ -140,6 +144,7 @@ protected:
|
||||
|
||||
private:
|
||||
std::string id_;
|
||||
robot_model_loader::RobotModelLoaderPtr robot_model_loader_;
|
||||
moveit::core::RobotModelConstPtr robot_model_;
|
||||
bool preempt_requested_;
|
||||
|
||||
|
||||
@ -109,8 +109,8 @@ void Task::setRobotModel(const core::RobotModelConstPtr& robot_model)
|
||||
}
|
||||
|
||||
void Task::loadRobotModel(const std::string& robot_description) {
|
||||
robot_model_loader::RobotModelLoader rml(robot_description);
|
||||
setRobotModel(rml.getModel());
|
||||
robot_model_loader_ = std::make_shared<robot_model_loader::RobotModelLoader>(robot_description);
|
||||
setRobotModel(robot_model_loader_->getModel());
|
||||
if (!robot_model_)
|
||||
throw Exception("Task failed to construct RobotModel");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user