mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.1.6 Radar
This commit is contained in:
parent
84c364e1e0
commit
b0789477d2
@ -2,6 +2,10 @@ compile:
|
|||||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||||
platforms:
|
platforms:
|
||||||
- uno
|
- uno
|
||||||
- leonardo
|
# - due
|
||||||
- due
|
# - zero
|
||||||
- zero
|
# - leonardo
|
||||||
|
- m4
|
||||||
|
- esp32
|
||||||
|
# - esp8266
|
||||||
|
# - mega2560
|
||||||
|
@ -4,10 +4,14 @@ name: Arduino CI
|
|||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
arduino_ci:
|
runTest:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: Arduino-CI/action@master
|
- uses: ruby/setup-ruby@v1
|
||||||
# Arduino-CI/action@v0.1.1
|
with:
|
||||||
|
ruby-version: 2.6
|
||||||
|
- run: |
|
||||||
|
gem install arduino_ci
|
||||||
|
arduino_ci.rb
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2013-2021 Rob Tillaart
|
Copyright (c) 2013-2022 Rob Tillaart
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
//
|
//
|
||||||
// FILE: radarDemo.ino
|
// FILE: radarDemo.ino
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.1.1
|
|
||||||
// PURPOSE: demo of the radar library
|
// PURPOSE: demo of the radar library
|
||||||
// DATE: 29-03-2015
|
// DATE: 29-03-2015
|
||||||
// URL: https://github.com/RobTillaart/RADAR
|
// URL: https://github.com/RobTillaart/RADAR
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# Syntax Coloring Map for runningAngle
|
# Syntax Colouring Map for runningAngle
|
||||||
|
|
||||||
|
|
||||||
# Datatypes (KEYWORD1)
|
# Data types (KEYWORD1)
|
||||||
runningAngle KEYWORD1
|
runningAngle KEYWORD1
|
||||||
AngleType KEYWORD1
|
AngleType KEYWORD1
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "RADAR",
|
"name": "RADAR",
|
||||||
"keywords": "Pan,tilt,radar,ping",
|
"keywords": "Pan,tilt,radar,ping,position",
|
||||||
"description": "Arduino library for a pan tilt radar. Experimental",
|
"description": "Arduino library for a pan tilt radar. Experimental",
|
||||||
"authors":
|
"authors":
|
||||||
[
|
[
|
||||||
@ -15,8 +15,9 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/RobTillaart/RADAR"
|
"url": "https://github.com/RobTillaart/RADAR"
|
||||||
},
|
},
|
||||||
"version": "0.1.5",
|
"version": "0.1.6",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"frameworks": "arduino",
|
"frameworks": "arduino",
|
||||||
"platforms": "*"
|
"platforms": "*",
|
||||||
|
"headers": "radar.h"
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=RADAR
|
name=RADAR
|
||||||
version=0.1.5
|
version=0.1.6
|
||||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
sentence=Arduino library for a pan tilt radar.
|
sentence=Arduino library for a pan tilt radar.
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
//
|
//
|
||||||
// FILE: radar.cpp
|
// FILE: radar.cpp
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.1.5
|
// VERSION: 0.1.6
|
||||||
// PURPOSE: Arduino library for a pan tilt radar.
|
// PURPOSE: Arduino library for a pan tilt radar.
|
||||||
// URL: https://github.com/RobTillaart/RADAR
|
// URL: https://github.com/RobTillaart/RADAR
|
||||||
//
|
//
|
||||||
|
// HISTORY
|
||||||
// 0.1.00 2013-09-30 (?) outline
|
// 0.1.00 2013-09-30 (?) outline
|
||||||
// 0.1.01 2015-03-06 updated some code, still not functional
|
// 0.1.01 2015-03-06 updated some code, still not functional
|
||||||
// 0.1.2 2017-07-16 refactor & review
|
// 0.1.2 2017-07-16 refactor & review
|
||||||
// 0.1.3 2020-07-06 refactor, clean up and some documentation
|
// 0.1.3 2020-07-06 refactor, clean up and some documentation
|
||||||
// 0.1.4 2021-01-07 arduino-ci, unit-test
|
// 0.1.4 2021-01-07 Arduino-CI, unit-test
|
||||||
// 0.1.5 2021-05-27 fix arduino-lint
|
// 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"
|
#include "radar.h"
|
||||||
@ -100,29 +102,29 @@ void RADAR::gotoPanTilt(const int16_t pan, const int16_t tilt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool RADAR::setPosition(const uint8_t n, const int16_t pan, const int16_t tilt)
|
bool RADAR::setPosition(const uint8_t index, const int16_t pan, const int16_t tilt)
|
||||||
{
|
{
|
||||||
if (n >= RADAR_POSITIONS) return false;
|
if (index >= RADAR_POSITIONS) return false;
|
||||||
_panArray[n] = pan;
|
_panArray[index] = pan;
|
||||||
_tiltArray[n] = tilt;
|
_tiltArray[index] = tilt;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool RADAR::getPosition(const uint8_t n, int16_t & pan, int16_t & tilt)
|
bool RADAR::getPosition(const uint8_t index, int16_t & pan, int16_t & tilt)
|
||||||
{
|
{
|
||||||
if (n >= RADAR_POSITIONS) return false;
|
if (index >= RADAR_POSITIONS) return false;
|
||||||
pan = _panArray[n];
|
pan = _panArray[index];
|
||||||
tilt = _tiltArray[n];
|
tilt = _tiltArray[index];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool RADAR::gotoPosition(const uint8_t n)
|
bool RADAR::gotoPosition(const uint8_t index)
|
||||||
{
|
{
|
||||||
if (n >= RADAR_POSITIONS) return false;
|
if (index >= RADAR_POSITIONS) return false;
|
||||||
gotoPan(_panArray[n]);
|
gotoPan(_panArray[index]);
|
||||||
gotoTilt(_tiltArray[n]);
|
gotoTilt(_tiltArray[index]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +159,8 @@ uint32_t RADAR::ping(const int16_t pan, const int16_t tilt)
|
|||||||
}
|
}
|
||||||
// PRIVATE
|
// PRIVATE
|
||||||
|
|
||||||
// TODO distill private parts (getPan and getTilt share a lot
|
// TODO distil private parts (getPan and getTilt share a lot
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// FILE: radar.h
|
// FILE: radar.h
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: see RADAR_LIB_VERSION
|
// VERSION: 0.1.6
|
||||||
// PURPOSE: Arduino library for a pan tilt radar.
|
// PURPOSE: Arduino library for a pan tilt radar.
|
||||||
// URL: https://github.com/RobTillaart/RADAR
|
// URL: https://github.com/RobTillaart/RADAR
|
||||||
|
|
||||||
@ -10,7 +10,7 @@
|
|||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
|
|
||||||
|
|
||||||
#define RADAR_LIB_VERSION (F("0.1.5"))
|
#define RADAR_LIB_VERSION (F("0.1.6"))
|
||||||
|
|
||||||
|
|
||||||
// TODO # positions in a begin() or constructor?
|
// TODO # positions in a begin() or constructor?
|
||||||
@ -39,9 +39,9 @@ public:
|
|||||||
|
|
||||||
// memory positions - store / recall?
|
// memory positions - store / recall?
|
||||||
uint8_t getMaxPositions() { return RADAR_POSITIONS; };
|
uint8_t getMaxPositions() { return RADAR_POSITIONS; };
|
||||||
bool setPosition(const uint8_t idx, const int16_t pan, const int16_t tilt);
|
bool setPosition(const uint8_t index, const int16_t pan, const int16_t tilt);
|
||||||
bool getPosition(const uint8_t idx, int16_t & pan, int16_t & tilt);
|
bool getPosition(const uint8_t index, int16_t & pan, int16_t & tilt);
|
||||||
bool gotoPosition(const uint8_t idx);
|
bool gotoPosition(const uint8_t index);
|
||||||
void setHomePosition(const int16_t pan, const int16_t tilt);
|
void setHomePosition(const int16_t pan, const int16_t tilt);
|
||||||
void gotoHomePosition();
|
void gotoHomePosition();
|
||||||
|
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
|
|
||||||
[![Arduino CI](https://github.com/RobTillaart/Radar/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
|
[![Arduino CI](https://github.com/RobTillaart/Radar/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
|
||||||
|
[![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)
|
||||||
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/Radar/blob/master/LICENSE)
|
[![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)
|
[![GitHub release](https://img.shields.io/github/release/RobTillaart/Radar.svg?maxAge=3600)](https://github.com/RobTillaart/Radar/releases)
|
||||||
|
|
||||||
|
|
||||||
# Radar
|
# Radar
|
||||||
|
|
||||||
Arduino library for a pan tilt radar based upon 2 servo's.
|
Arduino library for a pan tilt radar based upon 2 servo's.
|
||||||
@ -11,22 +14,25 @@ Arduino library for a pan tilt radar based upon 2 servo's.
|
|||||||
## Warning
|
## Warning
|
||||||
|
|
||||||
**WARNING: not extensively tested**
|
**WARNING: not extensively tested**
|
||||||
There are stil a lot of things to be tested.
|
There are still a lot of things to be tested.
|
||||||
The example code is now working to show the concept.
|
The example code is now working to show the concept.
|
||||||
|
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
radar is a concept library not elaborated yet that implements a Ping))) based Radar
|
Radar is a concept library (not elaborated) that implements a Ping))) based Radar
|
||||||
with the use of two pan/tilt servo's. It was written after a question on the forum but
|
with the use of two pan and tilt servo's.
|
||||||
never finished or tested it. Still, it has some interesting concepts wrt determine
|
It was written after a question on the Arduino forum but never finished or tested it.
|
||||||
the position of pan/tilt while in progress.
|
Still, it has some interesting concepts with respect to how to determine the position
|
||||||
|
of pan/tilt while the movements are in progress.
|
||||||
|
|
||||||
The idea is that one knows how fast the pan and tilt servos are working in degrees per second.
|
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.
|
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.
|
Given its position while moving is interesting for radar purposes as one can determine e.g.
|
||||||
in which direction a ping is given and which distance belongs to which pair of angles.
|
in which direction a ping is given and therefore which distance belongs to which pair of angles.
|
||||||
|
|
||||||
|
Note: no active development
|
||||||
|
|
||||||
|
|
||||||
## Interface
|
## Interface
|
||||||
@ -57,9 +63,9 @@ Note: no valid range checking or negative value check.
|
|||||||
### memory positions - store / recall?
|
### memory positions - store / recall?
|
||||||
|
|
||||||
- **uint8_t getMaxPositions()**
|
- **uint8_t getMaxPositions()**
|
||||||
- **bool setPosition(const uint8_t idx, const int16_t pan, const int16_t tilt)**
|
- **bool setPosition(const uint8_t index, const int16_t pan, const int16_t tilt)**
|
||||||
- **bool getPosition(const uint8_t idx, int16_t & pan, int16_t & tilt)**
|
- **bool getPosition(const uint8_t index, int16_t & pan, int16_t & tilt)**
|
||||||
- **bool gotoPosition(const uint8_t idx)**
|
- **bool gotoPosition(const uint8_t index)**
|
||||||
- **void setHomePosition(const int16_t pan, const int16_t tilt)**
|
- **void setHomePosition(const int16_t pan, const int16_t tilt)**
|
||||||
- **void gotoHomePosition()**
|
- **void gotoHomePosition()**
|
||||||
|
|
||||||
@ -76,3 +82,14 @@ Note: no valid range checking or negative value check.
|
|||||||
See examples
|
See examples
|
||||||
|
|
||||||
|
|
||||||
|
## Future
|
||||||
|
|
||||||
|
- improve documentation.
|
||||||
|
- test more (e.g. continuous servo versus 180 servo).
|
||||||
|
- add sketches.
|
||||||
|
- remember lastPing (angle pan tilt).
|
||||||
|
- check TODO's in code.
|
||||||
|
- single servo radar (Pan only) as derived class.
|
||||||
|
- dynamic allocation of position arrays.
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
unittest_setup()
|
unittest_setup()
|
||||||
{
|
{
|
||||||
|
fprintf(stderr, "RADAR_LIB_VERSION: %s\n", (char *) RADAR_LIB_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -61,8 +62,6 @@ unittest(test_new_operator)
|
|||||||
|
|
||||||
unittest(test_constructor)
|
unittest(test_constructor)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "VERSION: %s\n", RADAR_LIB_VERSION);
|
|
||||||
|
|
||||||
RADAR radar(10, 11);
|
RADAR radar(10, 11);
|
||||||
|
|
||||||
assertEqual(10, radar.getMaxPositions());
|
assertEqual(10, radar.getMaxPositions());
|
||||||
|
Loading…
Reference in New Issue
Block a user