~shadowrobot/sr-ros-interface/stable

« back to all changes in this revision

Viewing changes to sr_movements/include/sr_movements/movement_from_image.hpp

  • Committer: Ugo Cupcic
  • Date: 2011-09-27 16:23:25 UTC
  • mto: (1.39.1 sr-ros-interface)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: ugo@shadowrobot.com-20110927162325-1864bw3axyhk93g2
sr_movements: This package reads a specified bitmap and send targets by replaying the drawn movement.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * @file   movement_from_image.hpp
 
3
 * @author Ugo Cupcic <ugo@shadowrobot.com>
 
4
 * @date   Tue Sep 27 10:05:01 2011
 
5
 *
 
6
*
 
7
* Copyright 2011 Shadow Robot Company Ltd.
 
8
*
 
9
* This program is free software: you can redistribute it and/or modify it
 
10
* under the terms of the GNU General Public License as published by the Free
 
11
* Software Foundation, either version 2 of the License, or (at your option)
 
12
* any later version.
 
13
*
 
14
* This program is distributed in the hope that it will be useful, but WITHOUT
 
15
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
16
* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 
17
* more details.
 
18
*
 
19
* You should have received a copy of the GNU General Public License along
 
20
* with this program.  If not, see <http://www.gnu.org/licenses/>.
 
21
*
 
22
 * @brief  Reads a png file and creates a movement from it.
 
23
 *
 
24
 *
 
25
 */
 
26
 
 
27
 
 
28
#ifndef _MOVEMENT_FROM_IMAGE_HPP_
 
29
#define _MOVEMENT_FROM_IMAGE_HPP_
 
30
 
 
31
#include <png++/png.hpp>
 
32
#include "sr_movements/partial_movement.hpp"
 
33
 
 
34
namespace shadowrobot
 
35
{
 
36
  class MovementFromImage : public PartialMovement
 
37
  {
 
38
  public:
 
39
    MovementFromImage(std::string image_path);
 
40
    virtual ~MovementFromImage();
 
41
 
 
42
  protected:
 
43
    /**
 
44
     * Generates a movement from the given png file:
 
45
     *  - Reads the image from the top left corner, row by row.
 
46
     *  - The first encountered pixel is the target (the scale is
 
47
     *    the full range of the joint = the height of the png).
 
48
     *
 
49
     * @param image an image containing a movement.
 
50
     */
 
51
    void generate_movement( png::image<png::rgb_pixel> image);
 
52
  };
 
53
}
 
54
 
 
55
/* For the emacs weenies in the crowd.
 
56
Local Variables:
 
57
   c-basic-offset: 2
 
58
End:
 
59
*/
 
60
 
 
61
#endif