wg_soft_processor.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2008, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of the Willow Garage nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 #ifndef ETHERCAT_HARDWARE__WG_SOFT_PROCESSOR_H
36 #define ETHERCAT_HARDWARE__WG_SOFT_PROCESSOR_H
37 
38 #include <ros/ros.h>
41 #include "ethercat_hardware/SoftProcessorFirmwareWrite.h"
42 #include "ethercat_hardware/SoftProcessorFirmwareRead.h"
43 #include "ethercat_hardware/SoftProcessorReset.h"
44 
45 #include <vector>
46 #include <ostream>
47 #include <string>
48 
49 namespace ethercat_hardware
50 {
51 
52 
58 {
59 public:
61  bool initialize(EthercatCom *com);
62 
63  struct Info
64  {
65  Info() : mbx_(NULL), iram_address_(-1), ctrl_address_(-1) {}
66  Info( WGMailbox *mbx,
67  const std::string &actuator_name,
68  const std::string &processor_name,
69  unsigned iram_address, unsigned ctrl_address ) :
70  mbx_(mbx), actuator_name_(actuator_name), processor_name_(processor_name),
71  iram_address_(iram_address), ctrl_address_(ctrl_address) {}
73  std::string actuator_name_;
74  std::string processor_name_;
75  unsigned iram_address_;
76  unsigned ctrl_address_;
77  };
78 
79  void add(WGMailbox *mbx, const std::string &actuator_name, const std::string &processor_name,
80  unsigned iram_address, unsigned ctrl_address);
81 
82 protected:
83 
84  static const unsigned IRAM_INSTRUCTION_LENGTH = 1024;
85 
86  std::vector<Info> processors_;
87 
88  bool writeFirmwareCB(ethercat_hardware::SoftProcessorFirmwareWrite::Request &request,
89  ethercat_hardware::SoftProcessorFirmwareWrite::Response &response);
90  bool readFirmwareCB(ethercat_hardware::SoftProcessorFirmwareRead::Request &request,
91  ethercat_hardware::SoftProcessorFirmwareRead::Response &response);
92  bool resetCB(ethercat_hardware::SoftProcessorReset::Request &request,
93  ethercat_hardware::SoftProcessorReset::Response &response);
94 
98 
100  bool assertReset(const Info &info, std::ostream &err_msg);
101 
103  bool releaseReset(const Info &info, std::ostream &err_msg);
104 
106  const WGSoftProcessor::Info* get(const std::string &actuator_name, const std::string &processor_name, std::ostream &err_out) const;
107 
109 };
110 
111 
112 }; // end namespace ethercat_hardware
113 
114 #endif //ETHERCAT_HARDWARE__WG_SOFT_PROCESSOR_H
void add(WGMailbox *mbx, const std::string &actuator_name, const std::string &processor_name, unsigned iram_address, unsigned ctrl_address)
bool assertReset(const Info &info, std::ostream &err_msg)
Puts soft processor in reset.
bool resetCB(ethercat_hardware::SoftProcessorReset::Request &request, ethercat_hardware::SoftProcessorReset::Response &response)
ros::ServiceServer write_firmware_service_
service that allows write of soft processor firmware
bool writeFirmwareCB(ethercat_hardware::SoftProcessorFirmwareWrite::Request &request, ethercat_hardware::SoftProcessorFirmwareWrite::Response &response)
ros::ServiceServer reset_service_
service that resets soft-processor
static const unsigned IRAM_INSTRUCTION_LENGTH
Info(WGMailbox *mbx, const std::string &actuator_name, const std::string &processor_name, unsigned iram_address, unsigned ctrl_address)
bool readFirmwareCB(ethercat_hardware::SoftProcessorFirmwareRead::Request &request, ethercat_hardware::SoftProcessorFirmwareRead::Response &response)
bool releaseReset(const Info &info, std::ostream &err_msg)
Takes soft processor out of reset.
ros::ServiceServer read_firmware_service_
service that allows read of soft processor firmware


ethercat_hardware
Author(s): Rob Wheeler , Derek King
autogenerated on Fri Mar 15 2019 02:53:29