Example #1
0
// init
void AP_MotorsTri::init(motor_frame_class frame_class, motor_frame_type frame_type)
{
    add_motor_num(AP_MOTORS_MOT_1);
    add_motor_num(AP_MOTORS_MOT_2);
    add_motor_num(AP_MOTORS_MOT_4);
    
    // set update rate for the 3 motors (but not the servo on channel 7)
    set_update_rate(_speed_hz);

    // set the motor_enabled flag so that the ESCs can be calibrated like other frame types
    motor_enabled[AP_MOTORS_MOT_1] = true;
    motor_enabled[AP_MOTORS_MOT_2] = true;
    motor_enabled[AP_MOTORS_MOT_4] = true;

    // find the yaw servo
    _yaw_servo = SRV_Channels::get_channel_for(SRV_Channel::k_motor7, AP_MOTORS_CH_TRI_YAW);
    if (!_yaw_servo) {
        gcs().send_text(MAV_SEVERITY_ERROR, "MotorsTri: unable to setup yaw channel");
        // don't set initialised_ok
        return;
    }
    
    // allow mapping of motor7
    add_motor_num(AP_MOTORS_CH_TRI_YAW);

    // record successful initialisation if what we setup was the desired frame_class
    _flags.initialised_ok = (frame_class == MOTOR_FRAME_TRI);
}
Example #2
0
// init
void AP_MotorsHeli::init(motor_frame_class frame_class, motor_frame_type frame_type)
{
    // remember frame type
    _frame_type = frame_type;

    // set update rate
    set_update_rate(_speed_hz);

    // load boot-up servo test cycles into counter to be consumed
    _servo_test_cycle_counter = _servo_test;

    // ensure inputs are not passed through to servos on start-up
    _servo_mode = SERVO_CONTROL_MODE_AUTOMATED;

    // initialise radio passthrough for collective to middle
    _throttle_radio_passthrough = 0.5f;

    // initialise Servo/PWM ranges and endpoints
    if (!init_outputs()) {
        // don't set initialised_ok
        return;
    }

    // calculate all scalars
    calculate_scalars();

    // record successful initialisation if what we setup was the desired frame_class
    _flags.initialised_ok = (frame_class == MOTOR_FRAME_HELI);
}
Example #3
0
// init
void AP_MotorsSingle::init(motor_frame_class frame_class, motor_frame_type frame_type)
{
    // set update rate for the 3 motors (but not the servo on channel 7)
    set_update_rate(_speed_hz);

    // set the motor_enabled flag so that the main ESC can be calibrated like other frame types
    motor_enabled[AP_MOTORS_MOT_5] = true;
    motor_enabled[AP_MOTORS_MOT_6] = true;

    // we set four servos to angle
    _servo1.set_type(RC_CHANNEL_TYPE_ANGLE);
    _servo2.set_type(RC_CHANNEL_TYPE_ANGLE);
    _servo3.set_type(RC_CHANNEL_TYPE_ANGLE);
    _servo4.set_type(RC_CHANNEL_TYPE_ANGLE);
    _servo1.set_angle(AP_MOTORS_SINGLE_SERVO_INPUT_RANGE);
    _servo2.set_angle(AP_MOTORS_SINGLE_SERVO_INPUT_RANGE);
    _servo3.set_angle(AP_MOTORS_SINGLE_SERVO_INPUT_RANGE);
    _servo4.set_angle(AP_MOTORS_SINGLE_SERVO_INPUT_RANGE);

    // allow mapping of motor7
    add_motor_num(CH_7);

    // record successful initialisation if what we setup was the desired frame_class
    _flags.initialised_ok = (frame_class == MOTOR_FRAME_SINGLE);
}
// init
void AP_MotorsTri::Init()
{
    // call parent Init function to set-up throttle curve
    AP_Motors::Init();

    // set update rate for the 3 motors (but not the servo on channel 7)
    set_update_rate(_speed_hz);
}
Example #5
0
// Init
void AP_MotorsMatrix::Init()
{
    // setup the motors
    setup_motors();

    // enable fast channels or instant pwm
    set_update_rate(_speed_hz);
}
Example #6
0
// Init
void AP_MotorsMatrix::Init()
{
    // call parent Init function to set-up throttle curve
    AP_Motors::Init();

    // setup the motors
    setup_motors();

    // enable fast channels or instant pwm
    set_update_rate(_speed_hz);
}
Example #7
0
// init
void AP_MotorsMatrix::init(motor_frame_class frame_class, motor_frame_type frame_type)
{
    // record requested frame class and type
    _last_frame_class = frame_class;
    _last_frame_type = frame_type;

    // setup the motors
    setup_motors(frame_class, frame_type);

    // enable fast channels or instant pwm
    set_update_rate(_speed_hz);
}
// init
void AP_MotorsTri::Init()
{
    // set update rate for the 3 motors (but not the servo on channel 7)
    set_update_rate(_speed_hz);

    // set the motor_enabled flag so that the ESCs can be calibrated like other frame types
    motor_enabled[AP_MOTORS_MOT_1] = true;
    motor_enabled[AP_MOTORS_MOT_2] = true;
    motor_enabled[AP_MOTORS_MOT_4] = true;

    // disable CH7 from being used as an aux output (i.e. for camera gimbal, etc)
    RC_Channel_aux::disable_aux_channel(AP_MOTORS_CH_TRI_YAW);
}
Example #9
0
// init
void AP_MotorsTri::Init()
{
    // call parent Init function to set-up throttle curve
    AP_Motors::Init();

    // set update rate for the 3 motors (but not the servo on channel 7)
    set_update_rate(_speed_hz);

    // set the motor_enabled flag so that the ESCs can be calibrated like other frame types
    motor_enabled[AP_MOTORS_MOT_1] = true;
    motor_enabled[AP_MOTORS_MOT_2] = true;
    motor_enabled[AP_MOTORS_MOT_4] = true;
}
Example #10
0
// init
void AP_MotorsHeli::Init()
{
    // set update rate
    set_update_rate(_speed_hz);

    // ensure inputs are not passed through to servos
    _servo_manual = 0;

    // initialise some scalers
    recalc_scalers();

    // initialise swash plate
    init_swash();
}
Example #11
0
// init
void AP_MotorsHeli::Init()
{
    // set update rate
    set_update_rate(_speed_hz);

    // ensure inputs are not passed through to servos on start-up
    _servo_manual = 0;

    // initialise Servo/PWM ranges and endpoints
    init_outputs();

    // calculate all scalars
    calculate_scalars();
}
Example #12
0
// set frame class (i.e. quad, hexa, heli) and type (i.e. x, plus)
void AP_MotorsMatrix::set_frame_class_and_type(motor_frame_class frame_class, motor_frame_type frame_type)
{
    // exit immediately if armed or no change
    if (armed() || (frame_class == _last_frame_class && _last_frame_type == frame_type)) {
        return;
    }
    _last_frame_class = frame_class;
    _last_frame_type = frame_type;

    // setup the motors
    setup_motors(frame_class, frame_type);

    // enable fast channels or instant pwm
    set_update_rate(_speed_hz);
}
Example #13
0
// set frame orientation (normally + or X)
void AP_MotorsMatrix::set_frame_orientation( uint8_t new_orientation )
{
    // return if nothing has changed
    if( new_orientation == _flags.frame_orientation ) {
        return;
    }

    // call parent
    AP_Motors::set_frame_orientation( new_orientation );

    // setup the motors
    setup_motors();

    // enable fast channels or instant pwm
    set_update_rate(_speed_hz);
}
Example #14
0
// Init
void AP_MotorsMatrix::Init()
{
	int8_t i;

	// setup the motors
	setup_motors();

	// double check that opposite motor definitions are ok
	for( i=0; i<AP_MOTORS_MAX_NUM_MOTORS; i++ ) {
		if( opposite_motor[i] <= 0 || opposite_motor[i] >= AP_MOTORS_MAX_NUM_MOTORS || !motor_enabled[opposite_motor[i]] )
			opposite_motor[i] = AP_MOTORS_MATRIX_MOTOR_UNDEFINED;
	}

	// enable fast channels or instant pwm
	set_update_rate(_speed_hz);
}
Example #15
0
void read_pcemurc(void)
{   /* This procedure is a bit of a hack :) - will be redone later */
    FILE *f1;
    char buffer[1024];  /* Maximum path length. Should really be a #define */
    char keyword[1024];
    char value[1024];
    int line = 0;
    int tmp;

    /* Try current directory first... */

    if ((f1 = fopen(".pcemurc","r")) == NULL)
    {   /* Try home directory */
        sprintf(buffer,"%s/.pcemurc", getenv("HOME"));
        if ((f1 = fopen(buffer,"r")) == NULL)
        {
            printf("Warning: .pcemurc not found - using compile time defaults\n");
            return;
        }
    }

    while (fgets(buffer,sizeof buffer,f1) != NULL)
    {
        line++;
        tmp = sscanf(buffer," %s %s", keyword, value);

        if (tmp == 0 || keyword[0] == '#')
            continue;
        if (tmp != 2)
        {
            check_error("Syntax error in .pcemu file", line);
            continue;
        }

        if (strcasecmp(keyword,"bootfile") == 0)
            check_error(set_boot_file(value), line);
        else if (strcasecmp(keyword,"boottype") == 0)
            check_error(set_boot_type(strtol(value, NULL,10)), line);
        else if (strcasecmp(keyword,"updatespeed") == 0)
            check_error(set_update_rate(strtol(value, NULL,10)), line);
        else if (strcasecmp(keyword,"cursorspeed") == 0)
            check_error(set_cursor_rate(strtol(value, NULL,10)), line);
        else
            check_error("Syntax error in .pcemu file", line);
    }
    fclose(f1);
}
Example #16
0
// init
void AP_MotorsTri::Init()
{
    add_motor_num(AP_MOTORS_MOT_1);
    add_motor_num(AP_MOTORS_MOT_2);
    add_motor_num(AP_MOTORS_MOT_4);
    
    // set update rate for the 3 motors (but not the servo on channel 7)
    set_update_rate(_speed_hz);

    // set the motor_enabled flag so that the ESCs can be calibrated like other frame types
    motor_enabled[AP_MOTORS_MOT_1] = true;
    motor_enabled[AP_MOTORS_MOT_2] = true;
    motor_enabled[AP_MOTORS_MOT_4] = true;

    // allow mapping of motor7
    add_motor_num(AP_MOTORS_CH_TRI_YAW);
}
Example #17
0
// init
void AP_MotorsHeli::Init()
{
    // set update rate
    set_update_rate(_speed_hz);

    // load boot-up servo test cycles into counter to be consumed
    _servo_test_cycle_counter = _servo_test;

    // ensure inputs are not passed through to servos on start-up
    _servo_mode = SERVO_CONTROL_MODE_AUTOMATED;

    // initialise Servo/PWM ranges and endpoints
    init_outputs();

    // calculate all scalars
    calculate_scalars();
}
Example #18
0
// init
void AP_MotorsCoax::Init()
{
    // call parent Init function to set-up throttle curve
    AP_Motors::Init();

    // set update rate for the 2 motors (but not the servo on channel 1&2)
    set_update_rate(_speed_hz);

    // set the motor_enabled flag so that the ESCs can be calibrated like other frame types
    motor_enabled[AP_MOTORS_MOT_3] = true;
    motor_enabled[AP_MOTORS_MOT_4] = true;

    // set ranges for fin servos
    _servo1->set_type(RC_CHANNEL_TYPE_ANGLE);
    _servo2->set_type(RC_CHANNEL_TYPE_ANGLE);
    _servo1->set_angle(AP_MOTORS_COAX_SERVO_INPUT_RANGE);
    _servo2->set_angle(AP_MOTORS_COAX_SERVO_INPUT_RANGE);
}
// init
void AP_MotorsHeli::Init()
{
    // set update rate
    set_update_rate(_speed_hz);

    // ensure inputs are not passed through to servos
    _servo_manual = 0;

    // initialise some scalers
    recalc_scalers();

    // initialise swash plate
    init_swash();

    // disable channels 7 and 8 from being used by RC_Channel_aux
    RC_Channel_aux::disable_aux_channel(_motor_to_channel_map[AP_MOTORS_HELI_AUX]);
    RC_Channel_aux::disable_aux_channel(_motor_to_channel_map[AP_MOTORS_HELI_RSC]);
}
Example #20
0
// init
void AP_MotorsVtol::Init()
{
    // call parent Init function to set-up throttle curve
    AP_Motors::Init();

    // set update rate for the 3 motors (but not the servo on channel 7)
    set_update_rate(_speed_hz);

    // set the motor_enabled flag so that the ESCs can be calibrated like other frame types
    motor_enabled[VTOL_CH_VERTICAL_PITCH_FRONT] = true;
    motor_enabled[VTOL_CH_VERTICAL_ROLL_RIGHT] = true;
    motor_enabled[VTOL_CH_THROTTLE] = true;
    motor_enabled[VTOL_CH_VERTICAL_ROLL_LEFT] = true;

    RC_Channel_aux::disable_aux_channel(VTOL_CH_YAW);
    RC_Channel_aux::disable_aux_channel(VTOL_CH_HORIZONTAL_PITCH);
    RC_Channel_aux::disable_aux_channel(VTOL_CH_HORIZONTAL_ROLL);
    RC_Channel_aux::disable_aux_channel(VTOL_CH_TRANSITION);
}
Example #21
0
// init
void AP_MotorsTri::init(motor_frame_class frame_class, motor_frame_type frame_type)
{
    add_motor_num(AP_MOTORS_MOT_1);
    add_motor_num(AP_MOTORS_MOT_2);
    add_motor_num(AP_MOTORS_MOT_4);
    
    // set update rate for the 3 motors (but not the servo on channel 7)
    set_update_rate(_speed_hz);

    // set the motor_enabled flag so that the ESCs can be calibrated like other frame types
    motor_enabled[AP_MOTORS_MOT_1] = true;
    motor_enabled[AP_MOTORS_MOT_2] = true;
    motor_enabled[AP_MOTORS_MOT_4] = true;

    // allow mapping of motor7
    add_motor_num(AP_MOTORS_CH_TRI_YAW);

    // record successful initialisation if what we setup was the desired frame_class
    _flags.initialised_ok = (frame_class == MOTOR_FRAME_TRI);
}
Example #22
0
// init
void AP_MotorsSingle::Init()
{
    // set update rate for the 3 motors (but not the servo on channel 7)
    set_update_rate(_speed_hz);

    // set the motor_enabled flag so that the main ESC can be calibrated like other frame types
    motor_enabled[AP_MOTORS_MOT_7] = true;

    // we set four servos to angle
    _servo1.set_type(RC_CHANNEL_TYPE_ANGLE);
    _servo2.set_type(RC_CHANNEL_TYPE_ANGLE);
    _servo3.set_type(RC_CHANNEL_TYPE_ANGLE);
    _servo4.set_type(RC_CHANNEL_TYPE_ANGLE);
    _servo1.set_angle(AP_MOTORS_SINGLE_SERVO_INPUT_RANGE);
    _servo2.set_angle(AP_MOTORS_SINGLE_SERVO_INPUT_RANGE);
    _servo3.set_angle(AP_MOTORS_SINGLE_SERVO_INPUT_RANGE);
    _servo4.set_angle(AP_MOTORS_SINGLE_SERVO_INPUT_RANGE);

    // disable CH7 from being used as an aux output (i.e. for camera gimbal, etc)
    RC_Channel_aux::disable_aux_channel(CH_7);
}
Example #23
0
// init
void AP_MotorsSingle::Init()
{
    // set update rate for the 3 motors (but not the servo on channel 7)
    set_update_rate(_speed_hz);

    // set the motor_enabled flag so that the main ESC can be calibrated like other frame types
    motor_enabled[AP_MOTORS_MOT_5] = true;
    motor_enabled[AP_MOTORS_MOT_6] = true;

    // we set four servos to angle
    _servo1.set_type(RC_CHANNEL_TYPE_ANGLE);
    _servo2.set_type(RC_CHANNEL_TYPE_ANGLE);
    _servo3.set_type(RC_CHANNEL_TYPE_ANGLE);
    _servo4.set_type(RC_CHANNEL_TYPE_ANGLE);
    _servo1.set_angle(AP_MOTORS_SINGLE_SERVO_INPUT_RANGE);
    _servo2.set_angle(AP_MOTORS_SINGLE_SERVO_INPUT_RANGE);
    _servo3.set_angle(AP_MOTORS_SINGLE_SERVO_INPUT_RANGE);
    _servo4.set_angle(AP_MOTORS_SINGLE_SERVO_INPUT_RANGE);

    // allow mapping of motor7
    add_motor_num(CH_7);
}
Example #24
0
// init
void AP_MotorsHeli::Init()
{
    // set update rate
    set_update_rate(_speed_hz);
}
static void change_update( GtkComboBox * combo, CPUGraph * base )
{
	set_update_rate( base, gtk_combo_box_get_active( combo ) );
}
Example #26
0
void read_pcemurc(void)
{         /* This procedure is a bit of a hack :) - will be redone later */
    FILE *f1;
    char buffer[1024];  /* Maximum path length. Should really be a #define */
    char keyword[1024];
    char value[1024];
    int line = 0;
    int i;

    /* Try current directory first... */

    if ((f1 = fopen(".pcemurc","r")) == NULL)
    {           /* Try home directory */
        sprintf(buffer,"%s/.pcemurc", getenv("HOME"));
        if ((f1 = fopen(buffer,"r")) == NULL)
        {
            printf("Warning: .pcemurc not found - using compile time defaults\n");
            return;
        }
    }

    /* This bit hacked by David Given to, er, improve... */

    while (fgets(buffer,sizeof buffer,f1) != NULL)
    {
        line++;
        i = 0;				/* Strip leading spaces */
        while(buffer[i] == ' ')
            i++;
        strcpy(keyword, buffer+i);

        while(buffer[i] != ' ')		/* Skip to end of keyword */
            i++;
        while(buffer[i] == ' ')
            i++;
        strcpy(value, buffer+i);	/* Write value */

        i = 0;				/* Trim keyword to one word */
        while(keyword[i] != ' ')
            i++;
        keyword[i] = '\0';

        i = 0;				/* Strip out \n */
        while(value[i] != '\0')
        {
            if (value[i] == '\n')
                value[i] = '\0';
            i++;
        }

        if ((keyword[0] == '#') || (keyword[0] == ' ') || (keyword[0] == '\n'))
            continue;

        if (strcasecmp(keyword, "floppy") == 0)
        {
            int drive;
            char device[1024];
            int sectors;
            int cylinders;
            int heads;

            if (sscanf(value, "%d %s %d %d %d", &drive, device, &sectors, &cylinders, &heads) == 5)
                 check_error(set_floppy_drive(drive, device, sectors, cylinders, heads), line);
            else
                 check_error("Syntax error in \"floppy\" directive", line);
        }   
        else if (strcasecmp(keyword, "harddrive") == 0)
        {
            int drive;
            char device[1024];
            int sectors;
            int cylinders;
            int heads;

            if (sscanf(value, "%d %s %d %d %d", &drive, device, &sectors, &cylinders, &heads) == 5)
                 check_error(set_hard_drive(drive, device, sectors, cylinders, heads), line);
            else
                 check_error("Syntax error in \"hard\" directive", line);
        }
        else if (strcasecmp(keyword, "numharddrives") == 0)
            check_error(set_num_hdrives(strtol(value, NULL, 10)), line);
        else if (strcasecmp(keyword, "numfloppydrives") == 0)
            check_error(set_num_fdrives(strtol(value, NULL, 10)), line);
        else if (strcasecmp(keyword,"updatespeed") == 0)
            check_error(set_update_rate(strtol(value, NULL,10)), line);
        else if (strcasecmp(keyword,"cursorspeed") == 0)
            check_error(set_cursor_rate(strtol(value, NULL,10)), line);
/*	else if (strcasecmp(keyword,"keymap") == 0)
		check_error(set_keymap(buffer), line);*/
	else if (strcasecmp(keyword, "video") == 0)
	    check_error(set_video_mode(value), line);
        else
            check_error("Syntax error in .pcemu file", line);
    }
    fclose(f1);
}           
Example #27
0
// init
void AP_MotorsTri::Init()
{
	// set update rate for the 3 motors (but not the servo on channel 7)
	set_update_rate(_speed_hz);
}