Example #1
0
// grab - move the epm pwm output to the grab position
void AP_EPM::grab()
{
    // return immediately if not enabled
    if (!_enabled) {
        return;
    }

    // flag we are active and grabbing cargo
    _flags.grab = true;
    _flags.active = true;

    // capture time
    _last_grab_or_release = AP_HAL::millis();

#ifdef UAVCAN_IOCS_HARDPOINT_SET
    if (should_use_uavcan()) {
        ::printf("EPM: UAVCAN GRAB\n");
        const UAVCANCommand cmd = make_uavcan_command(1);
        (void)ioctl(_uavcan_fd, UAVCAN_IOCS_HARDPOINT_SET, reinterpret_cast<unsigned long>(&cmd));
    }
    else
#endif
    {
        // move the servo to the release position
        RC_Channel_aux::set_radio(RC_Channel_aux::k_epm, _grab_pwm);
    }
}
Example #2
0
// neutral - return the epm pwm output to the neutral position
void AP_Gripper_EPM::neutral()
{
    if (!should_use_uavcan()) {
        // move the servo to the off position
        RC_Channel_aux::set_radio(RC_Channel_aux::k_gripper, config.neutral_pwm);
    }
}
Example #3
0
// neutral - return the epm pwm output to the neutral position
void AP_EPM::neutral() 
{
    // return immediately if not enabled
    if (!_enabled) {
        return;
    }

    // flag we are inactive (i.e. not grabbing or releasing cargo)
    _flags.active = false;

    if (!should_use_uavcan()) {
        // move the servo to the off position
        RC_Channel_aux::set_radio(RC_Channel_aux::k_epm, _neutral_pwm);
    }
}
Example #4
0
// release - move epm pwm output to the release position
void AP_Gripper_EPM::release()
{
    // flag we are releasing cargo
    config.state = AP_Gripper::STATE_RELEASING;

    // capture time
    _last_grab_or_release = AP_HAL::millis();

#ifdef UAVCAN_IOCS_HARDPOINT_SET
    if (should_use_uavcan()) {
        const UAVCANCommand cmd = make_uavcan_command(0);
        (void)ioctl(_uavcan_fd, UAVCAN_IOCS_HARDPOINT_SET, reinterpret_cast<unsigned long>(&cmd));
    }
    else
#endif
    {
        // move the servo to the release position
        RC_Channel_aux::set_radio(RC_Channel_aux::k_gripper, config.release_pwm);
    }
}