1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #pragma once
- #include "stdint.h"
- #include <AP_Param/AP_Param.h>
- #include "SITL_Input.h"
- namespace SITL {
- class Gripper_Servo {
- public:
- Gripper_Servo() {
- AP_Param::setup_object_defaults(this, var_info);
- };
-
- void update(const struct sitl_input &input);
- float payload_mass() const;
- void set_alt(float alt) {altitude = alt;};
- static const struct AP_Param::GroupInfo var_info[];
- bool is_enabled() const {return static_cast<bool>(gripper_enable);}
- bool is_jaw_open() const {return jaw_open;}
- private:
- static constexpr int16_t SIM_GRIPPER_GRAB_PWM_DEFAULT = 2000;
- static constexpr int16_t SIM_GRIPPER_RELEASE_PWM_DEFAULT = 1000;
- AP_Int8 gripper_enable;
- AP_Int8 gripper_servo_pin;
- AP_Int16 grab_pwm;
- AP_Int16 release_pwm;
- AP_Int8 reverse;
- const uint32_t report_interval = 1000000;
- uint64_t last_report_us;
- bool jaw_open = false;
- const float gap = 30;
- float altitude;
- float position;
- float position_slew_rate = 35;
- float reported_position = -1;
- uint64_t last_update_us;
- bool should_report();
-
- const float string_length = 2.0f;
- float load_mass = 0.0f;
- };
- }
|