AGX Dynamics
2.38.0.2
RemoteSolver.h
Go to the documentation of this file.
1
/*
2
Copyright 2007-2024. Algoryx Simulation AB.
3
4
All AGX source code, intellectual property, documentation, sample code,
5
tutorials, scene files and technical white papers, are copyrighted, proprietary
6
and confidential material of Algoryx Simulation AB. You may not download, read,
7
store, distribute, publish, copy or otherwise disseminate, use or expose this
8
material unless having a written signed agreement with Algoryx Simulation AB, or having been
9
advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10
valid commercial license from Algoryx Simulation AB.
11
12
Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13
from using this software, unless otherwise stated in written agreements with
14
Algoryx Simulation AB.
15
*/
16
17
18
#ifndef AGX_REMOTESOLVER_H
19
#define AGX_REMOTESOLVER_H
20
21
#include <agx/config/AGX_USE_WEBSOCKETS.h>
22
#include <
agx/Component.h
>
23
#include <
agxNet/Socket.h
>
24
#include <
agxNet/WebSocket.h
>
25
#include <
agxSDK/SimulationTrack.FrameReader.h
>
26
#include <
agxSDK/SimulationTrack.FrameWriter.h
>
27
28
#if AGX_USE_WEBSOCKETS()
29
30
#include <
agxData/Frame.h
>
31
32
namespace
agxSDK
{
class
Simulation; }
33
34
DOXYGEN_START_INTERNAL_BLOCK
()
35
36
namespace
agx
37
{
38
AGX_DECLARE_POINTER_TYPES
(RemoteSolver);
39
class
AGXPHYSICS_EXPORT
RemoteSolver :
public
Referenced
40
{
41
42
public
:
43
RemoteSolver(
UInt16
tcpSocketPort = 1906,
UInt16
webSocketPort = 1907);
44
45
46
void
execute();
47
48
agx::UInt16
getWebPort()
const
{
return
m_webPort; }
49
agx::UInt16
getTcpPort()
const
{
return
m_tcpPort; }
50
agxSDK::SimulationFrameReader
*getSimulationReader() {
return
m_simulationReader; }
51
agxSDK::SimulationFrameWriter
*getSimulationWriter() {
return
m_simulationWriter; }
52
53
protected
:
54
virtual
~RemoteSolver();
55
56
private
:
57
friend
class
agxSDK::Simulation
;
58
void
init
(
agxSDK::Simulation
*simulation);
59
60
private
:
61
void
clientConnected(agxNet::WebSocket* client);
62
void
clientConnected(
agxNet::TCPSocket
* client);
63
void
clientDisconnected(agxNet::WebSocket* client);
64
void
clientDisconnected(
agxNet::TCPSocket
* client);
65
void
messageReceived(
agx::UInt8
* payload,
size_t
size);
66
67
void
waitForClient();
68
void
someClientDisconnected();
69
bool
writeReadCycle(agxData::Frame* frame);
70
71
private
:
72
agx::UInt16
m_tcpPort;
73
agx::UInt16
m_webPort;
74
agxSDK::Simulation
*m_simulation;
75
76
agxSDK::SimulationFrameReaderRef
m_simulationReader;
77
agxSDK::SimulationFrameWriterRef
m_simulationWriter;
78
79
agxNet::TCPServerSocketRef
m_tcpSocketServer;
80
agxNet::TCPSocketRef
m_tcpSocketClient;
81
82
agxNet::WebSocketServerRef m_webSocketServer;
83
agxNet::WebSocketRef m_webSocketClient;
84
85
agxData::FrameChannelRef
m_frameChannel;
86
87
agxData::FrameRef
m_solverResult;
88
};
89
90
}
91
DOXYGEN_END_INTERNAL_BLOCK
()
92
93
#endif
94
#endif
/* AGX_REMOTESOLVER_H */
DOXYGEN_END_INTERNAL_BLOCK
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition:
macros.h:97
DOXYGEN_START_INTERNAL_BLOCK
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition:
macros.h:96
agx::FrameRef
agx::ref_ptr< Frame > FrameRef
Definition:
Frame.h:52
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition:
AddedMassInteraction.h:22
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agxNet::TCPSocket
Definition:
Socket.h:340
agx::UInt16
uint16_t UInt16
Definition:
Integer.h:31
Socket.h
agx::ref_ptr< SimulationFrameReader >
agxSDK::Simulation
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition:
Simulation.h:125
agx::UInt8
uint8_t UInt8
Definition:
Integer.h:30
Component.h
SimulationTrack.FrameReader.h
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition:
Referenced.h:254
SimulationTrack.FrameWriter.h
agxSDK
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition:
Constraint.h:30
agx::init
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API.
Frame.h
agxSDK::SimulationFrameWriter
Definition:
SimulationTrack.FrameWriter.h:39
WebSocket.h
agxSDK::SimulationFrameReader
Definition:
SimulationTrack.FrameReader.h:39
include
agx
RemoteSolver.h
Generated on Sun Sep 1 2024 11:18:54 for AGX Dynamics by
1.8.17