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 3-Clause BSD License
9  * and is copyrighted by Giorgio Grisetti, Cyrill Stachniss,
10  * and Wolfram Burgard.
11  *
12  * Further information on this license can be found at:
13  * https://opensource.org/licenses/BSD-3-Clause
14  *
15  * GMAPPING is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied
17  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18  * PURPOSE.
19  *
20  *****************************************************************/
21 
22 
23 #ifndef CARMENWRAPPER_H
24 #define CARMENWRAPPER_H
25 
26 #include <iostream>
27 #include <deque>
28 #include <pthread.h>
29 #include <semaphore.h>
30 #include <carmen/carmen.h>
31 #include <carmen/global.h>
35 #include <gmapping/log/sensorlog.h>
38 
39 namespace GMapping{
40 
41 class CarmenWrapper {
42 public:
43  static void initializeIPC(const char* name);
44  static bool start(const char* name);
45  static bool isRunning();
46  static void lock();
47  static void unlock();
48  static int registerLocalizationMessages();
49 
50  static int queueLength();
51  static OrientedPoint getTruePos();
52  static bool getReading(RangeReading& reading);
53  static void addReading(RangeReading& reading);
54  static const SensorMap& sensorMap();
55  static bool sensorMapComputed();
56  static bool isStopped();
57 
58 // conversion function
59  static carmen_robot_laser_message reading2carmen(const RangeReading& reading);
60  static RangeReading carmen2reading(const carmen_robot_laser_message& msg);
61  static carmen_point_t point2carmen (const OrientedPoint& p);
62  static OrientedPoint carmen2point (const carmen_point_t& p);
63 
64 
65 // carmen interaction
66  static void robot_frontlaser_handler(carmen_robot_laser_message* frontlaser);
67  static void robot_rearlaser_handler(carmen_robot_laser_message* frontlaser);
68  static void simulator_truepos_handler(carmen_simulator_truepos_message* truepos);
69  //babsi:
70  static void navigator_go_handler(MSG_INSTANCE msgRef, BYTE_ARRAY callData, void*) ;
71  static void navigator_stop_handler(MSG_INSTANCE msgRef, BYTE_ARRAY callData, void*) ;
72 
73  //babsi:
74  static void publish_globalpos(carmen_localize_summary_p summary);
75  static void publish_particles(carmen_localize_particle_filter_p filter,
76  carmen_localize_summary_p summary);
77 
78  static void shutdown_module(int sig);
79 
80  private:
81  static std::deque<RangeReading> m_rangeDeque;
82  static sem_t m_dequeSem;
83  static pthread_mutex_t m_mutex, m_lock;
84  static pthread_t m_readingThread;
85  static void * m_reading_function(void*);
86  static bool m_threadRunning;
87  static SensorMap m_sensorMap;
89  static OrientedPoint m_truepos;
90  static bool stopped;
91 };
92 
93 } //end namespace
94 
95 
96 
97 #endif
98 /*
99 int main (int argc, char** argv) {
100 
101  CarmenWrapper::init_carmen(argc, argv);
102  while (true) {
103  IPC_listenWait(100);
104  }
105  return 1;
106 }
107 */
GMapping::SensorMap
std::map< std::string, Sensor * > SensorMap
Definition: sensor.h:20
GMapping::CarmenWrapper::carmen2point
static OrientedPoint carmen2point(const carmen_point_t &p)
Definition: carmenwrapper.cpp:465
GMapping::CarmenWrapper::m_lock
static pthread_mutex_t m_lock
Definition: carmenwrapper.h:121
GMapping::CarmenWrapper::sensorMapComputed
static bool sensorMapComputed()
Definition: carmenwrapper.cpp:144
GMapping::CarmenWrapper::m_rangeDeque
static std::deque< RangeReading > m_rangeDeque
Definition: carmenwrapper.h:119
GMapping::CarmenWrapper::addReading
static void addReading(RangeReading &reading)
Definition: carmenwrapper.cpp:192
rangesensor.h
GMapping::CarmenWrapper::stopped
static bool stopped
Definition: carmenwrapper.h:128
GMapping::CarmenWrapper::publish_globalpos
static void publish_globalpos(carmen_localize_summary_p summary)
Definition: carmenwrapper.cpp:365
GMapping::CarmenWrapper::initializeIPC
static void initializeIPC(const char *name)
Definition: carmenwrapper.cpp:42
sensorstream.h
carmenconfiguration.h
GMapping::CarmenWrapper::m_truepos
static OrientedPoint m_truepos
Definition: carmenwrapper.h:127
GMapping
Definition: configfile.cpp:34
GMapping::CarmenWrapper::reading2carmen
static carmen_robot_laser_message reading2carmen(const RangeReading &reading)
Definition: carmenwrapper.cpp:443
GMapping::CarmenWrapper::sensorMap
static const SensorMap & sensorMap()
Definition: carmenwrapper.cpp:151
sensorlog.h
GMapping::CarmenWrapper::simulator_truepos_handler
static void simulator_truepos_handler(carmen_simulator_truepos_message *truepos)
Definition: carmenwrapper.cpp:299
GMapping::OrientedPoint
orientedpoint< double, double > OrientedPoint
Definition: point.h:203
GMapping::CarmenWrapper::m_readingThread
static pthread_t m_readingThread
Definition: carmenwrapper.h:122
GMapping::CarmenWrapper::m_rearLaser
static RangeSensor * m_rearLaser
Definition: carmenwrapper.h:126
sensor.h
GMapping::RangeSensor
Definition: rangesensor.h:11
GMapping::CarmenWrapper::shutdown_module
static void shutdown_module(int sig)
Definition: carmenwrapper.cpp:420
GMapping::CarmenWrapper::lock
static void lock()
Definition: carmenwrapper.cpp:133
GMapping::CarmenWrapper::unlock
static void unlock()
Definition: carmenwrapper.cpp:138
GMapping::CarmenWrapper::navigator_go_handler
static void navigator_go_handler(MSG_INSTANCE msgRef, BYTE_ARRAY callData, void *)
Definition: carmenwrapper.cpp:264
GMapping::CarmenWrapper::publish_particles
static void publish_particles(carmen_localize_particle_filter_p filter, carmen_localize_summary_p summary)
Definition: carmenwrapper.cpp:386
GMapping::CarmenWrapper::isRunning
static bool isRunning()
Definition: carmenwrapper.cpp:155
GMapping::CarmenWrapper::getTruePos
static OrientedPoint getTruePos()
Definition: carmenwrapper.cpp:171
GMapping::CarmenWrapper::m_threadRunning
static bool m_threadRunning
Definition: carmenwrapper.h:124
rangereading.h
GMapping::CarmenWrapper::isStopped
static bool isStopped()
Definition: carmenwrapper.cpp:159
GMapping::RangeReading
Definition: rangereading.h:17
GMapping::CarmenWrapper::queueLength
static int queueLength()
Definition: carmenwrapper.cpp:163
GMapping::CarmenWrapper::m_mutex
static pthread_mutex_t m_mutex
Definition: carmenwrapper.h:121
GMapping::CarmenWrapper::point2carmen
static carmen_point_t point2carmen(const OrientedPoint &p)
Definition: carmenwrapper.cpp:461
GMapping::CarmenWrapper::start
static bool start(const char *name)
Definition: carmenwrapper.cpp:103
GMapping::CarmenWrapper::m_dequeSem
static sem_t m_dequeSem
Definition: carmenwrapper.h:120
GMapping::CarmenWrapper::robot_rearlaser_handler
static void robot_rearlaser_handler(carmen_robot_laser_message *frontlaser)
Definition: carmenwrapper.cpp:233
GMapping::CarmenWrapper::getReading
static bool getReading(RangeReading &reading)
Definition: carmenwrapper.cpp:175
GMapping::CarmenWrapper::m_frontLaser
static RangeSensor * m_frontLaser
Definition: carmenwrapper.h:126
GMapping::CarmenWrapper::m_sensorMap
static SensorMap m_sensorMap
Definition: carmenwrapper.h:125
GMapping::CarmenWrapper::robot_frontlaser_handler
static void robot_frontlaser_handler(carmen_robot_laser_message *frontlaser)
Definition: carmenwrapper.cpp:205
GMapping::CarmenWrapper::m_reading_function
static void * m_reading_function(void *)
Definition: carmenwrapper.cpp:410
GMapping::orientedpoint< double, double >
GMapping::CarmenWrapper::navigator_stop_handler
static void navigator_stop_handler(MSG_INSTANCE msgRef, BYTE_ARRAY callData, void *)
Definition: carmenwrapper.cpp:281
GMapping::CarmenWrapper::registerLocalizationMessages
static int registerLocalizationMessages()
Definition: carmenwrapper.cpp:49
GMapping::CarmenWrapper::carmen2reading
static RangeReading carmen2reading(const carmen_robot_laser_message &msg)
Definition: carmenwrapper.cpp:305


openslam_gmapping
Author(s): Cyrill Stachniss, Udo Frese, Giorgio Grisetti, Wolfram Burgard
autogenerated on Thu Oct 19 2023 02:25:51