RequestQueue.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2017, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package ArmarX
19  * @author Stefan Reither( stefan dot reither at kit dot edu)
20  * @date 2021
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 #pragma once
26 
27 #include <condition_variable>
28 #include <memory>
29 #include <vector>
30 
32 
34 {
35  class RequestBase;
36  class SDOUpdateRequest;
37 
38  struct SDOIdentifier;
39  class EtherCATState;
40 
41  struct RegisterDataList;
42  struct EtherCATFrameList;
43 
44  /**
45  * @class RequestQueue
46  * @ingroup Library-ethercat
47  * @brief Brief description of class RequestQueue.
48  *
49  * Detailed description of class RequestQueue.
50  */
52  {
53  public:
54  RequestQueue();
55  ~RequestQueue();
57 
58  std::shared_ptr<RequestBase> getNextRequest();
59  void postReply(std::shared_ptr<RequestBase>&& request);
60 
61 
62  bool postSDOReadRequest(SDOIdentifier sdoIdentifier,
63  int* buflen,
64  unsigned char* buf,
65  bool completeAccess);
66  bool postSDOWriteRequest(SDOIdentifier sdoIdentifier,
67  int buflen,
68  unsigned char* buf,
69  bool completeAccess);
70 
71 
72  bool postChangeStateRequest(std::uint16_t slaveIndex,
73  EtherCATState state,
74  bool validate,
75  EtherCATState* actualState);
76 
77 
79 
80  bool postRegisterResetRequest(std::uint16_t slaveIndex);
81 
82  bool postRegisterReadRequest(std::vector<RegisterDataList>& registerData);
83 
84  bool postRegisterReadRequest(EtherCATFrameList* frames, std::uint16_t amountFramesToRead);
85 
86 
87  private:
88  bool postRequest(const std::shared_ptr<RequestBase>& request);
89  bool postSDOUpdateRequest(const std::shared_ptr<SDOUpdateRequest>& request);
90 
91  struct QueueImpl;
93 
94  std::condition_variable requestCV;
95  };
96 
97 } // namespace armarx::control::ethercat
armarx::control::ethercat::RequestQueue::postSDOWriteRequest
bool postSDOWriteRequest(SDOIdentifier sdoIdentifier, int buflen, unsigned char *buf, bool completeAccess)
Definition: RequestQueue.cpp:91
armarx::control::ethercat::RequestQueue::operator=
RequestQueue & operator=(RequestQueue rhs)
Definition: RequestQueue.cpp:36
armarx::control::ethercat::EtherCATState
This class is a wrapper around an enum containing the different EtherCAT states.
Definition: EtherCATState.h:25
armarx::control::ethercat::RequestQueue::QueueImpl
Definition: RequestQueue.cpp:18
armarx::control::ethercat::RequestQueue::postReply
void postReply(std::shared_ptr< RequestBase > &&request)
Definition: RequestQueue.cpp:54
armarx::control::ethercat::RequestQueue
Brief description of class RequestQueue.
Definition: RequestQueue.h:51
armarx::control::ethercat::RequestQueue::postRegisterResetRequest
bool postRegisterResetRequest(std::uint16_t slaveIndex)
Definition: RequestQueue.cpp:122
armarx::control::ethercat::RequestQueue::postReadStatesRequest
bool postReadStatesRequest(EtherCATState *state)
Definition: RequestQueue.cpp:115
armarx::control::ethercat::EtherCATFrameList
The EtherCATFrameList struct holds a list of EtherCAT frames that can be scheduled in round-robin-sty...
Definition: EtherCATFrame.h:124
armarx::control::ethercat::RequestQueue::RequestQueue
RequestQueue()
Definition: RequestQueue.cpp:28
armarx::control::ethercat
Definition: Bus.cpp:24
armarx::control::ethercat::RequestQueue::getNextRequest
std::shared_ptr< RequestBase > getNextRequest()
Definition: RequestQueue.cpp:43
armarx::control::ethercat::RequestQueue::~RequestQueue
~RequestQueue()
armarx::navigation::client::validate
void validate(const std::vector< WaypointTarget > &path)
Definition: ice_conversions.h:70
armarx::control::ethercat::RequestQueue::postChangeStateRequest
bool postChangeStateRequest(std::uint16_t slaveIndex, EtherCATState state, bool validate, EtherCATState *actualState)
Definition: RequestQueue.cpp:103
armarx::control::ethercat::RequestQueue::postRegisterReadRequest
bool postRegisterReadRequest(std::vector< RegisterDataList > &registerData)
Definition: RequestQueue.cpp:129
armarx::control::ethercat::SDOIdentifier
Definition: SDOUpdateRequest.h:9
armarx::control::ethercat::RequestQueue::postSDOReadRequest
bool postSDOReadRequest(SDOIdentifier sdoIdentifier, int *buflen, unsigned char *buf, bool completeAccess)
Definition: RequestQueue.cpp:80
armarx::PropagateConst
Wrapper for a pointer to propagate const to the pointed to value.
Definition: PropagateConst.h:69
PropagateConst.h