Skip to content
Snippets Groups Projects
Commit d3bff7a4 authored by Irene Garcia Camacho's avatar Irene Garcia Camacho
Browse files

Added function to play motion module to use new loaded motion by its name

parent 98bc6139
No related branches found
No related tags found
No related merge requests found
......@@ -61,6 +61,7 @@ class CPlayMotionModule : public CModule<play_motion_module::PlayMotionModuleCon
public:
CPlayMotionModule(const std::string &name,const std::string &name_space=std::string(""));
void execute_motion(play_motion_ids motion_id);
void execute_motion(std::string motion_name);
void stop(void);
bool is_finished(void);
play_motion_module_status_t get_status(void);
......
......@@ -165,6 +165,27 @@ void CPlayMotionModule::execute_motion(play_motion_ids motion_id)
}
}
void CPlayMotionModule::execute_motion(std::string motion_name)
{
std::string motion;
if(this->is_finished())
{
if(this->module_nh.getParam("/play_motion/motions/" + motion_name + "/meta/name", motion)) //If motion exists
{
this->goal.motion_name=motion_name;
this->goal.skip_planning=false;
this->goal.priority=0;
this->new_motion=true;
}
else
{
ROS_WARN("CPlayMotionModule: Motion name does not exist");
this->status=PLAY_MOTION_MODULE_INVALID_ID;
}
}
}
void CPlayMotionModule::stop(void)
{
if(this->state!=PLAY_MOTION_MODULE_IDLE)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment