Goby3  3.1.5
2024.05.14
moos_ufield_sim_driver.h
Go to the documentation of this file.
1 // Copyright 2011-2021:
2 // GobySoft, LLC (2013-)
3 // Massachusetts Institute of Technology (2007-2014)
4 // Community contributors (see AUTHORS file)
5 // File authors:
6 // Toby Schneider <toby@gobysoft.org>
7 //
8 //
9 // This file is part of the Goby Underwater Autonomy Project Libraries
10 // ("The Goby Libraries").
11 //
12 // The Goby Libraries are free software: you can redistribute them and/or modify
13 // them under the terms of the GNU Lesser General Public License as published by
14 // the Free Software Foundation, either version 2.1 of the License, or
15 // (at your option) any later version.
16 //
17 // The Goby Libraries are distributed in the hope that they will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU Lesser General Public License for more details.
21 //
22 // You should have received a copy of the GNU Lesser General Public License
23 // along with Goby. If not, see <http://www.gnu.org/licenses/>.
24 
25 #ifndef GOBY_MOOS_MOOS_UFIELD_SIM_DRIVER_H
26 #define GOBY_MOOS_MOOS_UFIELD_SIM_DRIVER_H
27 
28 #include <MOOS/libMOOS/Comms/MOOSCommClient.h> // for CMOOSCommClient
29 
30 #include "goby/acomms/modemdriver/driver_base.h" // for ModemDriverBase
31 #include "goby/acomms/protobuf/driver_base.pb.h" // for DriverConfig
32 #include "goby/moos/modem_id_convert.h" // for ModemIdConvert
33 #include "goby/moos/protobuf/ufield_sim_driver.pb.h" // for Config
34 
35 namespace goby
36 {
37 namespace acomms
38 {
39 namespace protobuf
40 {
41 class ModemTransmission;
42 } // namespace protobuf
43 } // namespace acomms
44 
45 namespace moos
46 {
51 {
52  public:
54  void startup(const goby::acomms::protobuf::DriverConfig& cfg) override;
55  void shutdown() override;
56  void do_work() override;
57  void handle_initiate_transmission(const goby::acomms::protobuf::ModemTransmission& m) override;
58 
59  private:
60  void send_message(const goby::acomms::protobuf::ModemTransmission& msg);
61  void receive_message(const goby::acomms::protobuf::ModemTransmission& msg);
62 
63  // MicroModem special feature mimics
64  void ccmpc(const goby::acomms::protobuf::ModemTransmission& msg);
65 
66  private:
67  enum
68  {
69  DEFAULT_PACKET_SIZE = 64
70  };
71  enum
72  {
73  NOMINAL_SPEED_OF_SOUND = 1500
74  };
75  CMOOSCommClient moos_client_;
76  goby::acomms::protobuf::DriverConfig driver_cfg_; // configuration given to you at launch
77  goby::moos::ufld::protobuf::Config ufld_driver_cfg_;
78 
79  //boost::bimap<int, std::string> modem_id2name_;
80  goby::moos::ModemIdConvert modem_lookup_;
81 
82  int last_ccmpc_dest_{-1};
83 };
84 } // namespace moos
85 } // namespace goby
86 
87 #endif
provides an abstract base class for acoustic modem drivers. This is subclassed by the various drivers...
Definition: driver_base.h:59
provides an simulator driver to the uFldNodeComms MOOS module: http://oceanai.mit....
void startup(const goby::acomms::protobuf::DriverConfig &cfg) override
void do_work() override
Allows the modem driver to do its work.
void shutdown() override
Shuts down the modem driver.
void handle_initiate_transmission(const goby::acomms::protobuf::ModemTransmission &m) override
The global namespace for the Goby project.
extern ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::google::protobuf::MessageOptions, ::PROTOBUF_NAMESPACE_ID::internal::MessageTypeTraits< ::goby::GobyMessageOptions >, 11, false > msg