RTC::ReturnCode_t Kinect_JointPoint::onInitialize()
{
  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  addInPort("Kinect_skelton", m_Kinect_skeltonIn);
  
  // Set OutPort buffer
  addOutPort("out1", m_out1Out);
  addOutPort("out2", m_out2Out);
  
  // Set service provider to Ports
  
  // Set service consumers to Ports
  
  // Set CORBA Service Ports
  
  // </rtc-template>

  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  bindParameter("mode_out1", m_mode_out1, "7");
  bindParameter("mode_out2", m_mode_out2, "11");
  bindParameter("CoordinateSystem", m_CoordinateSystem, "0");
  bindParameter("out1_xy_inverse", m_out1_xy_inverse, "1");
  bindParameter("out2_xy_inverse", m_out2_xy_inverse, "1");

  std::cout<<"Kinect_JointPointComp.exe : Initialize OK";
  // </rtc-template>
  return RTC::RTC_OK;
}
Example #2
0
RTC::ReturnCode_t ADC_MCP3208::onInitialize()
{
  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  
  // Set OutPort buffer
  
  // Set service provider to Ports
  
  // Set service consumers to Ports
  
  // Set CORBA Service Ports
  
  // </rtc-template>

  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  bindParameter("cs_pin", m_cs_pin, "4");
  bindParameter("channel", m_channel, "0");
  bindParameter("voltage", m_voltage, "5");
  // </rtc-template>
  _smf = new i2c_smf("/tmp/edisonspismf");

	for(int i=0;i < 8;i++)
	{
		adc_ports.push_back(new ADC_MCP3208Comp(this,i));
	}
  return RTC::RTC_OK;
}
bool TaskRenameCharacter::RenameCharacterQuery::bindParameters()
{
	if (!bindParameter(cluster_id)) return false;
	if (!bindParameter(character_id)) return false;
	if (!bindParameter(new_name)) return false;
	return true;
}
Example #4
0
RTC::ReturnCode_t CaptureController::onInitialize()
{
  std::cout << m_profile.instance_name << ": onInitialize()" << std::endl;
  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  bindParameter("frameRate", m_frameRate, "1");
  bindParameter("initialMode", m_initialMode, "sleep");
  
  // </rtc-template>

  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  addInPort("imageIn", m_imageIn);

  // Set OutPort buffer
  addOutPort("imageOut", m_imageOut);
  
  // Set service provider to Ports
  m_CameraCaptureServicePort.registerProvider("service0", "CameraCaptureService", m_CameraCaptureService);
  
  // Set service consumers to Ports
  
  // Set CORBA Service Ports
  addPort(m_CameraCaptureServicePort);
  
  // </rtc-template>

  RTC::Properties& prop = getProperties();

  return RTC::RTC_OK;
}
RTC::ReturnCode_t RaspberryPiMouseController_DistanceSensor::onInitialize()
{
  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  addInPort("target_velocity_in", m_target_velocity_inIn);
  addInPort("distance_sensor", m_distance_sensorIn);
  
  // Set OutPort buffer
  addOutPort("target_velocity_out", m_target_velocity_outOut);
  
  // Set service provider to Ports
  
  // Set service consumers to Ports
  
  // Set CORBA Service Ports
  
  // </rtc-template>

  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  bindParameter("sensor_limit", m_sensor_limit, "10");
  bindParameter("rotational_speed", m_rotational_speed, "1.6");
  bindParameter("stop_velocity", m_stop_velocity, "0.01");
  // </rtc-template>
  
  return RTC::RTC_OK;
}
Example #6
0
RTC::ReturnCode_t CameraComp::onInitialize()
{
	// Registration: InPort/OutPort/Service
	// <rtc-template block="registration">
	// Set InPort buffers

	// Set OutPort buffer
	addOutPort("out", m_outOut);

	// Set service provider to Ports

	// Set service consumers to Ports

	// Set CORBA Service Ports

	// </rtc-template>

	// <rtc-template block="bind_config">
	// Bind variables and configuration variable
	bindParameter("Width", m_width, "640");
	bindParameter("Height", m_height, "480");
	// </rtc-template>

	return RTC::RTC_OK;
}
RTC::ReturnCode_t PortAudioInput::onInitialize()
{
  RTC_DEBUG(("onInitialize start"));
  RTC_INFO(("PortAudioInput : Audio input component using portaudio library"));
  RTC_INFO((" Copyright (C) 2010-2011 Yosuke Matsusaka and AIST-OpenHRI development team"));
  RTC_INFO((" Version %s", VERSION));

  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  addInPort("GainDataIn", m_in_dataIn);
  m_in_dataIn.setDescription(_("Gain."));

  /* setting datalistener event */
  m_in_dataIn.addConnectorDataListener(ON_BUFFER_WRITE, new PortAudioInputDataListener("ON_BUFFER_WRITE", this), false);

  // Set OutPort buffer
  registerOutPort("AudioDataOut", m_out_dataOut);
  m_out_dataOut.setDescription(_("Audio data in packet."));

  // Set service provider to Ports

  // Set service consumers to Ports

  // Set CORBA Service Ports

  // </rtc-template>
  bindParameter("OutputSampleRate", m_samplerate, "16000");
  bindParameter("OutputSampleByte", m_formatstr, "int16");
  bindParameter("OutputChannelNumbers", m_channels, "1");

  RTC_DEBUG(("onInitialize finish"));
  return RTC::RTC_OK;
}
RTC::ReturnCode_t PathPlanner_MRPT::onInitialize()
{
  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  
  // Set OutPort buffer
  
  // Set service provider to Ports
  m_pathPlannerPort.registerProvider("PathPlanner", "RTC::PathPlanner", m_pathPlanner);
  
  // Set service consumers to Ports
  
  // Set CORBA Service Ports
  addPort(m_pathPlannerPort);
  
  // </rtc-template>

  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  bindParameter("debug", m_debug, "0");
  bindParameter("RobotRadius", m_robotRadius, "0.35");
  bindParameter("maxSearchPathLength", m_maxSearchPathLength, "-1");
  // </rtc-template>
  
  m_pathPlanner.setConfig(m_robotRadius, m_maxSearchPathLength);

  return RTC::RTC_OK;
}
Example #9
0
RTC::ReturnCode_t Relay::onInitialize()
{
  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  
  // Set OutPort buffer
  
  // Set service provider to Ports
  
  // Set service consumers to Ports
  
  // Set CORBA Service Ports
  
  // </rtc-template>

  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  bindParameter("dataType", m_dataType, "TimedDouble");
  bindParameter("switchOnPoint", m_switchOnPoint, "1");
  bindParameter("switchOffPoint", m_switchOffPoint, "-1");
  bindParameter("outputWhenOn", m_outputWhenOn, "1");
  bindParameter("outputWhenOff", m_outputWhenOff, "-1");
  // </rtc-template>
  configUpdate();
  this->addConfigurationSetListener(ON_SET_CONFIG_SET, new DynamicPortConfigUpdateParam(this));

  
  return RTC::RTC_OK;
}
RTC::ReturnCode_t ConvertImage::onInitialize()
{
  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  addInPort("imageIn", m_imageInIn);
  
  // Set OutPort buffer
  addOutPort("imageOut", m_imageOutOut);
  
  // Set service provider to Ports
  
  // Set service consumers to Ports
  
  // Set CORBA Service Ports
  
  // </rtc-template>

  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  bindParameter("string_encode", m_string_encode, "off");
  bindParameter("int_encode_quality", m_int_encode_quality, "75");
  
  // </rtc-template>
  return RTC::RTC_OK;
}
Example #11
0
RTC::ReturnCode_t QController::onInitialize()
{
  coil::Properties& ref = getProperties();
  bindParameter("axisIds", m_axisIds, ref["conf.default.axisIds"].c_str());
  bindParameter("axisScales", m_axisScales, ref["conf.default.axisScales"].c_str());
  bindParameter("buttonIds", m_buttonIds, ref["conf.default.buttonIds"].c_str());

  // Set InPort buffers
  addInPort("buttons", m_buttonsIn);
  addInPort("axes", m_axesIn);
  addInPort("angles", m_anglesIn);
  addInPort("vels", m_velsIn);
  
  // Set OutPort buffer
  addOutPort("torque", m_torqueOut);
  addOutPort("lightF", m_lightFOut);
  addOutPort("lightB", m_lightBOut);

  // ポート初期化 //
  m_torque.data.length(10);
  for (size_t i=0; i<m_torque.data.length(); i++){
      m_torque.data[i] = 0;
  }
  m_lightF.data = m_lightB.data = true;

  for (int i=0; i<2; i++) m_qRef[i] = 0;
  return RTC::RTC_OK;
}
Example #12
0
RTC::ReturnCode_t JoyRTM2velROS::onInitialize()
{
  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  addInPort("joy_input", m_joyInputIn);
  
  // Set OutPort buffer
  
  // Set service provider to Ports
  
  // Set service consumers to Ports
  
  // Set CORBA Service Ports
  
  // </rtc-template>

  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  bindParameter("max_linear_velocity", m_max_linear_velocity, "0.2");
  bindParameter("max_angular_velocity", m_max_angular_velocity, "0.4");
  // </rtc-template>

  addRosOutPort("ros_velocity", m_rosVelOut);

  return RTC::RTC_OK;
}
Example #13
0
RTC::ReturnCode_t RateLimiter::onInitialize()
{
  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  
  // Set OutPort buffer
  
  // Set service provider to Ports
  
  // Set service consumers to Ports
  
  // Set CORBA Service Ports
  
  // </rtc-template>

  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  bindParameter("dataType", m_dataType, "TimedDouble");
  bindParameter("samplingTime", m_samplingTime, "0.01");
  bindParameter("realTime", m_realTime, "OFF");
  bindParameter("risingSlewRate", m_risingSlewRate, "1");
  bindParameter("fallingSlewRate", m_fallingSlewRate, "-1");
  // </rtc-template>
  configUpdate();
  this->addConfigurationSetListener(ON_SET_CONFIG_SET, new DynamicPortConfigUpdateParam(this));

  
  return RTC::RTC_OK;
}
Example #14
0
RTC::ReturnCode_t makePattern_v2::onInitialize()
{
  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  addInPort("val", m_valIn);
  
  // Set OutPort buffer
  addOutPort("pattern", m_patternOut);
  
  // Set service provider to Ports
  
  // Set service consumers to Ports
  
  // Set CORBA Service Ports
  
  // </rtc-template>

  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  bindParameter("num", m_num, "8");
  bindParameter("threshold", m_threshold, "0");
  
  // </rtc-template>
  return RTC::RTC_OK;
}
bool TaskGetAvatarList::GetCharactersQuery::bindParameters()
{
	if (!bindParameter(station_id)) return false;
	if (!bindParameter(cluster_group_id)) return false;

	return true;	
}
RTC::ReturnCode_t Point2DtoPose2D::onInitialize()
{
  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  addInPort("in", m_inIn);
  
  // Set OutPort buffer
  addOutPort("out", m_outOut);
  
  // Set service provider to Ports
  
  // Set service consumers to Ports
  
  // Set CORBA Service Ports
  
  // </rtc-template>

  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  bindParameter("mode", m_mode, "0");
  bindParameter("gain", m_gain, "1");
  
  // </rtc-template>
  return RTC::RTC_OK;
}
RTC::ReturnCode_t CoulombAndViscousFriction::onInitialize()
{
  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  
  // Set OutPort buffer
  
  // Set service provider to Ports
  
  // Set service consumers to Ports
  
  // Set CORBA Service Ports
  
  // </rtc-template>

  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  bindParameter("dataType", m_dataType, "TimedDouble");
  bindParameter("offset", m_offset, "0");
  bindParameter("gain", m_gain, "1");
  // </rtc-template>

  configUpdate();
  this->addConfigurationSetListener(ON_SET_CONFIG_SET, new DynamicPortConfigUpdateParam(this));
  
  return RTC::RTC_OK;
}
RTC::ReturnCode_t PresentationCommentTimer::onInitialize()
{
  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  addInPort("MeasurementTrigger", m_MeasurementTriggerIn);
  
  // Set OutPort buffer
  addOutPort("MeasuredTimeString", m_MeasuredTimeStringOut);
  
  // Set service provider to Ports
  
  // Set service consumers to Ports
  
  // Set CORBA Service Ports
  
  // </rtc-template>

  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  bindParameter("OutputType", m_OutputType, "split");
  bindParameter("PresentationTime", m_PresentationTime, "0.0");
  
  // </rtc-template>
  return RTC::RTC_OK;
}
bool TaskMoveToPlayer::MoveToPlayerQuery::bindParameters()
{
	if (!bindParameter(result)) return false;
	if (!bindParameter(oid)) return false;
	if (!bindParameter(player)) return false;
	
	return true;
}
bool DeleteCharacterCustomPersistStep::DeleteCharacterQuery::bindParameters()
{
	if (!bindParameter(result)) return false;
	if (!bindParameter(station_id)) return false;
	if (!bindParameter(character_id)) return false;
	if (!bindParameter(delete_minutes)) return false;
	return true;
}
Example #21
0
RTC::ReturnCode_t WavRecord::onInitialize()
{
  RTC_INFO(("WavRecord : Audio record component"));
  RTC_INFO((" Copyright (C) 2010-2011 Yosuke Matsusaka and AIST-OpenHRI development team"));
  RTC_INFO((" Version %s", VERSION));
  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  m_in_dataIn.addConnectorDataListener(ON_BUFFER_WRITE, new DataListener("ON_BUFFER_WRITE", this));
  m_in_dataIn.setDescription(_("Audio data input."));
  registerInPort("AudioDataIn", m_in_dataIn);

  // Set service provider to Ports

  // Set service consumers to Ports

  // Set CORBA Service Ports

  // </rtc-template>
  bindParameter("SampleRate", m_rate, "16000");
  bindParameter("ChannelNumbers", m_channels, "1");
  //bindParameter("FileName", m_filename, "");
#if defined(__linux)
	bindParameter("FileName", m_filename, "wavrecord-default.wav");
#ifdef SHARED_LIB
	Gtk::FileChooserDialog diag( "ファイル選択", Gtk::FILE_CHOOSER_ACTION_SAVE );
	// 開く、キャンセルボタン
	diag.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
	diag.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
	switch( diag.run() ){
	case Gtk::RESPONSE_OK:
	  strncpy(WaveFileName, (diag.get_filename()).c_str(), (diag.get_filename()).size());
	  break;
        case Gtk::RESPONSE_CANCEL:
	  strncpy(WaveFileName, m_filename.c_str(), m_filename.size());
	  break;
	}
	Gtk::MessageDialog( WaveFileName ).run();
#endif //SHARED_LIB
#elif defined(_WIN32)
	bindParameter("FileName", m_filename, "c:\\work\\wavrecord-default.wav");
#ifdef SHARED_LIB
	HWND hwnd = GetWindow( NULL, GW_OWNER );

	ZeroMemory(WaveFileName,MAX_PATH*2);
	strncpy(WaveFileName, m_filename.c_str(), m_filename.size());
	OpenDiaog(hwnd,"Wave Files(*.wav)\0*.wav\0All Files(*.*)\0*.*\0\0",
					WaveFileName,OFN_CREATEPROMPT | OFN_OVERWRITEPROMPT);
	            
#endif//SHARED_LIB
#endif//defined(_WIN32)

  RTC_INFO(("onInitialize finish"));

  is_active = false;

  return RTC::RTC_OK;
}
RTC::ReturnCode_t Sepia::onInitialize()
{
    // <rtc-template block="bind_config">
    // Bind variables and configuration variable
    bindParameter("image_hue",         m_nHue,         "22");
    bindParameter("image_Saturation",  m_nSaturation,  "90");

    // </rtc-template>
    return RTC::RTC_OK;
}
Example #23
0
RTC::ReturnCode_t PIDController::onInitialize()
{
  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  
  // Set OutPort buffer
  
  // Set service provider to Ports
  
  // Set service consumers to Ports
  
  // Set CORBA Service Ports
  
  // </rtc-template>

  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  bindParameter("dataType", m_dataType, "TimedDouble");
  bindParameter("samplingTime", m_samplingTime, "0.01");
  bindParameter("realTime", m_realTime, "OFF");
  bindParameter("proportional", m_proportional, "1");
  bindParameter("derivative", m_derivative, "0");
  bindParameter("integral", m_integral, "0");
  bindParameter("type", m_type, "P");
  bindParameter("alpha", m_alpha, "1");
  bindParameter("beta", m_beta, "0");
  // </rtc-template>
  configUpdate();
  this->addConfigurationSetListener(ON_SET_CONFIG_SET, new DynamicPortConfigUpdateParam(this));

  return RTC::RTC_OK;
}
RTC::ReturnCode_t ImageCalibration::onInitialize()
{
  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  bindParameter("board_w", m_board_w, "11");
  bindParameter("board_h", m_board_h, "8");
  bindParameter("camera_Height", m_camera_Height, "-20");
  
  // </rtc-template>
  return RTC::RTC_OK;
}
RTC::ReturnCode_t Scale::onInitialize()
{
  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  bindParameter("output_scale_x", m_scale_x,    "1.0");
  bindParameter("output_scale_y", m_scale_y,    "1.0");

  m_currentScaleX = 1.0;
  m_currentScaleY = 1.0;

  // </rtc-template>
  return RTC::RTC_OK;
}
Example #26
0
RTC::ReturnCode_t GamepadRTC::onInitialize()
{
  // Bind variables and configuration variable
  bindParameter("device", m_device, "/dev/input/js0");
  bindParameter("debugLevel", m_debugLevel, "0");

  // Set OutPort buffer
  addOutPort("axes", m_axesOut);
  addOutPort("buttons", m_buttonsOut);
  

  return RTC::RTC_OK;
}
Example #27
0
RTC::ReturnCode_t AverageFilter::onInitialize()
{
  //std::cout << m_profile.instance_name << ": onInitialize()" << std::endl;
  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  bindParameter("resolution", m_resolution, "0.01");
  bindParameter("windowSize", m_windowSize, "4");
  bindParameter("dilation", m_dilation, "0");
  
  // </rtc-template>

  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  addInPort("originalIn", m_originalIn);

  // Set OutPort buffer
  addOutPort("filteredOut", m_filteredOut);
  
  // Set service provider to Ports
  
  // Set service consumers to Ports
  
  // Set CORBA Service Ports
  
  // </rtc-template>

  RTC::Properties& prop = getProperties();

  m_filtered.height = 1;
  m_filtered.type = "xyz";
  m_filtered.fields.length(3);
  m_filtered.fields[0].name = "x";
  m_filtered.fields[0].offset = 0;
  m_filtered.fields[0].data_type = PointCloudTypes::FLOAT32;
  m_filtered.fields[0].count = 4;
  m_filtered.fields[1].name = "y";
  m_filtered.fields[1].offset = 4;
  m_filtered.fields[1].data_type = PointCloudTypes::FLOAT32;
  m_filtered.fields[1].count = 4;
  m_filtered.fields[2].name = "z";
  m_filtered.fields[2].offset = 8;
  m_filtered.fields[2].data_type = PointCloudTypes::FLOAT32;
  m_filtered.fields[2].count = 4;
  m_filtered.is_bigendian = false;
  m_filtered.point_step = 16;
  m_filtered.is_dense = true;

  return RTC::RTC_OK;
}
Example #28
0
RTC::ReturnCode_t WavPlayer::onInitialize()
{
  RTC_DEBUG(("onInitialize start"));
  RTC_INFO(("WavPlayer : Wave player component"));
  RTC_INFO((" Copyright (C) 2010-2011 Yosuke Matsusaka and AIST-OpenHRI development team"));
  RTC_INFO((" Version %s", VERSION));

  registerOutPort("AudioDataOut", m_out_dataOut);
  m_out_dataOut.setDescription(_("Audio data out packet."));

  bindParameter("OutputSampleRate", m_samplerate, "16000");
  bindParameter("ChannelNumbers", m_channels, "1");
#if defined(__linux)
	bindParameter("FileName", m_filename, "wavrecord-default.wav");
#ifdef SHARED_LIB
	Gtk::FileChooserDialog diag( "ファイル選択", Gtk::FILE_CHOOSER_ACTION_OPEN );
	// 開く、キャンセルボタン
	diag.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
	diag.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
	switch( diag.run() ){
	case Gtk::RESPONSE_OK:
	  strncpy(WaveFileName, (diag.get_filename()).c_str(), (diag.get_filename()).size());
	  break;
        case Gtk::RESPONSE_CANCEL:
	  strncpy(WaveFileName, m_filename.c_str(), m_filename.size());
	  break;
	}
	Gtk::MessageDialog( WaveFileName ).run();
#endif //SHARED_LIB
#elif defined(_WIN32)
	bindParameter("FileName", m_filename, "c:\\work\\wavrecord-default.wav");
#ifdef SHARED_LIB
	HWND hwnd = GetWindow( NULL, GW_OWNER );

	ZeroMemory(WaveFileName,MAX_PATH*2);
	strncpy(WaveFileName, m_filename.c_str(), m_filename.size());
	//printf("m_filename.c_str: %s\n", m_filename.c_str());
	//printf("m_filename.size: %d\n", m_filename.size());
	//printf("Wave File Name: %s\n", WaveFileName);
	if (OpenDiaog(hwnd,"Wave Files(*.wav)\0*.wav\0All Files(*.*)\0*.*\0\0",
					WaveFileName,OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY))
	            
	//MessageBox(hwnd,strcat(WaveFileName,"\nを選択しました。"),"情報",MB_OK);
#endif//SHARED_LIB
#endif//defined(_WIN32)

  RTC_DEBUG(("onInitialize finish"));
  RTC_INFO(("onInitialize finish"));
  return RTC::RTC_OK;
}
Example #29
0
RTC::ReturnCode_t ForwardKinematics::onInitialize()
{
  std::cerr << "[" << m_profile.instance_name << "] onInitialize()" << std::endl;
  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  coil::Properties& ref = getProperties();
  bindParameter("sensorAttachedLink", m_sensorAttachedLinkName, ref["conf.default.sensorAttachedLink"].c_str());
  
  // </rtc-template>

  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  addInPort("q", m_qIn);
  addInPort("sensorRpy", m_sensorRpyIn);
  addInPort("qRef", m_qRefIn);
  addInPort("basePosRef", m_basePosRefIn);
  addInPort("baseRpyRef", m_baseRpyRefIn);

  // Set OutPort buffer
  
  // Set service provider to Ports
  m_ForwardKinematicsServicePort.registerProvider("service0", "ForwardKinematicsService", m_service0);
  addPort(m_ForwardKinematicsServicePort);
  m_service0.setComp(this);
  
  // Set service consumers to Ports
  
  // Set CORBA Service Ports
  
  // </rtc-template>

  RTC::Properties& prop = getProperties();

  RTC::Manager& rtcManager = RTC::Manager::instance();
  std::string nameServer = rtcManager.getConfig()["corba.nameservers"];
  int comPos = nameServer.find(",");
  if (comPos < 0){
      comPos = nameServer.length();
  }
  nameServer = nameServer.substr(0, comPos);
  RTC::CorbaNaming naming(rtcManager.getORB(), nameServer.c_str());
  m_refBody = hrp::BodyPtr(new hrp::Body());
  if (!loadBodyFromModelLoader(m_refBody, prop["model"].c_str(), 
                               CosNaming::NamingContext::_duplicate(naming.getRootContext()))){
    std::cerr << "[" << m_profile.instance_name << "] failed to load model[" << prop["model"] << "]" << std::endl;
    return RTC::RTC_ERROR;
  }
  m_actBody = hrp::BodyPtr(new hrp::Body());
  if (!loadBodyFromModelLoader(m_actBody, prop["model"].c_str(), 
                               CosNaming::NamingContext::_duplicate(naming.getRootContext()))){
    std::cerr << "[" << m_profile.instance_name << "] failed to load model[" << prop["model"] << "]" << std::endl;
    return RTC::RTC_ERROR;
  }

  m_refLink = m_refBody->rootLink();
  m_actLink = m_actBody->rootLink();

  return RTC::RTC_OK;
}
Example #30
0
RTC::ReturnCode_t RangeDataViewer::onInitialize()
{
  std::cout << m_profile.instance_name << ": onInitialize()" << std::endl;
  // <rtc-template block="bind_config">
  // Bind variables and configuration variable
  bindParameter("maxRange", m_maxRange, "2.0");
  
  // </rtc-template>

  // Registration: InPort/OutPort/Service
  // <rtc-template block="registration">
  // Set InPort buffers
  addInPort("rangeIn", m_rangeIn);

  // Set OutPort buffer
  
  // Set service provider to Ports
  
  // Set service consumers to Ports
  
  // Set CORBA Service Ports
  
  // </rtc-template>

  RTC::Properties& prop = getProperties();

  return RTC::RTC_OK;
}