bool DXLJointInterface::init()
{
	if(!dxl_initialize(0, BAUD_NUM))
		return false;

	dxl_write_byte(200, 24, 1);
// 	sleep(1);

// 	dxl_ping(id());
// 	if(dxl_get_result() != COMM_RXSUCCESS)
// 	{
// 		ROS_ERROR("Could not find dynamixel with ID %d", id());
// 		return false;
// 	}

	dxl_write_word(id(), REG_TORQUE_LIMIT, 1023);
	dxl_write_word(id(), REG_CW_ANGLE_LIMIT, 0);

	setControlType(CT_POSITION);
	dxl_write_word(id(), REG_TORQUE_ENABLE, 1);

	dxl_write_byte(id(), REG_P_GAIN, 2);
	dxl_write_byte(id(), REG_I_GAIN, 0);
	dxl_write_byte(id(), REG_D_GAIN, 0);

	return true;
}
// Process incoming controller key event.
void synthv1widget_control::setControlKey ( const synthv1_controls::Key& key )
{
	setControlType(key.type());
	setControlParam(key.param);

	m_ui.ControlChannelSpinBox->setValue(key.channel());

	QPushButton *pResetButton
		= m_ui.DialogButtonBox->button(QDialogButtonBox::Reset);
	if (pResetButton && m_pControls)
		pResetButton->setEnabled(m_pControls->find_control(key) >= 0);
}
  void initialize()
  {
    char input[30];
    isGroupInitialized = false;

    std::cout << "Enter the |type| of models you want to control: 'door' or 'elevator'" << std::endl;

    readLineInput(input);
    while (!setControlType(input))
    {
      std::cout << "Invalid type. Options: 'door' or 'elevator'" << std::endl;
      readLineInput(input);
    }

    setupCallTemplates();
  }
HeatExchangerFluidToFluid::HeatExchangerFluidToFluid(const Model& model)
  : WaterToWaterComponent(HeatExchangerFluidToFluid::iddObjectType(),model)
{
  OS_ASSERT(getImpl<detail::HeatExchangerFluidToFluid_Impl>());

  autosizeLoopDemandSideDesignFlowRate();
  autosizeLoopSupplySideDesignFlowRate();
  setHeatExchangeModelType("Ideal");
  autosizeHeatExchangerUFactorTimesAreaValue();
  setControlType("UncontrolledOn");
  setMinimumTemperatureDifferencetoActivateHeatExchanger(0.01);
  setHeatTransferMeteringEndUseType("LoopToLoop");
  setComponentOverrideCoolingControlTemperatureMode("Loop");
  setSizingFactor(1.0);
  setOperationMinimumTemperatureLimit(0.0);
  setOperationMaximumTemperatureLimit(100.0);
}
  void start()
  {
    initialize();
    char input[30];

    while (rosNode.ok())
    {
      readLineInput(input);

      // check if the type was toggled (between 'door' & 'elevator')
      if (setControlType(input))
      {
        continue;
      }

      callServices(input);
    }
  }
	Drive::Drive()
		:Component::Component(), m_leftMotor(1, false), m_rightMotor(2, true), m_robotDrive(new RobotDrive(&m_leftMotor, &m_rightMotor)), leftJoystick(1), rightJoystick(2)
	{
		setControlType(kArcade);	
	}