Go to the documentation of this file.
42 #include <dll/ethercat_dll.h>
43 #include <al/ethercat_AL.h>
44 #include <dll/ethercat_device_addressed_telegram.h>
45 #include <dll/ethercat_frame.h>
47 #include <boost/static_assert.hpp>
65 EtherCAT_FMMU_Config *fmmu =
new EtherCAT_FMMU_Config(2);
67 (*fmmu)[0] = EC_FMMU(start_address,
80 (*fmmu)[1] = EC_FMMU(start_address,
90 start_address += base_status;
92 sh->set_fmmu_config(fmmu);
94 EtherCAT_PD_Config *pd =
new EtherCAT_PD_Config(4);
98 (*pd)[0].ChannelEnable =
true;
99 (*pd)[0].ALEventEnable =
true;
102 (*pd)[1].ChannelEnable =
true;
104 (*pd)[2] = EC_SyncMan(WGMailbox::MBX_COMMAND_PHY_ADDR, WGMailbox::MBX_COMMAND_SIZE, EC_QUEUED, EC_WRITTEN_FROM_MASTER);
105 (*pd)[2].ChannelEnable =
true;
106 (*pd)[2].ALEventEnable =
true;
108 (*pd)[3] = EC_SyncMan(WGMailbox::MBX_STATUS_PHY_ADDR, WGMailbox::MBX_STATUS_SIZE, EC_QUEUED);
109 (*pd)[3].ChannelEnable =
true;
111 sh->set_pd_config(pd);
134 for (
size_t i = 0; i <
sizeof(digital_outs)/
sizeof(digital_outs[0]); ++i)
139 ROS_FATAL(
"A digital out of the name '%s' already exists. Device #%02d has a duplicate name", digital_outs[i].
d->name_.c_str(),
sh_->get_ring_position());
149 ROS_FATAL(
"A projector of the name '%s' already exists. Device #%02d has a duplicate name",
projector_.
name_.c_str(),
sh_->get_ring_position());
215 state.
A_ = ((this_status->
config0_ >> 4) & 0xf);
216 state.
B_ = ((this_status->
config0_ >> 0) & 0xf);
217 state.
I_ = ((this_status->
config1_ >> 4) & 0xf);
218 state.
M_ = ((this_status->
config1_ >> 0) & 0xf);
251 d.hardware_id = serial;
253 d.summary(
d.OK,
"OK");
258 d.addf(
"Position",
"%02d",
sh_->get_ring_position());
259 d.addf(
"Product code",
260 "WG021 (%d) Firmware Revision %d.%02d, PCB Revision %c.%02d",
265 d.add(
"Serial Number", serial);
275 d.addf(
"Digital out",
"%d",
status->digital_out_);
278 d.addf(
"Timestamp",
"%u",
status->timestamp_);
279 d.addf(
"Config 0",
"%#02x",
status->config0_);
280 d.addf(
"Config 1",
"%#02x",
status->config1_);
281 d.addf(
"Config 2",
"%#02x",
status->config2_);
282 d.addf(
"Output Status",
"%#02x",
status->output_status_);
283 d.addf(
"Output Start Timestamp",
"%u",
status->output_start_timestamp_);
284 d.addf(
"Output Stop Timestamp",
"%u",
status->output_stop_timestamp_);
285 d.addf(
"Board temperature",
"%f", 0.0078125 *
status->board_temperature_);
287 d.addf(
"Bridge temperature",
"%f", 0.0078125 *
status->bridge_temperature_);
291 d.addf(
"Packet count",
"%d",
status->packet_count_);
bool rising_timestamp_valid_
bool verifyChecksum(const void *buffer, unsigned size)
int16_t programmed_current_
uint32_t rising_timestamp_us_
int initialize(pr2_hardware_interface::HardwareInterface *, bool allow_unprogrammed=true)
int16_t measured_current_
uint32_t device_serial_number_
pr2_hardware_interface::DigitalOut digital_out_B_
ProjectorCommand command_
bool unpackState(unsigned char *this_buffer, unsigned char *prev_buffer)
uint16_t max_bridge_temperature_
static string modeString(uint8_t mode)
void publishMailboxDiagnostics(diagnostic_updater::DiagnosticStatusWrapper &d)
WG0XActuatorInfo actuator_info_
uint16_t bridge_temperature_
static const unsigned STATUS_PHY_ADDR
int16_t programmed_current_
uint16_t absolute_current_limit_
WG0XConfigInfo config_info_
void publishGeneralDiagnostics(diagnostic_updater::DiagnosticStatusWrapper &d)
uint16_t max_board_temperature_
double max_current_
min(board current limit, actuator current limit)
pr2_hardware_interface::DigitalOut digital_out_I_
uint32_t falling_timestamp_us_
void construct(EtherCAT_SlaveHandler *sh, int &start_address)
< Construct EtherCAT device
bool status_checksum_error_
pr2_hardware_interface::Projector projector_
EtherCAT_SlaveHandler * sh_
AppRamStatus app_ram_status_
DigitalOutCommand command_
bool falling_timestamp_valid_
ethercat_hardware::WGMailbox mailbox_
Mailbox access to device.
void clearErrorFlags(void)
double last_commanded_current_
pr2_hardware_interface::DigitalOut digital_out_
unsigned computeChecksum(void const *data, unsigned length)
static const unsigned SIZE
bool verifyState(WG0XStatus *this_status, WG0XStatus *prev_status)
static double min(double a, double b)
uint8_t board_minor_
Printed circuit assembly revision.
double last_measured_current_
pr2_hardware_interface::DigitalOut digital_out_A_
pr2_hardware_interface::DigitalOut digital_out_M_
PLUGINLIB_EXPORT_CLASS(WG021, EthercatDevice)
float nominal_current_scale_
uint32_t output_start_timestamp_
bool addDigitalOut(DigitalOut *digital_out)
double last_executed_current_
unsigned int status_size_
void construct(EtherCAT_SlaveHandler *sh, int &start_address)
< Construct EtherCAT device
void diagnostics(diagnostic_updater::DiagnosticStatusWrapper &d, unsigned char *)
For EtherCAT device that only publish one EtherCAT Status message. If sub-class implements multiDiagn...
uint32_t output_stop_timestamp_
uint8_t board_major_
Printed circuit board revision (for this value 0=='A', 1=='B')
virtual int initialize(pr2_hardware_interface::HardwareInterface *, bool allow_unprogrammed=true)
unsigned int command_size_
void packCommand(unsigned char *buffer, bool halt, bool reset)
uint16_t board_temperature_
static const unsigned COMMAND_PHY_ADDR
pr2_hardware_interface::DigitalOut digital_out_L0_
uint8_t configuration_status_
pr2_hardware_interface::DigitalOut digital_out_L1_
unsigned int rotateRight8(unsigned in)
bool addProjector(Projector *projector)
float nominal_voltage_scale_
void ethercatDiagnostics(diagnostic_updater::DiagnosticStatusWrapper &d, unsigned numPorts)
Adds diagnostic information for EtherCAT ports.
ethercat_hardware
Author(s): Rob Wheeler
, Derek King
autogenerated on Thu Sep 26 2024 02:44:04