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 
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;
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 */
static carmen_point_t point2carmen(const OrientedPoint &p)
static SensorMap m_sensorMap
Definition: carmenwrapper.h:87
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:83
static void robot_rearlaser_handler(carmen_robot_laser_message *frontlaser)
static OrientedPoint getTruePos()
static RangeSensor * m_frontLaser
Definition: carmenwrapper.h:88
static std::deque< RangeReading > m_rangeDeque
Definition: carmenwrapper.h:81
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:83
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:20
static bool m_threadRunning
Definition: carmenwrapper.h:86
static RangeSensor * m_rearLaser
Definition: carmenwrapper.h:88
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:84
static OrientedPoint m_truepos
Definition: carmenwrapper.h:89


openslam_gmapping
Author(s): Cyrill Stachniss, Udo Frese, Giorgio Grisetti, Wolfram Burgard
autogenerated on Mon Feb 28 2022 22:59:20