iCub-main
FakeSimulation.cpp
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 #include "FakeSimulation.h"
22 #include <yarp/os/LogStream.h>
23 
24 #include <stdio.h>
25 
26 void FakeSimulation::simLoop(int h, int w) {
27  int n = 600;
28  for (int i=0; i<n; i++) {
29  if ((i+1)%10==0) {
30  yDebug("Fake simulation cycle %d of %d\n", i+1, n);
31  }
32  streamer->sendVision();
33  yarp::os::Time::delay(0.1);
34  }
35 }
36 
37 bool FakeSimulation::getTrqData(yarp::os::Bottle data)
38 {
39  return true;
40 }
41 
42 
43 bool FakeSimulation::getImage(yarp::sig::ImageOf<yarp::sig::PixelRgb>& img) {
44  img.resize(320,240);
45  img.zero();
46  for (int i=0; i<img.width(); i++) {
47  img(i,at).b = 255;
48  }
49  at = (at+1) % img.height();
50  return true;
51 }
h
h
Definition: compute_ekf_sym.m:23
RobotStreamer::sendVision
virtual void sendVision()=0
FakeSimulation.h
FakeSimulation::getImage
virtual bool getImage(yarp::sig::ImageOf< yarp::sig::PixelRgb > &img)
Definition: FakeSimulation.cpp:43
data
@ data
Definition: ST_M1_dataType.h:64
FakeSimulation::getTrqData
virtual bool getTrqData(yarp::os::Bottle data)
Definition: FakeSimulation.cpp:37
n
int n
Definition: debugFunctions.cpp:58
FakeSimulation::simLoop
virtual void simLoop(int h, int w)
Run the simulation.
Definition: FakeSimulation.cpp:26