NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
epson_imu_nodelet.h
Go to the documentation of this file.
1 /* Copyright (c) 2017, United States Government, as represented by the
2  * Administrator of the National Aeronautics and Space Administration.
3  *
4  * All rights reserved.
5  *
6  * The Astrobee platform is licensed under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with the
8  * License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15  * License for the specific language governing permissions and limitations
16  * under the License.
17  */
18 
19 
20 #ifndef EPSON_IMU_EPSON_IMU_NODELET_H_
21 #define EPSON_IMU_EPSON_IMU_NODELET_H_
22 
23 #include <pluginlib/class_list_macros.h>
24 
25 #include <epson_imu/G362P.h>
26 #include <epson_imu/GPIO.h>
27 
28 #include <ros/publisher.h>
29 #include <ros/subscriber.h>
30 
31 #include <ff_util/ff_nodelet.h>
33 
34 #include <thread>
35 #include <string>
36 
37 namespace epson_imu {
38 
40  public:
43 
44  protected:
45  virtual void Initialize(ros::NodeHandle *nh);
46 
47  private:
48  void ReadParams(void);
49  void Run(void);
50 
51  bool InitGPIO(void);
52  void CloseGPIO(void);
53  bool InitSPI(void);
54  void CloseSPI(void);
55  void Exit();
56 
57  std::shared_ptr<std::thread> thread_;
59  ros::Publisher pub_data_;
60 
61  int fd_spi_dev_;
62  gpio::GPIO *gpio_data_ready_;
63  gpio::GPIO *gpio_reset_;
64  gpio::GPIO *gpio_cs_;
65 
66  // PARAMETERS
67  int prototype_;
68  std::string spi_dev_;
69 
70  // Gravitational acceleration.
71  double G_;
72 
73  // JP-4 6
74  int gpio_num_data_ready_;
75  // JP-4 10
76  int gpio_num_reset_;
77  // Chip select. GPIO2_30
78  int gpio_num_cs_;
79 
80  // SPI configuration.
81  uint8_t spi_mode_;
82  // The maximum clock speed of the IMU is 1 MHz.
83  uint32_t spi_speed_hz_;
84  // uint8_t spi_bits_;
85 
86  // Enable output.
87  bool enable_flag_;
88  bool enable_temp_;
89  bool enable_gyro_;
90  bool enable_accl_;
91  bool enable_gpio_;
92  bool enable_count_;
93  bool enable_chksm_;
94 
95  // Data bits.
96  bool data_32_bits_;
97 
98  // Sampling rate.
99  epson_imu::SamplingRate sampling_rate_;
100 
101  // Filter setting.
102  epson_imu::Filter filter_;
103 
104  // different rate in calibration mode
105  bool calibration_mode_;
106 };
107 
108 } // namespace epson_imu
109 
110 #endif // EPSON_IMU_EPSON_IMU_NODELET_H_
epson_imu
Definition: epson_imu_nodelet.h:37
ff_nodelet.h
epson_imu::Filter
Filter
Definition: G362P.h:107
gpio::GPIO
Definition: GPIO.h:54
epson_imu::SamplingRate
SamplingRate
Definition: G362P.h:129
ff_util::FreeFlyerNodelet
Definition: ff_nodelet.h:57
epson_imu::EpsonImuNodelet::EpsonImuNodelet
EpsonImuNodelet()
Definition: epson_imu_nodelet.cc:28
config_reader::ConfigReader
Definition: config_reader.h:48
epson_imu::EpsonImuNodelet::~EpsonImuNodelet
~EpsonImuNodelet()
Definition: epson_imu_nodelet.cc:31
config_reader.h
epson_imu::EpsonImuNodelet
Definition: epson_imu_nodelet.h:39
G362P.h
epson_imu::EpsonImuNodelet::Initialize
virtual void Initialize(ros::NodeHandle *nh)
Definition: epson_imu_nodelet.cc:33
GPIO.h