当前位置: 首页>>代码示例>>C++>>正文


C++ LSM303::enableDefault方法代码示例

本文整理汇总了C++中LSM303::enableDefault方法的典型用法代码示例。如果您正苦于以下问题:C++ LSM303::enableDefault方法的具体用法?C++ LSM303::enableDefault怎么用?C++ LSM303::enableDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LSM303的用法示例。


在下文中一共展示了LSM303::enableDefault方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setup

/**
 * @brief Initializes the gyro/accelerometer and the magnetometer unit of the imu.
 * 		As well as the arduino subsystem
 */
void setup() {
    Wire.begin();
    delay(1500);

    /********/
    /* GYRO */
    /********/
    gyro.init();
    gyro.writeReg(L3G_CTRL_REG4, 0x00); // 245 dps scale
    gyro.writeReg(L3G_CTRL_REG1, 0x0F); // normal power mode, all axes enabled, 100 Hz
    //8.75 mdps/LSB

    /****************/
    /* MAGNETOMETER */
    /****************/
    compass.init();
    compass.enableDefault();
    compass.writeReg(LSM303::CTRL2, 0x08); // 4 g scale: AFS = 001
    //0.122 mg/LSB
    compass.writeReg(LSM303::CTRL5, 0x10); // Magnetometer Low Resolution 50 Hz
    //Magnetometer 4 gauss scale : 0.16mgauss/LSB


    //ROS-TF base frame of the imu_data
    imu_msg.header.frame_id="base_imu_link";

    //Register ROS messages
    nh.initNode();
    nh.advertise(imu_pub);
    nh.advertise(mag_pub);

    //starting value for the timer
    timer=millis();
}
开发者ID:AR2A,项目名称:imu-minimu-arduino,代码行数:38,代码来源:avr_imu.cpp

示例2: setup

void setup() {
  Serial.begin(9600);
  Wire.begin();
  compass.init();
  compass.enableDefault();
  compass.setMagGain(LSM303::magGain_47);
}
开发者ID:TerellNao,项目名称:arduino-gps-glasses,代码行数:7,代码来源:cal.cpp

示例3: setup

void Accelerometer::setup(){
	Wire.begin();
	compass.init();
	compass.enableDefault();

	memset(lastValuesX,0,sizeof(lastValuesX));
	memset(lastValuesY,0,sizeof(lastValuesY));
	memset(lastValuesZ,0,sizeof(lastValuesZ));
	index =0;

}
开发者ID:eclair4151,项目名称:Robotics-Club-Sumo-Arduino-2014,代码行数:11,代码来源:accelerometer.cpp

示例4: initHal

bool Hal::initHal()
{
  debugPrintLn("Start init");
  // initialize all the hardware
  initLora();
  initSwitch();
  initLTC();
  compass.init();
  compass.enableDefault();
  htu.begin();
//  setAckOn();
  debugPrintLn("Einde init");
}
开发者ID:marcelmaatkamp,项目名称:docker-applications,代码行数:13,代码来源:Hal.cpp

示例5: setup

void setup(){
	
	Serial.begin(115200);
	Wire.begin(); //gyro code
	gyro.init();//gyro code
	gyro.enableDefault(); //gyro code
	ps.enableDefault(); //baro code
	
	 handshaken = 0;
		
		/*accelerometer code*/
		compass.init();
		compass.enableDefault();
		/*accelerometer code*/
		/*sonar code*/
		pinMode(TRIGGER_PIN, OUTPUT);
		pinMode(ECHO_PIN, INPUT);
		
		pinMode(TRIGGER_PIN2, OUTPUT);
		pinMode(ECHO_PIN2, INPUT);
		pinMode(TRIGGER_PIN3, OUTPUT);
		pinMode(ECHO_PIN3, INPUT);
		pinMode(TRIGGER_PIN4, OUTPUT);
		pinMode(ECHO_PIN4, INPUT);
		pinMode(TRIGGER_PIN5, OUTPUT);
		pinMode(ECHO_PIN5, INPUT);
		
		/*sonar code*/
		   pinMode(MOTOR, OUTPUT);
		   
		   
		   /*
  Calibration values; the default values of +/-32767 for each axis
  lead to an assumed magnetometer bias of 0. Use the ACCalibrate 
  program to determine appropriate values for your particular unit.
  */
  //compass.m_min = (LSM303::vector<int16_t>){-32767, -32767, -32767};
  //compass.m_max = (LSM303::vector<int16_t>){+32767, +32767, +32767};
  
  //LSM303::vector<int16_t> running_min = {-2872, -3215, -1742}, running_max = {+3019, +3108, +3570}; //calibration init data for compass 
  compass.m_min = (LSM303::vector<int16_t>){-2872, -3215, -1742};
  compass.m_max = (LSM303::vector<int16_t>) {+3019, +3108, +3570};
}
开发者ID:stanley92,项目名称:CG3002,代码行数:43,代码来源:FreeRTOS2560.cpp

示例6: Accel_Init

void Accel_Init()
{
	compass.init();
	compass.enableDefault();
	switch (compass.getDeviceType())
	{
		case LSM303::device_D:
		compass.writeReg(LSM303::CTRL2, 0x18); // 8 g full scale: AFS = 011
		break;
		case LSM303::device_DLHC:
		compass.writeReg(LSM303::CTRL_REG4_A, 0x28); // 8 g full scale: FS = 10; high resolution output mode
		break;
		default: // DLM, DLH
		compass.writeReg(LSM303::CTRL_REG4_A, 0x30); // 8 g full scale: FS = 11
	}
	//compass.heading((LSM303::vector<int>){0, 0, -1});
	//compass.m_min = (LSM303::vector<int16_t>){-2304, -2194, -2156};
	//compass.m_max = (LSM303::vector<int16_t>){+2771, +2860, +2753};
}
开发者ID:kwa5566,项目名称:CG3002RTOS,代码行数:19,代码来源:imu_mis.c

示例7: setup

void setup(){

    rled = 1; gled = 1; bled = 1;

    autoSD.ready_datalogger(); // Prepares a datalog filename according to index.txt
    pc.printf("Index: %d\r\n",autoSD.curr_index());         

    if(!ps.init()){ //enable pressure sensor
        pc.printf("Unable to talk to Barometer\r\n");
        while(1){ rled = !rled; wait_ms(100);}
    }
    else{
        ps.enableDefault();
    }

    if(!gyr.init()){
        pc.printf("Unable to talk to Gyroscope\r\n");
        while(1){ rled = !rled; wait_ms(100);}
    }
    else{
        gyr.enableDefault();
    }

    if(!acc.init()){
        pc.printf("Unable to talk to Accelerometer\r\n");
        while(1){ rled = !rled; wait_ms(100);}
    }
    else{
        acc.enableDefault();
    }

    fp = fopen(autoSD.filepath, "w");
    if (fp == NULL) {
        pc.printf("Unable to write the file \r\n");
        while(1){ rled = !rled; wait_ms(100);}
    }

    pc.printf("Success in Set Up\r\n");

}
开发者ID:cduck,项目名称:bikeOdometer,代码行数:40,代码来源:hello_world.cpp


注:本文中的LSM303::enableDefault方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。