Ejemplo n.º 1
0
/**
 * Initialise the module, called on startup
 * \returns 0 on success or -1 if initialisation failed
 */
int32_t AHRSCommsInitialize(void)
{
	InsStatusInitialize();
	InsSettingsInitialize();
	AttitudeRawInitialize();
	AttitudeActualInitialize();
	VelocityActualInitialize();
	PositionActualInitialize();

	return 0;
}
Ejemplo n.º 2
0
/**
 * Initialise the module.  Called before the start function
 * \returns 0 on success or -1 if initialisation failed
 */
int32_t AttitudeInitialize(void)
{
    AttitudeActualInitialize();
    AirspeedActualInitialize();
    AirspeedSensorInitialize();
    AttitudeSettingsInitialize();
    PositionActualInitialize();
    VelocityActualInitialize();
    RevoSettingsInitialize();
    RevoCalibrationInitialize();
    EKFConfigurationInitialize();
    EKFStateVarianceInitialize();
    FlightStatusInitialize();

    // Initialize this here while we aren't setting the homelocation in GPS
    HomeLocationInitialize();

    // Initialize quaternion
    AttitudeActualData attitude;
    AttitudeActualGet(&attitude);
    attitude.q1 = 1.0f;
    attitude.q2 = 0.0f;
    attitude.q3 = 0.0f;
    attitude.q4 = 0.0f;
    AttitudeActualSet(&attitude);

    // Cannot trust the values to init right above if BL runs
    GyrosBiasData gyrosBias;
    GyrosBiasGet(&gyrosBias);
    gyrosBias.x = 0.0f;
    gyrosBias.y = 0.0f;
    gyrosBias.z = 0.0f;
    GyrosBiasSet(&gyrosBias);

    AttitudeSettingsConnectCallback(&settingsUpdatedCb);
    RevoSettingsConnectCallback(&settingsUpdatedCb);
    RevoCalibrationConnectCallback(&settingsUpdatedCb);
    HomeLocationConnectCallback(&settingsUpdatedCb);
    EKFConfigurationConnectCallback(&settingsUpdatedCb);
    FlightStatusConnectCallback(&settingsUpdatedCb);

    return 0;
}
Ejemplo n.º 3
0
/**
 * Function used to initialize the first instance of each object.
 * This file is automatically updated by the UAVObjectGenerator.
 */
void UAVObjectsInitializeAll()
{
    ActuatorCommandInitialize();
    ActuatorDesiredInitialize();
    ActuatorSettingsInitialize();
    AHRSCalibrationInitialize();
    AHRSSettingsInitialize();
    AhrsStatusInitialize();
    AttitudeActualInitialize();
    AttitudeDesiredInitialize();
    AttitudeRawInitialize();
    AttitudeSettingsInitialize();
    BaroAltitudeInitialize();
    ExampleObject1Initialize();
    ExampleObject2Initialize();
    ExampleSettingsInitialize();
    FlightBatteryStateInitialize();
    FlightTelemetryStatsInitialize();
    GCSTelemetryStatsInitialize();
    GPSPositionInitialize();
    GPSSatellitesInitialize();
    GPSTimeInitialize();
    HomeLocationInitialize();
    ManualControlCommandInitialize();
    ManualControlSettingsInitialize();
    MixerSettingsInitialize();
    MixerStatusInitialize();
    ObjectPersistenceInitialize();
    PositionActualInitialize();
    StabilizationSettingsInitialize();
    SystemAlarmsInitialize();
    SystemSettingsInitialize();
    SystemStatsInitialize();
    TelemetrySettingsInitialize();
    VTOLSettingsInitialize();
    VTOLStatusInitialize();

}
Ejemplo n.º 4
0
/**
 * Initialise the module, called on startup
 * \returns 0 on success or -1 if initialisation failed
 */
int32_t AttitudeInitialize(void)
{
    AttitudeActualInitialize();
    SensorSettingsInitialize();
    AttitudeSettingsInitialize();
    AccelsInitialize();
    GyrosInitialize();

    // Initialize quaternion
    AttitudeActualData attitude;
    AttitudeActualGet(&attitude);
    attitude.q1 = 1;
    attitude.q2 = 0;
    attitude.q3 = 0;
    attitude.q4 = 0;
    AttitudeActualSet(&attitude);

    // Cannot trust the values to init right above if BL runs
    gyro_correct_int[0] = 0;
    gyro_correct_int[1] = 0;
    gyro_correct_int[2] = 0;

    q[0] = 1;
    q[1] = 0;
    q[2] = 0;
    q[3] = 0;
    for(uint8_t i = 0; i < 3; i++)
        for(uint8_t j = 0; j < 3; j++)
            Rsb[i][j] = 0;

    trim_requested = false;

    AttitudeSettingsConnectCallback(&settingsUpdatedCb);
    SensorSettingsConnectCallback(&settingsUpdatedCb);

    return 0;
}
Ejemplo n.º 5
0
/**
 * PIOS_Board_Init()
 * initializes all the core systems on this specific hardware
 * called from System/openpilot.c
 */
void PIOS_Board_Init(void) {

	/* Delay system */
	PIOS_DELAY_Init();

	/* Initialize UAVObject libraries */
	EventDispatcherInitialize();
	UAVObjInitialize();
	UAVObjectsInitializeAll();

	/* Initialize the alarms library */
	AlarmsInitialize();

	/* Initialize the task monitor library */
	TaskMonitorInitialize();

#if defined(PIOS_INCLUDE_COM)
#if defined(PIOS_INCLUDE_TELEMETRY_RF)
	{
		uint32_t pios_udp_telem_rf_id;
		if (PIOS_UDP_Init(&pios_udp_telem_rf_id, &pios_udp_telem_cfg)) {
			PIOS_Assert(0);
		}

		uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_TELEM_RF_RX_BUF_LEN);
		uint8_t * tx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_TELEM_RF_TX_BUF_LEN);
		PIOS_Assert(rx_buffer);
		PIOS_Assert(tx_buffer);
		if (PIOS_COM_Init(&pios_com_telem_rf_id, &pios_udp_com_driver, pios_udp_telem_rf_id,
						  rx_buffer, PIOS_COM_TELEM_RF_RX_BUF_LEN,
						  tx_buffer, PIOS_COM_TELEM_RF_TX_BUF_LEN)) {
			PIOS_Assert(0);
		}
	}
#endif /* PIOS_INCLUDE_TELEMETRY_RF */

#if defined(PIOS_INCLUDE_GPS)
	{
		uint32_t pios_udp_gps_id;
		if (PIOS_UDP_Init(&pios_udp_gps_id, &pios_udp_gps_cfg)) {
			PIOS_Assert(0);
		}
		uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_GPS_RX_BUF_LEN);
		uint8_t * tx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_GPS_RX_BUF_LEN);
		PIOS_Assert(rx_buffer);
		PIOS_Assert(tx_buffer);
		if (PIOS_COM_Init(&pios_com_gps_id, &pios_udp_com_driver, pios_udp_gps_id,
				  rx_buffer, PIOS_COM_GPS_RX_BUF_LEN,
				  tx_buffer, PIOS_COM_GPS_RX_BUF_LEN)) {
			PIOS_Assert(0);
		}
	}
#endif	/* PIOS_INCLUDE_GPS */
#endif

	// Initialize these here as posix has no AHRSComms
	AttitudeRawInitialize();
	AttitudeActualInitialize();
	VelocityActualInitialize();
	PositionActualInitialize();

}