YARP
Yet Another Robot Platform
FakeMotor.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #include "FakeMotor.h"
11 
12 YARP_LOG_COMPONENT(FAKEMOTOR, "yarp.device.fakeMotor")
13 
14 void FakeMotor::update()
15 {
16  if (posMode) {
17  return;
18  }
19 
20  double now = yarp::os::Time::now();
21  if (last < 0) {
22  last = now;
23  }
24  double dt = now - last;
25  for (int i=0; i<njoints; i++) {
26  pos[i] += vel[i] * dt;
27  }
28  last = now;
29 }
30 
31 
33 {
34  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");
35  return FakeMotor::open(config);
36 }
FakeMotor.h
yarp::os::Searchable
A base class for nested structures that can be searched.
Definition: Searchable.h:69
yCWarning
#define yCWarning(component,...)
Definition: LogComponent.h:146
YARP_LOG_COMPONENT
#define YARP_LOG_COMPONENT(name,...)
Definition: LogComponent.h:80
yarp::os::Time::now
double now()
Return the current time in seconds, relative to an arbitrary starting point.
Definition: Time.cpp:124
FAKEMOTOR
const yarp::os::LogComponent & FAKEMOTOR()
Definition: FakeMotor.cpp:12
FakeMotor::open
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
Definition: FakeMotor.h:66
FakeMotor
fakeMotor: A fake motor control board for testing.
Definition: FakeMotor.h:38
TestMotor::open
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
Definition: FakeMotor.cpp:32