Updated documentation
This commit is contained in:
parent
a40d0bf34b
commit
7e95d89579
@ -3,9 +3,10 @@
|
||||
#include "Thing.h"
|
||||
#include "Things/DifferentialDrive.h"
|
||||
|
||||
/// @brief Support for a DRV8833 motor controller
|
||||
namespace RoboidControl {
|
||||
namespace Arduino {
|
||||
|
||||
/// @brief Support for a DRV8833 motor controller
|
||||
class DRV8833Motor : public Thing {
|
||||
public:
|
||||
/// @brief Motor turning direction
|
||||
@ -15,10 +16,7 @@ class DRV8833Motor : public Thing {
|
||||
/// @param pinIn1 the pin number for the in1 signal
|
||||
/// @param pinIn2 the pin number for the in2 signal
|
||||
/// @param direction the forward turning direction of the motor
|
||||
DRV8833Motor(Participant* participant,
|
||||
unsigned char pinIn1,
|
||||
unsigned char pinIn2,
|
||||
bool reverse = false);
|
||||
DRV8833Motor(Participant* participant, unsigned char pinIn1, unsigned char pinIn2, bool reverse = false);
|
||||
void SetMaxRPM(unsigned int rpm);
|
||||
|
||||
virtual void SetAngularVelocity(Spherical velocity) override;
|
||||
@ -58,4 +56,5 @@ class DRV8833 : public Thing {
|
||||
unsigned char pinStandby = 255;
|
||||
};
|
||||
|
||||
} // namespace Arduino
|
||||
} // namespace RoboidControl
|
@ -5,13 +5,19 @@
|
||||
namespace RoboidControl {
|
||||
namespace Arduino {
|
||||
|
||||
/// @brief A digital input represents the stat of a digital GPIO pin
|
||||
class DigitalInput : public TouchSensor {
|
||||
public:
|
||||
/// @brief Create a new digital input
|
||||
/// @param participant The participant to use
|
||||
/// @param pin The digital pin
|
||||
DigitalInput(Participant* participant, unsigned char pin);
|
||||
|
||||
/// @copydoc RoboidControl::Thing::Update(unsigned long currentTimeMs)
|
||||
virtual void Update(unsigned long currentTimeMs) override;
|
||||
|
||||
protected:
|
||||
/// @brief The pin used for digital input
|
||||
unsigned char pin = 0;
|
||||
};
|
||||
|
||||
|
@ -5,25 +5,35 @@
|
||||
namespace RoboidControl {
|
||||
namespace Arduino {
|
||||
|
||||
/// @brief An HC-SR04 ultrasonic distance sensor
|
||||
class UltrasonicSensor : public TouchSensor {
|
||||
public:
|
||||
/// @brief Setup an ultrasonic sensor
|
||||
/// @param participant The participant to use
|
||||
/// @param pinTrigger The pin number of the trigger signal
|
||||
/// @param pinEcho The pin number of the echo signal
|
||||
UltrasonicSensor(Participant* participant, unsigned char pinTrigger, unsigned char pinEcho);
|
||||
|
||||
// parameters
|
||||
|
||||
/// @brief The distance at which the object is considered to be touched
|
||||
float touchDistance = 0.2f;
|
||||
|
||||
// state
|
||||
|
||||
/// @brief The last read distance
|
||||
float distance = 0;
|
||||
/// @brief erform an ultrasonic 'ping' to determine the distance to the nearest object
|
||||
/// @return the measured distance in meters to the nearest object
|
||||
float GetDistance();
|
||||
|
||||
/// @copydoc RoboidControl::Thing::Update(unsigned long currentTimeMs)
|
||||
virtual void Update(unsigned long currentTimeMs) override;
|
||||
|
||||
// virtual void ProcessBinary(char* bytes) override;
|
||||
|
||||
protected:
|
||||
/// @brief The pin number of the trigger signal
|
||||
unsigned char pinTrigger = 0;
|
||||
/// @brief The pin number of the echo signal
|
||||
unsigned char pinEcho = 0;
|
||||
};
|
||||
|
||||
|
@ -31,8 +31,9 @@ namespace RoboidControl {
|
||||
/// An participant can be isolated. In that case it is standalong and does not communicate with other participants.
|
||||
///
|
||||
/// It is possible to work with an hidden participant by creating things without specifying a participant in the
|
||||
/// constructor (@sa RoboidControl::Thing::Thing()). In that case an hidden isolated participant is created which can be
|
||||
/// constructor. In that case an hidden isolated participant is created which can be
|
||||
/// obtained using RoboidControl::LocalParticipant::Isolated().
|
||||
/// @sa RoboidControl::Thing::Thing()
|
||||
class LocalParticipant : public Participant {
|
||||
public:
|
||||
/// @brief Create a participant without connecting to a site
|
||||
|
@ -30,9 +30,5 @@ unsigned char BinaryMsg::Serialize(char* buffer) {
|
||||
return ix;
|
||||
}
|
||||
|
||||
BinaryMsg BinaryMsg::Receive(char* buffer, unsigned char bufferSize) {
|
||||
BinaryMsg msg = BinaryMsg(buffer);
|
||||
return msg;
|
||||
}
|
||||
|
||||
} // namespace RoboidControl
|
||||
|
@ -4,25 +4,35 @@
|
||||
|
||||
namespace RoboidControl {
|
||||
|
||||
/// @brief Message to send thing-specific data
|
||||
class BinaryMsg : public IMessage {
|
||||
public:
|
||||
/// @brief The message ID
|
||||
static const unsigned char id = 0xB1;
|
||||
/// @brief The length of the message without the binary data itslef
|
||||
static const unsigned length = 3;
|
||||
|
||||
/// @brief The network ID of the thing
|
||||
unsigned char networkId;
|
||||
/// @brief The ID of the thing
|
||||
unsigned char thingId;
|
||||
/// @brief The thing for which the binary data is communicated
|
||||
Thing* thing;
|
||||
|
||||
unsigned char bytesSize;
|
||||
/// @brief The binary data which is communicated
|
||||
char* bytes = nullptr;
|
||||
|
||||
BinaryMsg(char* buffer);
|
||||
/// @brief Create a new message for sending
|
||||
/// @param networkId The network ID of the thing
|
||||
/// @param thing The thing for which binary data is sent
|
||||
BinaryMsg(unsigned char networkId, Thing* thing);
|
||||
/// @copydoc RoboidControl::IMessage::IMessage(char*)
|
||||
BinaryMsg(char* buffer);
|
||||
/// @brief Destructor for the message
|
||||
virtual ~BinaryMsg();
|
||||
|
||||
/// @copydoc RoboidControl::IMessage::Serialize
|
||||
virtual unsigned char Serialize(char* buffer) override;
|
||||
|
||||
static BinaryMsg Receive(char* buffer, unsigned char bufferSize);
|
||||
};
|
||||
|
||||
} // namespace RoboidControl
|
||||
|
Loading…
x
Reference in New Issue
Block a user