Ejemplo n.º 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);
    }
}
Ejemplo n.º 2
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);
    }
}