mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.1.7 RADAR
This commit is contained in:
parent
f51785194d
commit
f121659f29
@ -1,5 +1,21 @@
|
||||
platforms:
|
||||
rpipico:
|
||||
board: rp2040:rp2040:rpipico
|
||||
package: rp2040:rp2040
|
||||
gcc:
|
||||
features:
|
||||
defines:
|
||||
- ARDUINO_ARCH_RP2040
|
||||
warnings:
|
||||
flags:
|
||||
|
||||
packages:
|
||||
rp2040:rp2040:
|
||||
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
|
||||
|
||||
compile:
|
||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||
# selected only those that work
|
||||
platforms:
|
||||
- uno
|
||||
# - due
|
||||
@ -7,5 +23,6 @@ compile:
|
||||
# - leonardo
|
||||
- m4
|
||||
- esp32
|
||||
# - esp8266
|
||||
- esp8266
|
||||
# - mega2560
|
||||
- rpipico
|
||||
|
42
libraries/Radar/CHANGELOG.md
Normal file
42
libraries/Radar/CHANGELOG.md
Normal file
@ -0,0 +1,42 @@
|
||||
# Change Log Radar
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
## [0.1.7] - 2022-11-23
|
||||
- add changelog.md
|
||||
- add RP2040 to build-CI
|
||||
- fix keywords.txt
|
||||
- minor edit readme.md
|
||||
- minor edit unit test
|
||||
|
||||
|
||||
## [0.1.6] - 2021-12-27
|
||||
- update library.json
|
||||
- update readme.md
|
||||
- update license
|
||||
- minor edits
|
||||
|
||||
## [0.1.5] - 2021-05-27
|
||||
- fix Arduino-lint
|
||||
|
||||
## [0.1.4] - 2021-01-07
|
||||
- Arduino-CI, unit-test
|
||||
|
||||
## [0.1.3] - 2020-07-06
|
||||
- refactor
|
||||
- clean up
|
||||
- documentation
|
||||
|
||||
## [0.1.2] - 2017-07-16
|
||||
- refactor & review
|
||||
|
||||
## [0.1.01] - 2015-03-06
|
||||
- updated some code, still not functional
|
||||
|
||||
## [0.1.00] - 2013-09-30 (oldest version found ?)
|
||||
- outline the idea
|
||||
|
@ -1,9 +1,8 @@
|
||||
# Syntax Colouring Map for runningAngle
|
||||
# Syntax Colouring Map for RADAR
|
||||
|
||||
|
||||
# Data types (KEYWORD1)
|
||||
runningAngle KEYWORD1
|
||||
AngleType KEYWORD1
|
||||
RADAR KEYWORD1
|
||||
|
||||
|
||||
# Methods and Functions (KEYWORD2)
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/RADAR"
|
||||
},
|
||||
"version": "0.1.6",
|
||||
"version": "0.1.7",
|
||||
"license": "MIT",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "*",
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=RADAR
|
||||
version=0.1.6
|
||||
version=0.1.7
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for a pan tilt radar.
|
||||
|
@ -1,18 +1,10 @@
|
||||
//
|
||||
// FILE: radar.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.6
|
||||
// VERSION: 0.1.7
|
||||
// PURPOSE: Arduino library for a pan tilt radar.
|
||||
// URL: https://github.com/RobTillaart/RADAR
|
||||
//
|
||||
// HISTORY
|
||||
// 0.1.00 2013-09-30 (?) outline
|
||||
// 0.1.01 2015-03-06 updated some code, still not functional
|
||||
// 0.1.2 2017-07-16 refactor & review
|
||||
// 0.1.3 2020-07-06 refactor, clean up and some documentation
|
||||
// 0.1.4 2021-01-07 Arduino-CI, unit-test
|
||||
// 0.1.5 2021-05-27 fix Arduino-lint
|
||||
// 0.1.6 2021-12-27 Update library.json, readme, license, minor edits
|
||||
|
||||
|
||||
|
||||
#include "radar.h"
|
||||
@ -41,7 +33,10 @@ RADAR::RADAR(const uint8_t pinPan, const uint8_t pinTilt)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PUBLIC
|
||||
//
|
||||
void RADAR::gotoPan(const int16_t pan)
|
||||
{
|
||||
if (pan == _pan) return;
|
||||
@ -145,7 +140,7 @@ void RADAR::gotoHomePosition()
|
||||
|
||||
uint32_t RADAR::ping()
|
||||
{
|
||||
// TODO ping code here - playground or teckel's improved ping)))
|
||||
// TODO ping code here - playground or teckel's improved ping))) ?
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -157,10 +152,16 @@ uint32_t RADAR::ping(const int16_t pan, const int16_t tilt)
|
||||
while (isMoving());
|
||||
return ping();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PRIVATE
|
||||
//
|
||||
|
||||
// TODO distil private parts (getPan and getTilt share a lot
|
||||
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// FILE: radar.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.6
|
||||
// VERSION: 0.1.7
|
||||
// PURPOSE: Arduino library for a pan tilt radar.
|
||||
// URL: https://github.com/RobTillaart/RADAR
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
#include "Arduino.h"
|
||||
|
||||
|
||||
#define RADAR_LIB_VERSION (F("0.1.6"))
|
||||
#define RADAR_LIB_VERSION (F("0.1.7"))
|
||||
|
||||
|
||||
// TODO # positions in a begin() or constructor?
|
||||
@ -24,12 +24,14 @@ class RADAR
|
||||
public:
|
||||
RADAR(const uint8_t pinPan, const uint8_t pinTilt);
|
||||
|
||||
|
||||
// no valid range checking or negative value check.
|
||||
void setPanPerSecond(float pps) { _panPerSecond = pps; };
|
||||
float getPanPerSecond() { return _panPerSecond; };
|
||||
void setTiltPerSecond(float tps) { _tiltPerSecond = tps; };
|
||||
float getTiltPerSecond() { return _tiltPerSecond; };
|
||||
|
||||
|
||||
// basic moves
|
||||
void gotoPan(const int16_t pan);
|
||||
int16_t getPan();
|
||||
@ -37,6 +39,7 @@ public:
|
||||
int16_t getTilt();
|
||||
void gotoPanTilt(const int16_t pan, const int16_t tilt);
|
||||
|
||||
|
||||
// memory positions - store / recall?
|
||||
uint8_t getMaxPositions() { return RADAR_POSITIONS; };
|
||||
bool setPosition(const uint8_t index, const int16_t pan, const int16_t tilt);
|
||||
@ -45,15 +48,18 @@ public:
|
||||
void setHomePosition(const int16_t pan, const int16_t tilt);
|
||||
void gotoHomePosition();
|
||||
|
||||
|
||||
// feedback on positions.
|
||||
bool isMoving() { return isPanMoving() || isTiltMoving(); };
|
||||
bool isPanMoving() { return getPan() != _pan; };
|
||||
bool isTiltMoving() { return getTilt() != _tilt; };
|
||||
|
||||
|
||||
// TODO NIY
|
||||
uint32_t ping();
|
||||
uint32_t ping(const int16_t pan, const int16_t tilt);
|
||||
|
||||
|
||||
private:
|
||||
int16_t _pinPan;
|
||||
int16_t _pinTilt;
|
||||
|
@ -32,14 +32,11 @@ From that number and the start moment one can determine approximately its positi
|
||||
Given its position while moving is interesting for radar purposes as one can determine e.g.
|
||||
in which direction a ping is given and therefore which distance belongs to which pair of angles.
|
||||
|
||||
Note: no active development
|
||||
Note: no active development.
|
||||
|
||||
|
||||
## Interface
|
||||
|
||||
TODO elaborate
|
||||
|
||||
|
||||
### Constructor and config
|
||||
|
||||
- **RADAR(pan, tilt)** define pan / tilt pins of the radar. These should be PWM pins.
|
||||
@ -60,7 +57,7 @@ Note: no valid range checking or negative value check.
|
||||
- **void gotoPanTilt(const int16_t pan, const int16_t tilt)**
|
||||
|
||||
|
||||
### memory positions - store / recall?
|
||||
### memory positions - store / recall
|
||||
|
||||
- **uint8_t getMaxPositions()**
|
||||
- **bool setPosition(const uint8_t index, const int16_t pan, const int16_t tilt)**
|
||||
@ -70,7 +67,7 @@ Note: no valid range checking or negative value check.
|
||||
- **void gotoHomePosition()**
|
||||
|
||||
|
||||
### feedback on positions.
|
||||
### feedback on position
|
||||
|
||||
- **bool isMoving()**
|
||||
- **bool isPanMoving()**
|
||||
@ -84,12 +81,21 @@ See examples
|
||||
|
||||
## Future
|
||||
|
||||
#### must
|
||||
- build the thing when time permits!
|
||||
- improve documentation.
|
||||
|
||||
#### should
|
||||
- test more (e.g. continuous servo versus 180 servo).
|
||||
- add sketches.
|
||||
- remember lastPing (angle pan tilt).
|
||||
- check TODO's in code.
|
||||
- move code from .h to .cpp
|
||||
|
||||
|
||||
#### could
|
||||
- single servo radar (Pan only) as derived class.
|
||||
- dynamic allocation of position arrays.
|
||||
- store positions in EEPROM/FRAM for reboot?
|
||||
|
||||
|
||||
|
@ -46,18 +46,11 @@ unittest_teardown()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
unittest(test_new_operator)
|
||||
{
|
||||
assertEqualINF(exp(800));
|
||||
assertEqualINF(0.0/0.0);
|
||||
assertEqualINF(42);
|
||||
|
||||
assertEqualNAN(INFINITY - INFINITY);
|
||||
assertEqualNAN(0.0/0.0);
|
||||
assertEqualNAN(42);
|
||||
unittest(test_constants)
|
||||
{
|
||||
assertEqual(10, RADAR_POSITIONS);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
unittest(test_constructor)
|
||||
|
Loading…
Reference in New Issue
Block a user