YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
ImplementMotorEncoders.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef YARP_DEV_IMPLEMENTMOTORENCODERS_H
7#define YARP_DEV_IMPLEMENTMOTORENCODERS_H
8
10
11namespace yarp::dev {
12class ImplementMotorEncoders;
13}
14
15namespace yarp::dev::impl {
16
17template <typename T>
18class FixedSizeBuffersManager;
19
20} // namespace yarp::dev::impl
21
23{
24protected:
25 IMotorEncodersRaw* m_iraw=nullptr;
26 void* m_helper=nullptr;
27 std::vector<int> m_buffer_ints;
28 std::vector<double> m_buffer_doubles;
29 std::vector<double> m_buffer_doubles2;
30 std::mutex m_imp_mutex;
31
32
41 bool initialize (int size, const int *amap, const double *enc, const double *zos);
42
47 bool uninitialize ();
48
49public:
50 /* Constructor.
51 * @param y is the pointer to the class instance inheriting from this
52 * implementation.
53 */
55
56
58
62 yarp::dev::ReturnValue setMotorEncoder(int m, const double val) override;
63 yarp::dev::ReturnValue setMotorEncoders(const double *vals) override;
64 yarp::dev::ReturnValue setMotorEncoderCountsPerRevolution(int m, const double cpr) override;
66 yarp::dev::ReturnValue getMotorEncoder(int m, double *v) override;
67 yarp::dev::ReturnValue getMotorEncodersTimed(double *encs, double *time) override;
68 yarp::dev::ReturnValue getMotorEncoderTimed(int m, double *v, double *t) override;
69 yarp::dev::ReturnValue getMotorEncoders(double *encs) override;
70 yarp::dev::ReturnValue getMotorEncoderSpeed(int m, double *spds) override;
71 yarp::dev::ReturnValue getMotorEncoderSpeeds(double *spds) override;
72 yarp::dev::ReturnValue getMotorEncoderAcceleration(int m, double *spds) override;
74};
75
76#endif // YARP_DEV_IMPLEMENTMOTORENCODERS_H
Control board, encoder interface.
Control board, encoder interface.
yarp::dev::ReturnValue getMotorEncoderCountsPerRevolution(int m, double *cpr) override
Gets number of counts per revolution for motor encoder m.
yarp::dev::ReturnValue getMotorEncodersTimed(double *encs, double *time) override
Read the instantaneous position of all motor encoders.
yarp::dev::ReturnValue setMotorEncoderCountsPerRevolution(int m, const double cpr) override
Sets number of counts per revolution for motor encoder m.
yarp::dev::ReturnValue resetMotorEncoders() override
Reset motor encoders.
bool uninitialize()
Clean up internal data and memory.
yarp::dev::ReturnValue getMotorEncoderTimed(int m, double *v, double *t) override
Read the instantaneous position of a motor encoder.
yarp::dev::ReturnValue getMotorEncoderSpeed(int m, double *spds) override
Read the instantaneous speed of a motor encoder.
yarp::dev::ReturnValue getMotorEncoderAccelerations(double *accs) override
Read the instantaneous acceleration of all motor encoders.
yarp::dev::ReturnValue getMotorEncoderAcceleration(int m, double *spds) override
Read the instantaneous acceleration of a motor encoder.
yarp::dev::ReturnValue resetMotorEncoder(int m) override
Reset motor encoder, single motor.
yarp::dev::ReturnValue getMotorEncoder(int m, double *v) override
Read the value of a motor encoder.
yarp::dev::ReturnValue setMotorEncoder(int m, const double val) override
Set the value of the motor encoder for a given motor.
yarp::dev::ReturnValue getMotorEncoders(double *encs) override
Read the position of all motor encoders.
yarp::dev::ReturnValue getMotorEncoderSpeeds(double *spds) override
Read the instantaneous speed of all motor encoders.
yarp::dev::ReturnValue setMotorEncoders(const double *vals) override
Set the value of all motor encoders.
yarp::dev::ReturnValue getNumberOfMotorEncoders(int *num) override
Get the number of available motor encoders.
bool initialize(int size, const int *amap, const double *enc, const double *zos)
Initialize the internal data and alloc memory.
For streams capable of holding different kinds of content, check what they actually have.
The main, catch-all namespace for YARP.
Definition dirs.h:16
#define YARP_dev_API
Definition api.h:18