Пример #1
0
void ImuRosI::initDevice()
{
	ROS_INFO("Opening device");
	open(-1);

	ROS_INFO("Waiting for IMU to be attached...");
	int result = waitForAttachment(10000);
	if(result)
	{
		is_connected_ = false;
		error_number_ = result;
		diag_updater_.force_update();
		const char *err;
		CPhidget_getErrorDescription(result, &err);
		ROS_FATAL("Problem waiting for IMU attachment: %s Make sure the USB cable is connected and you have executed the phidgets_api/share/setup-udev.sh script.", err);
	}

  // calibrate on startup
  calibrate();

  // set the hardware id for diagnostics
  diag_updater_.setHardwareIDf("%s-%d",
                               getDeviceName().c_str(),
                               getDeviceSerialNumber());
}
Пример #2
0
int Gps::initDevice()
{
    std::cout<<"Opening device"<<std::endl;
    this->open(serial_number);

    std::cout<<"Waiting for GPS to be attached..."<<std::endl;
    int result = waitForAttachment(10000);
    if(result)
    {
      const char *err;
        CPhidget_getErrorDescription(result, &err);
        std::cout<<"Problem waiting for GPS attachment: %s Make sure the USB cable is connected and you have executed the phidgets_c_api/setup-udev.sh script."<<std::endl;
        return 1;
    }
    return 0;
}
Пример #3
0
Spatial::Spatial(void):
	Phidget(),
	spatial_handle_(0)
{
	int result;
	CPhidgetSpatial_create(&spatial_handle_);
	Phidget::init((CPhidgetHandle) spatial_handle_);
	Phidget::registerHandlers();
	CPhidgetSpatial_set_OnSpatialData_Handler(spatial_handle_, SpatialDataHandler, this);
	Phidget::open();

	printf("Waiting for spatial to be attached.... \n");
	if((result = waitForAttachment(10000)))
	{
		printf("Problem waiting for attachment \n");
	}
}