carmenwrapper.h
Go to the documentation of this file.
1 /*****************************************************************
2  *
3  * This file is part of the GMAPPING project
4  *
5  * GMAPPING Copyright (c) 2004 Giorgio Grisetti,
6  * Cyrill Stachniss, and Wolfram Burgard
7  *
8  * This software is licensed under the "Creative Commons
9  * License (Attribution-NonCommercial-ShareAlike 2.0)"
10  * and is copyrighted by Giorgio Grisetti, Cyrill Stachniss,
11  * and Wolfram Burgard.
12  *
13  * Further information on this license can be found at:
14  * http://creativecommons.org/licenses/by-nc-sa/2.0/
15  *
16  * GMAPPING is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied
18  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19  * PURPOSE.
20  *
21  *****************************************************************/
22 
23 
24 #ifndef CARMENWRAPPER_H
25 #define CARMENWRAPPER_H
26 
27 #include <iostream>
28 #include <deque>
29 #include <pthread.h>
30 #include <semaphore.h>
31 #include <carmen/carmen.h>
32 #include <carmen/global.h>
35 #include <log/sensorstream.h>
36 #include <log/sensorlog.h>
39 
40 namespace GMapping{
41 
43 public:
44  static void initializeIPC(const char* name);
45  static bool start(const char* name);
46  static bool isRunning();
47  static void lock();
48  static void unlock();
49  static int registerLocalizationMessages();
50 
51  static int queueLength();
52  static OrientedPoint getTruePos();
53  static bool getReading(RangeReading& reading);
54  static void addReading(RangeReading& reading);
55  static const SensorMap& sensorMap();
56  static bool sensorMapComputed();
57  static bool isStopped();
58 
59 // conversion function
60  static carmen_robot_laser_message reading2carmen(const RangeReading& reading);
61  static RangeReading carmen2reading(const carmen_robot_laser_message& msg);
62  static carmen_point_t point2carmen (const OrientedPoint& p);
63  static OrientedPoint carmen2point (const carmen_point_t& p);
64 
65 
66 // carmen interaction
67  static void robot_frontlaser_handler(carmen_robot_laser_message* frontlaser);
68  static void robot_rearlaser_handler(carmen_robot_laser_message* frontlaser);
69  static void simulator_truepos_handler(carmen_simulator_truepos_message* truepos);
70  //babsi:
71  static void navigator_go_handler(MSG_INSTANCE msgRef, BYTE_ARRAY callData, void*) ;
72  static void navigator_stop_handler(MSG_INSTANCE msgRef, BYTE_ARRAY callData, void*) ;
73 
74  //babsi:
75  static void publish_globalpos(carmen_localize_summary_p summary);
76  static void publish_particles(carmen_localize_particle_filter_p filter,
77  carmen_localize_summary_p summary);
78 
79  static void shutdown_module(int sig);
80 
81  private:
82  static std::deque<RangeReading> m_rangeDeque;
83  static sem_t m_dequeSem;
84  static pthread_mutex_t m_mutex, m_lock;
85  static pthread_t m_readingThread;
86  static void * m_reading_function(void*);
87  static bool m_threadRunning;
91  static bool stopped;
92 };
93 
94 } //end namespace
95 
96 
97 
98 #endif
99 /*
100 int main (int argc, char** argv) {
101 
102  CarmenWrapper::init_carmen(argc, argv);
103  while (true) {
104  IPC_listenWait(100);
105  }
106  return 1;
107 }
108 */
static carmen_point_t point2carmen(const OrientedPoint &p)
static SensorMap m_sensorMap
Definition: carmenwrapper.h:88
static OrientedPoint carmen2point(const carmen_point_t &p)
static carmen_robot_laser_message reading2carmen(const RangeReading &reading)
static pthread_mutex_t m_mutex
Definition: carmenwrapper.h:84
static void robot_rearlaser_handler(carmen_robot_laser_message *frontlaser)
static OrientedPoint getTruePos()
static RangeSensor * m_frontLaser
Definition: carmenwrapper.h:89
static std::deque< RangeReading > m_rangeDeque
Definition: carmenwrapper.h:82
static void addReading(RangeReading &reading)
static void initializeIPC(const char *name)
static void navigator_stop_handler(MSG_INSTANCE msgRef, BYTE_ARRAY callData, void *)
static void robot_frontlaser_handler(carmen_robot_laser_message *frontlaser)
static void * m_reading_function(void *)
static pthread_mutex_t m_lock
Definition: carmenwrapper.h:84
static bool sensorMapComputed()
static bool start(const char *name)
static void navigator_go_handler(MSG_INSTANCE msgRef, BYTE_ARRAY callData, void *)
std::map< std::string, Sensor * > SensorMap
Definition: sensor.h:19
static bool m_threadRunning
Definition: carmenwrapper.h:87
static RangeSensor * m_rearLaser
Definition: carmenwrapper.h:89
static void shutdown_module(int sig)
static void publish_globalpos(carmen_localize_summary_p summary)
static const SensorMap & sensorMap()
static void simulator_truepos_handler(carmen_simulator_truepos_message *truepos)
static void publish_particles(carmen_localize_particle_filter_p filter, carmen_localize_summary_p summary)
static int registerLocalizationMessages()
static RangeReading carmen2reading(const carmen_robot_laser_message &msg)
static bool getReading(RangeReading &reading)
static pthread_t m_readingThread
Definition: carmenwrapper.h:85
static OrientedPoint m_truepos
Definition: carmenwrapper.h:90


openslam_gmapping
Author(s): Giorgio Grisetti, Cyrill Stachniss, Wolfram Burgard
autogenerated on Mon Jun 10 2019 14:04:22