// -*- C++ -*-
/*!
 * @file  CollisionDetection.h
 * @brief compornent
 * @date  $Date$
 *
 * $Id$
 */

#ifndef OBSTACLEAVOIDANCE_H
#define OBSTACLEAVOIDANCE_H

#include <rtm/Manager.h>
#include <rtm/DataFlowComponentBase.h>
#include <rtm/CorbaPort.h>
#include <rtm/DataInPort.h>
#include <rtm/DataOutPort.h>
#include <rtm/idl/BasicDataTypeSkel.h>


#include "intellirobotStub.h"


// </rtc-template>

using namespace RTC;

class CollisionDetection
  : public RTC::DataFlowComponentBase
{
 public:
  CollisionDetection(RTC::Manager* manager);
  ~CollisionDetection();
  virtual RTC::ReturnCode_t onInitialize();
  virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);

 protected:
  // Configuration variable declaration
  // <rtc-template block="config_declare">
  double m_body_radius;
  double m_space;
  double m_acceleration;
  double m_interval_length;

  // DataInPort declaration
  // <rtc-template block="inport_declare">
  IIS::TimedVelocity2D m_in_vel;
  InPort<IIS::TimedVelocity2D> m_in_velIn;
  TimedObstacles m_obstacles;
  InPort<TimedObstacles> m_obstaclesIn;
  
  // DataOutPort declaration
  // <rtc-template block="outport_declare">
  IIS::TimedVelocity2D m_out_vel;
  OutPort<IIS::TimedVelocity2D> m_out_velOut;
  
 private:
  int dummy;
  double lastSpeed, lastJog;
};


extern "C"
{
  void CollisionDetectionInit(RTC::Manager* manager);
};

#endif // OBSTACLEAVOIDANCE_H
