2013-09-30 12:46:09 -04:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
[![Arduino CI](https://github.com/RobTillaart/Radar/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
|
2023-11-16 14:08:09 -05:00
|
|
|
[![Arduino-lint](https://github.com/RobTillaart/Radar/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/Radar/actions/workflows/arduino-lint.yml)
|
|
|
|
[![JSON check](https://github.com/RobTillaart/Radar/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/Radar/actions/workflows/jsoncheck.yml)
|
|
|
|
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/Radar.svg)](https://github.com/RobTillaart/Radar/issues)
|
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/Radar/blob/master/LICENSE)
|
|
|
|
[![GitHub release](https://img.shields.io/github/release/RobTillaart/Radar.svg?maxAge=3600)](https://github.com/RobTillaart/Radar/releases)
|
2023-11-16 14:08:09 -05:00
|
|
|
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/Radar.svg)](https://registry.platformio.org/libraries/robtillaart/Radar)
|
2021-01-29 06:31:58 -05:00
|
|
|
|
2021-12-27 14:23:58 -05:00
|
|
|
|
2020-11-27 05:33:55 -05:00
|
|
|
# Radar
|
|
|
|
|
|
|
|
Arduino library for a pan tilt radar based upon 2 servo's.
|
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
|
2020-11-27 05:33:55 -05:00
|
|
|
## Warning
|
2021-01-29 06:31:58 -05:00
|
|
|
|
2020-11-27 05:33:55 -05:00
|
|
|
**WARNING: not extensively tested**
|
2022-11-23 07:53:23 -05:00
|
|
|
There are still a lot of things to be tested.
|
2020-11-27 05:33:55 -05:00
|
|
|
The example code is now working to show the concept.
|
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
|
2020-11-27 05:33:55 -05:00
|
|
|
## Description
|
2013-09-30 12:46:09 -04:00
|
|
|
|
2021-12-27 14:23:58 -05:00
|
|
|
Radar is a concept library (not elaborated) that implements a Ping))) based Radar
|
|
|
|
with the use of two pan and tilt servo's.
|
|
|
|
It was written after a question on the Arduino forum but never finished or tested it.
|
|
|
|
Still, it has some interesting concepts with respect to how to determine the position
|
|
|
|
of pan/tilt while the movements are in progress.
|
2020-11-27 05:33:55 -05:00
|
|
|
|
|
|
|
The idea is that one knows how fast the pan and tilt servos are working in degrees per second.
|
|
|
|
From that number and the start moment one can determine approximately its position.
|
|
|
|
|
|
|
|
Given its position while moving is interesting for radar purposes as one can determine e.g.
|
2021-12-27 14:23:58 -05:00
|
|
|
in which direction a ping is given and therefore which distance belongs to which pair of angles.
|
|
|
|
|
2022-11-23 07:53:23 -05:00
|
|
|
Note: no active development.
|
2020-11-27 05:33:55 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
|
2020-11-27 05:33:55 -05:00
|
|
|
## Interface
|
|
|
|
|
2023-11-16 14:08:09 -05:00
|
|
|
```cpp
|
|
|
|
#include "radar.h"
|
|
|
|
```
|
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
### Constructor and config
|
2020-11-27 05:33:55 -05:00
|
|
|
|
|
|
|
- **RADAR(pan, tilt)** define pan / tilt pins of the radar. These should be PWM pins.
|
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
Note: no valid range checking or negative value check.
|
|
|
|
- **void setPanPerSecond(float pps)**
|
|
|
|
- **float getPanPerSecond()**
|
|
|
|
- **void setTiltPerSecond(float tps)**
|
|
|
|
- **float getTiltPerSecond()**
|
2020-11-27 05:33:55 -05:00
|
|
|
|
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
### basic moves
|
2020-11-27 05:33:55 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
- **void gotoPan(const int16_t pan)**
|
|
|
|
- **int16_t getPan()**
|
|
|
|
- **void gotoTilt(const int16_t tilt)**
|
|
|
|
- **int16_t getTilt()**
|
|
|
|
- **void gotoPanTilt(const int16_t pan, const int16_t tilt)**
|
2020-11-27 05:33:55 -05:00
|
|
|
|
|
|
|
|
2022-11-23 07:53:23 -05:00
|
|
|
### memory positions - store / recall
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
- **uint8_t getMaxPositions()**
|
2021-12-27 14:23:58 -05:00
|
|
|
- **bool setPosition(const uint8_t index, const int16_t pan, const int16_t tilt)**
|
|
|
|
- **bool getPosition(const uint8_t index, int16_t & pan, int16_t & tilt)**
|
|
|
|
- **bool gotoPosition(const uint8_t index)**
|
2021-01-29 06:31:58 -05:00
|
|
|
- **void setHomePosition(const int16_t pan, const int16_t tilt)**
|
|
|
|
- **void gotoHomePosition()**
|
|
|
|
|
2020-11-27 05:33:55 -05:00
|
|
|
|
2022-11-23 07:53:23 -05:00
|
|
|
### feedback on position
|
2020-11-27 05:33:55 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
- **bool isMoving()**
|
|
|
|
- **bool isPanMoving()**
|
|
|
|
- **bool isTiltMoving()**
|
2013-09-30 12:46:09 -04:00
|
|
|
|
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
## Operation
|
|
|
|
|
|
|
|
See examples
|
2013-09-30 12:46:09 -04:00
|
|
|
|
|
|
|
|
2021-12-27 14:23:58 -05:00
|
|
|
## Future
|
|
|
|
|
2023-11-16 14:08:09 -05:00
|
|
|
#### Must
|
|
|
|
|
2022-11-23 07:53:23 -05:00
|
|
|
- build the thing when time permits!
|
2021-12-27 14:23:58 -05:00
|
|
|
- improve documentation.
|
2022-11-23 07:53:23 -05:00
|
|
|
|
2023-11-16 14:08:09 -05:00
|
|
|
#### Should
|
|
|
|
|
2021-12-27 14:23:58 -05:00
|
|
|
- test more (e.g. continuous servo versus 180 servo).
|
|
|
|
- add sketches.
|
|
|
|
- remember lastPing (angle pan tilt).
|
|
|
|
- check TODO's in code.
|
2022-11-23 07:53:23 -05:00
|
|
|
- move code from .h to .cpp
|
|
|
|
|
2023-11-16 14:08:09 -05:00
|
|
|
#### Could
|
2022-11-23 07:53:23 -05:00
|
|
|
|
2021-12-27 14:23:58 -05:00
|
|
|
- single servo radar (Pan only) as derived class.
|
|
|
|
- dynamic allocation of position arrays.
|
2022-11-23 07:53:23 -05:00
|
|
|
- store positions in EEPROM/FRAM for reboot?
|
2021-12-27 14:23:58 -05:00
|
|
|
|
2023-11-16 14:08:09 -05:00
|
|
|
#### Wont
|
|
|
|
|
|
|
|
|
|
|
|
## Support
|
|
|
|
|
|
|
|
If you appreciate my libraries, you can support the development and maintenance.
|
|
|
|
Improve the quality of the libraries by providing issues and Pull Requests, or
|
|
|
|
donate through PayPal or GitHub sponsors.
|
2021-12-27 14:23:58 -05:00
|
|
|
|
2023-11-16 14:08:09 -05:00
|
|
|
Thank you,
|