Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef ETHERCAT_HARDWARE_WG021_H
00036 #define ETHERCAT_HARDWARE_WG021_H
00037
00038 #include <ethercat_hardware/wg0x.h>
00039
00040
00041 struct WG021Status
00042 {
00043 uint8_t mode_;
00044 uint8_t digital_out_;
00045 uint8_t general_config_;
00046 uint8_t pad1_;
00047 int16_t programmed_current_;
00048 int16_t measured_current_;
00049 uint32_t timestamp_;
00050 uint8_t config0_;
00051 uint8_t config1_;
00052 uint8_t config2_;
00053 uint8_t pad2_;
00054 uint32_t pad3_;
00055 uint16_t pad4_;
00056 uint8_t pad5_;
00057 uint8_t output_status_;
00058 uint32_t output_start_timestamp_;
00059 uint32_t output_stop_timestamp_;
00060 uint16_t board_temperature_;
00061 uint16_t bridge_temperature_;
00062 uint16_t supply_voltage_;
00063 int16_t led_voltage_;
00064 uint16_t packet_count_;
00065 uint8_t pad_;
00066 uint8_t checksum_;
00067 static const unsigned SIZE=44;
00068 }__attribute__ ((__packed__));
00069
00070 struct WG021Command
00071 {
00072 uint8_t mode_;
00073 uint8_t digital_out_;
00074 uint8_t general_config_;
00075 uint8_t pad1_;
00076 int16_t programmed_current_;
00077 int16_t pad2_;
00078 int32_t pad3_;
00079 uint8_t config0_;
00080 uint8_t config1_;
00081 uint8_t config2_;
00082 uint8_t checksum_;
00083 }__attribute__ ((__packed__));
00084
00085 class WG021 : public WG0X
00086 {
00087 public:
00088 WG021() : projector_(digital_out_A_, digital_out_B_, digital_out_I_, digital_out_M_, digital_out_L0_, digital_out_L1_) {}
00089 void construct(EtherCAT_SlaveHandler *sh, int &start_address);
00090 int initialize(pr2_hardware_interface::HardwareInterface *, bool allow_unprogrammed=true);
00091 void packCommand(unsigned char *buffer, bool halt, bool reset);
00092 bool unpackState(unsigned char *this_buffer, unsigned char *prev_buffer);
00093 void diagnostics(diagnostic_updater::DiagnosticStatusWrapper &d, unsigned char *);
00094 enum
00095 {
00096 PRODUCT_CODE = 6805021
00097 };
00098 enum
00099 {
00100 PROJECTOR_CONFIG_ENABLE = 8,
00101 PROJECTOR_CONFIG_ENABLE_ENABLED = 8,
00102 PROJECTOR_CONFIG_ENABLE_DISABLED = 0,
00103
00104 PROJECTOR_CONFIG_ACTION = 4,
00105 PROJECTOR_CONFIG_ACTION_ON = 4,
00106 PROJECTOR_CONFIG_ACTION_OFF = 0,
00107
00108 PROJECTOR_CONFIG_POLARITY = 2,
00109 PROJECTOR_CONFIG_POLARITY_ACTIVE_HIGH = 2,
00110 PROJECTOR_CONFIG_POLARITY_ACTIVE_LOW = 0,
00111
00112 PROJECTOR_CONFIG_STATE = 1,
00113 PROJECTOR_CONFIG_STATE_HIGH = 1,
00114 PROJECTOR_CONFIG_STATE_LOW = 0
00115 };
00116 private:
00117 pr2_hardware_interface::DigitalOut digital_out_A_;
00118 pr2_hardware_interface::DigitalOut digital_out_B_;
00119 pr2_hardware_interface::DigitalOut digital_out_I_;
00120 pr2_hardware_interface::DigitalOut digital_out_M_;
00121 pr2_hardware_interface::DigitalOut digital_out_L0_;
00122 pr2_hardware_interface::DigitalOut digital_out_L1_;
00123 pr2_hardware_interface::Projector projector_;
00124 };
00125
00126 #endif