YARP
Yet Another Robot Platform
FakeMotor.cpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include "FakeMotor.h"
8 
9 YARP_LOG_COMPONENT(FAKEMOTOR, "yarp.device.fakeMotor")
10 
11 void FakeMotor::update()
12 {
13  if (posMode) {
14  return;
15  }
16 
17  double now = yarp::os::Time::now();
18  if (last < 0) {
19  last = now;
20  }
21  double dt = now - last;
22  for (int i=0; i<njoints; i++) {
23  pos[i] += vel[i] * dt;
24  }
25  last = now;
26 }
27 
28 
30 {
31  yCWarning(FAKEMOTOR, "'test_motor' was renamed 'fakeMotor'. The old name is still supported for compatibility, but it will be deprecated and removed in a future release. Please update your scripts");
32  return FakeMotor::open(config);
33 }
const yarp::os::LogComponent & FAKEMOTOR()
Definition: FakeMotor.cpp:9
fakeMotor deprecated: A fake motor control board for testing.
Definition: FakeMotor.h:35
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
Definition: FakeMotor.h:63
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
Definition: FakeMotor.cpp:29
A base class for nested structures that can be searched.
Definition: Searchable.h:66
#define yCWarning(component,...)
Definition: LogComponent.h:143
#define YARP_LOG_COMPONENT(name,...)
Definition: LogComponent.h:77
double now()
Return the current time in seconds, relative to an arbitrary starting point.
Definition: Time.cpp:121