1  | 
     | 
     | 
    /*  | 
    
    
    2  | 
     | 
     | 
     * Copyright 2010-2017,  | 
    
    
    3  | 
     | 
     | 
     * Florent Lamiraux, Rohan Budhiraja  | 
    
    
    4  | 
     | 
     | 
     *  | 
    
    
    5  | 
     | 
     | 
     * CNRS/AIST  | 
    
    
    6  | 
     | 
     | 
     *  | 
    
    
    7  | 
     | 
     | 
     */  | 
    
    
    8  | 
     | 
     | 
     | 
    
    
    9  | 
     | 
     | 
    #ifndef STC_COMMAND_HH  | 
    
    
    10  | 
     | 
     | 
    #define STC_COMMAND_HH  | 
    
    
    11  | 
     | 
     | 
     | 
    
    
    12  | 
     | 
     | 
    #include <dynamic-graph/command-getter.h>  | 
    
    
    13  | 
     | 
     | 
    #include <dynamic-graph/command-setter.h>  | 
    
    
    14  | 
     | 
     | 
    #include <dynamic-graph/command.h>  | 
    
    
    15  | 
     | 
     | 
     | 
    
    
    16  | 
     | 
     | 
    #include <boost/assign/list_of.hpp>  | 
    
    
    17  | 
     | 
     | 
    #include <fstream>  | 
    
    
    18  | 
     | 
     | 
    #include <sot/torque_control/joint-trajectory-generator.hh>  | 
    
    
    19  | 
     | 
     | 
     | 
    
    
    20  | 
     | 
     | 
    namespace dynamicgraph { | 
    
    
    21  | 
     | 
     | 
    namespace sot { | 
    
    
    22  | 
     | 
     | 
    namespace command { | 
    
    
    23  | 
     | 
     | 
    using ::dynamicgraph::command::Command;  | 
    
    
    24  | 
     | 
     | 
    using ::dynamicgraph::command::Value;  | 
    
    
    25  | 
     | 
     | 
    using ::dynamicgraph::sot::torque_control::JointTrajectoryGenerator;  | 
    
    
    26  | 
     | 
     | 
    // Command DisplayModel  | 
    
    
    27  | 
     | 
     | 
    class IsTrajectoryEnded : public Command { | 
    
    
    28  | 
     | 
     | 
     public:  | 
    
    
    29  | 
     | 
     | 
      virtual ~IsTrajectoryEnded() { | 
    
    
    30  | 
     | 
     | 
        sotDEBUGIN(15);  | 
    
    
    31  | 
     | 
     | 
        sotDEBUGOUT(15);  | 
    
    
    32  | 
     | 
     | 
      }  | 
    
    
    33  | 
     | 
     | 
      /// Create command and store it in Entity  | 
    
    
    34  | 
     | 
     | 
      /// \param entity instance of Entity owning this command  | 
    
    
    35  | 
     | 
     | 
      /// \param docstring documentation of the command  | 
    
    
    36  | 
     | 
     | 
      IsTrajectoryEnded(JointTrajectoryGenerator& entity,  | 
    
    
    37  | 
     | 
     | 
                        const std::string& docstring)  | 
    
    
    38  | 
     | 
     | 
          : Command(entity, std::vector<Value::Type>(), docstring) {} | 
    
    
    39  | 
     | 
     | 
      virtual Value doExecute() { | 
    
    
    40  | 
     | 
     | 
        JointTrajectoryGenerator& jtg =  | 
    
    
    41  | 
     | 
     | 
            static_cast<JointTrajectoryGenerator&>(owner());  | 
    
    
    42  | 
     | 
     | 
        bool output = jtg.isTrajectoryEnded();  | 
    
    
    43  | 
     | 
     | 
        return Value(output);  | 
    
    
    44  | 
     | 
     | 
      }  | 
    
    
    45  | 
     | 
     | 
    };  // class IsTrajectoryEnded  | 
    
    
    46  | 
     | 
     | 
     | 
    
    
    47  | 
     | 
     | 
    }  // namespace command  | 
    
    
    48  | 
     | 
     | 
    } /* namespace sot */  | 
    
    
    49  | 
     | 
     | 
    } /* namespace dynamicgraph */  | 
    
    
    50  | 
     | 
     | 
     | 
    
    
    51  | 
     | 
     | 
    #endif  // STC_COMMAND_HH  |