示例#1
0
int main() {
  // [x, y, psi, v]
  Eigen::VectorXd state(4);
  // [delta, v]
  Eigen::VectorXd actuators(2);

  state << 0, 0, deg2rad(45), 1;
  actuators << deg2rad(5), 1;

  // should be [0.212132, 0.212132, 0.798488, 1.3]
  auto next_state = globalKinematic(state, actuators, 0.3);

  std::cout << next_state << std::endl;
}
QTM_BEGIN_NAMESPACE

/*!
    \class QFeedbackActuator
    \brief The QFeedbackActuator class describes actuators for tactile feedback.
    \inmodule QtFeedback
    \since 1.1

    An actuator knows how to play a \l{QFeedbackEffect}{tactile
    effect}. The class gives access to a specified actuator.

    An actuator can be used to play \l{QFeedbackHapticsEffect}s using
    \l{QFeedbackHapticsEffect::}{setActuator()}. Usually, you will not
    have to set an actuator directly on a QFeedbackHapticsEffect.
    QFeedbackHapticsEffect and QFeedbackFileEffect uses an appropriate
    actuator by default. However, you can query which actuators
    are available with actuators().

    \code
     QFeedbackActuator actuator; // default system actuator
     QList<QFeedbackActuator> actuators = QFeedbackActuator::actuators();
     foreach (const QFeedbackActuator& temp, actuators) {
         if (temp.name() == "ExampleActuatorName") {
             actuator = temp;
         }
     }
    \endcode

    The QFeedbackActuator class gives access to information about the
    actuator it represents. You can query if the actuator \l{isEnabled()}{is enabled}
    and if it \l{isValid()}{is valid }. Whether an actuator is ready to play an
    effect can be queried by checking the actuator's state(). The
    \l{QFeedbackActuator::}{State} enum describes the states and
    actuator can have. You can also get a human readable name for the actuator with the
    name() function.

    \sa QFeedbackHapticsEffect QFeedbackFileEffect QFeedbackEffect
*/

/*!
    \enum QFeedbackActuator::Capability

    \value Envelope Capability defining the wave type with attack/fade times and levels.
    \value Period   Capability defining that the device can play periodic effects.
*/

/*!
    \enum QFeedbackActuator::State

    \value Busy    The actuator is busy.
    \value Ready   The actuator is ready to play an effect.
    \value Unknown The actuator is in an unknown state.
*/


/*!
    Constructs a QFeedbackActuator, passing \a parent to the QObject constructor.

    The object will represent the default actuator on the system.
    If there are no actuators attached to the system, isValid() will return false.

    \sa isValid()
*/
QFeedbackActuator::QFeedbackActuator(QObject *parent) : QObject(parent), m_id(-1)
{
    QList<QFeedbackActuator*> list = actuators();
    if  (!list.isEmpty()) {
        QFeedbackActuator* defaultActuator = list.first();
        m_id = defaultActuator->id();
    }
}