21 #define STOPPED_THRESHOLD 0.1 24 #ifdef __PTU_FREE_INCLUDED__ 28 #define POSITION_LIMITS_MODE 3 32 #define UPPER_SPEED_LIMIT 7 34 #define ACCELERATION 9 35 #define HOLD_POWER_LEVEL 10 36 #define MOVE_POWER_LEVEL 11 37 #define MINIMUM_POSITION 12 38 #define MAXIMUM_POSITION 13 39 #define LOWER_SPEED_LIMIT 14 41 #define PTU_LOW_POWER 16 42 #define PTU_REG_POWER 17 43 #define PTU_HI_POWER 18 44 #define PTU_PURE_VELOCITY_SPEED_CONTROL_MODE 19 45 #define PTU_OFF_POWER 20 46 #define SPEED_CONTROL_MODE 21 47 #define PTU_INDEPENDENT_SPEED_CONTROL_MODE 22 100 void virtual setSettings(
int pan_base,
int tilt_base,
int pan_speed,
int tilt_speed,
int pan_upper,
int tilt_upper,
101 int pan_accel,
int tilt_accel,
int pan_hold,
int tilt_hold,
int pan_move,
int tilt_move);
135 bool virtual setAbsoluteAngles(
double pan_angle,
double tilt_angle,
bool no_forbidden_area_check);
228 long virtual getLimitAngle(
char pan_or_tilt,
char upper_or_lower);
254 std::vector<double>
virtual determineLegitEndPoint(
double end_point_pan_candidate,
double end_point_tilt_candidate);
276 int & pan_upper,
int & tilt_upper,
int & pan_accel,
int & tilt_accel,
277 int & pan_hold,
int & tilt_hold,
int & pan_move,
int & tilt_move);
322 std::vector<double>
predictPositionInTime(std::vector<double> start_point, std::vector<double> end_point,
double point_in_time);
323 double calculateCoveredDistance(
double acceleration_time,
double slew_speed_time,
double decceleration_time,
bool is_pan);
325 std::vector<double>
calculateIntersectionPoint(std::vector<double> first_line_coordiante_form, std::vector<double> second_line_coordiante_form);
326 bool isOnLineSegmentBetweenTwoPoints(std::vector<double> start_point, std::vector<double> end_point, std::vector<double> line_coordinate_form, std::vector<double> point_to_check,
double tolerance);
329 double getVectorLength(std::vector<double> start_point, std::vector<double> end_point);
334 #ifndef __PTU_FREE_INCLUDED__ 335 portstream_fd COMstream;
338 #ifdef __PTU_FREE_INCLUDED__ 340 char set_desired(
char pan_or_tilt,
char what,
short int * value,
char type);
342 char set_mode(
char mode_type,
char mode);
void restoreSettingsFromBackup()
virtual void setSpeedControlMode(bool speed_control_mode)
setSpeedControlMode Method to set and disable pure speed control mode
long prefetched_pan_desired_speed
virtual bool isConnected()
isConnected Method to check if ptu is connected.
double calculateCoveredDistance(double acceleration_time, double slew_speed_time, double decceleration_time, bool is_pan)
double getVectorLength(std::vector< double > input_vector)
double double_computation_tolerance
virtual bool reachedGoal()
reachedGoal Method to determine if the PTU has reached its goal.
virtual bool isWithinPanTiltLimits(double pan, double tilt)
isWithinPanTiltLimits Method that checks if pan and tilt value are within the chosen pan and tilt lim...
std::vector< std::vector< double > > min_pan_max_tilt_points
virtual double getDesiredAngle(char type)
getDesiredAngle Method to get the desired pan/tilt angle (where the ptu moves to) ...
virtual std::vector< double > determineLegitEndPoint(double end_point_pan_candidate, double end_point_tilt_candidate)
determineLegitEndPoint Method to determine an end point which is not inside a forbidden area using pa...
std::vector< double > calculateCoordinateForm(std::vector< double > start_point, std::vector< double > end_point)
virtual void setComputationTolerance(double computation_tolerance)
setComputationTolerance Sets the tolerance value for errors due to the imprecise nature of float...
long get_current(char pan_or_tilt, char what)
virtual void setDistanceFactor(long distance_factor)
setDistanceFactor Method to set the factor which determines how much samples are going to be taken fo...
long get_desired(char pan_or_tilt, char what)
double tilt_slew_speed_time
long convertTiltFromAngleToPosition(double angle)
virtual bool setAbsoluteAngles(double pan_angle, double tilt_angle, bool no_forbidden_area_check)
setAbsoluteAngles Method to set pan and tilt angle for the PTU
virtual bool isInSpeedControlMode()
isInSpeedControlMode Method to determine if ptu is in pure speed control mode
double convertPanFromPositionToAngle(long position)
long prefetched_tilt_desired_speed
double pan_slew_speed_time
virtual bool setValuesOutOfLimitsButWithinMarginToLimit(double *pan, double *tilt, double margin)
setValuesOutOfLimitsButWithinMarginToLimit This method is used to set pan/tilt values that are slighl...
virtual long getLimitAngle(char pan_or_tilt, char upper_or_lower)
!!!!!!!!!Müssen nachfolgende public sein? Nach erstellen von mock überprüfen!!!!!!!!!!! ...
virtual void setSettings(int pan_base, int tilt_base, int pan_speed, int tilt_speed, int pan_upper, int tilt_upper, int pan_accel, int tilt_accel, int pan_hold, int tilt_hold, int pan_move, int tilt_move)
setSettings Method to configure various settings of the ptu
std::vector< double > calculatePointOfIntersectionWithForbiddenAreas(std::vector< double > start_point, std::vector< double > end_point)
long prefetched_tilt_current_base
void createSettingsBackup()
virtual void setLimitAngles(double pan_min, double pan_max, double tilt_min, double tilt_max)
setSettings Method to configure limits for pan and tilt
std::vector< std::vector< double > > forbidden_area_third_line_coordinate_forms
ptu_free::PTUFree free_ptu
std::vector< std::vector< double > > max_pan_min_tilt_points
void setValuesToBackupValues(int &pan_base, int &tilt_base, int &pan_speed, int &tilt_speed, int &pan_upper, int &tilt_upper, int &pan_accel, int &tilt_accel, int &pan_hold, int &tilt_hold, int &pan_move, int &tilt_move)
std::vector< std::vector< double > > forbidden_area_fourth_line_coordinate_forms
~PTUDriver()
~PTUDriver Do not use, necessary because of some compiler issues.
long prefetched_tilt_current_position
static short int POW_VAL_MOVE[3]
std::vector< std::vector< double > > forbidden_area_first_line_coordinate_forms
std::map< std::string, int > backup_settings
virtual std::string getErrorString(char status_code)
virtual void setForbiddenAreas(std::vector< std::map< std::string, double > > forbidden_areas)
setForbiddenAreas Method to set all forbidden areas for the PTU. Former forbidden areas will be disca...
double pan_acceleration_time
void precalculateForbiddenAreaCoodinateForms()
std::vector< double > getAccelerationTimeAndSlewSpeedTime(double distance_in_steps, double base_speed, double acceleration, double slew_speed)
bool checkReturnCode(char return_code)
virtual double getAngleSpeed(char type)
getAngleSpeed Method to get the current angle speed of an axisa (deg/s)
PTUDriver()
PTUDriver Do not use, needed for mock.
long prefetched_pan_desired_acceleration
virtual double getCurrentAngle(char type)
getCurrentAngle Method to get the current pan/tilt angle
std::vector< std::vector< double > > forbidden_area_second_line_coordinate_forms
long prefetched_pan_current_base
static short int POW_VAL_HOLD[3]
virtual bool hasHaltedAndReachedGoal()
hasHaltedAndReachedGoal Method to determine if the PTU has halted and reached its goal ...
virtual void setLimitAnglesToHardwareConstraints()
setLimitAnglesToHardwareConstraints Method that sets the pan and tilt limits to the maximum values th...
std::vector< std::vector< double > > min_pan_min_tilt_points
bool isOnLineSegmentBetweenTwoPoints(std::vector< double > start_point, std::vector< double > end_point, std::vector< double > line_coordinate_form, std::vector< double > point_to_check, double tolerance)
double convertTiltFromPositionToAngle(long position)
std::vector< double > checkForPossibleKollision(double new_pan_angle, double new_tilt_angle)
long prefetched_pan_current_position
std::vector< double > solveSecondDegreePolynomial(double a, double b, double c)
virtual bool isInForbiddenArea(double pan_angle, double tilt_angle)
isInForbiddenArea method to determine if a pan + tilt value pair lies within a forbidden area...
char set_desired(char pan_or_tilt, char what, short int *value, char type)
long convertPanFromAngleToPosition(double angle)
long prefetched_tilt_desired_acceleration
std::vector< std::map< std::string, double > > forbidden_areas
std::vector< double > calculateIntersectionPoint(std::vector< double > first_line_coordiante_form, std::vector< double > second_line_coordiante_form)
virtual void setAbsoluteAngleSpeeds(double pan_speed, double tilt_speed)
setAbsoluteAngleSpeeds Method to set desired speed for pan/tilt movement absolute in deg/s ...
double tilt_acceleration_time
virtual bool hasHalted()
hasHalted Method to determine if PTU movement has stopped
std::vector< double > predictPositionInTime(std::vector< double > start_point, std::vector< double > end_point, double point_in_time)
std::vector< std::vector< double > > max_pan_max_tilt_points
char set_mode(char mode_type, char mode)