iCub-main
FakeLogicalJoints.h
Go to the documentation of this file.
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
3 /*
4 * Copyright (C) 2010 RobotCub Consortium, European Commission FP6 Project IST-004370
5 * Author: Paul Fitzpatrick
6 * email: paulfitz@alum.mit.edu
7 * website: www.robotcub.org
8 * Permission is granted to copy, distribute, and/or modify this program
9 * under the terms of the GNU General Public License, version 2 or any
10 * later version published by the Free Software Foundation.
11 *
12 * A copy of the license can be found at
13 * http://www.robotcub.org/icub/license/gpl.txt
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
18 * Public License for more details
19 */
20 
21 #ifndef ICUBSIMULATION_FAKELOGICALJOINTS_INC
22 #define ICUBSIMULATION_FAKELOGICALJOINTS_INC
23 
24 #include "LogicalJoints.h"
25 #include "FakeLogicalJoint.h"
26 
27 #include <map>
28 
30 private:
31  std::map<int,FakeLogicalJoint> joints;
32 public:
33  virtual LogicalJoint& control(int part, int axis) {
34  int idx = part*100+axis;
35  std::map<int,FakeLogicalJoint>::iterator it = joints.find(idx);
36  if (it==joints.end()) {
37  return joints[idx] = FakeLogicalJoint();
38  }
39  return it->second;
40  }
41 };
42 
43 #endif
LogicalJoint
Abstract class for mapping from "physical" (simulated) joints in the model to control joints in the I...
Definition: LogicalJoint.h:33
FakeLogicalJoints::control
virtual LogicalJoint & control(int part, int axis)
Access the control for a logical joint, based on part and axis number.
Definition: FakeLogicalJoints.h:33
LogicalJoints.h
FakeLogicalJoint.h
FakeLogicalJoints
Definition: FakeLogicalJoints.h:29
FakeLogicalJoint
Definition: FakeLogicalJoint.h:28
LogicalJoints
Route control for the robots controlled joints to their implementation.
Definition: LogicalJoints.h:31
idx
static uint32_t idx[BOARD_NUM]
Definition: debugFunctions.cpp:34