API¶
The C++ code of the plugin is documented with doxygen. You can generate the API document with cd docs/doxygen; doxygen. An online version is hosted in here.
Python¶
The python client
UnrealCV === Provides functions to interact with games built using Unreal Engine.
>>> import unrealcv
>>> (HOST, PORT) = ('localhost', 9000)
>>> client = unrealcv.Client((HOST, PORT))
-
class
unrealcv.Client(endpoint, message_handler=None)¶ Client can be used to send request to a game and get response Currently only one client is allowed at a time More clients will be rejected
-
request(message, timeout=5)¶ Send a request to server and wait util get a response from server or timeout.
Parameters — cmd : string, command to control the game More info can be seen from http://unrealcv.github.io/commands.html
Returns — response: plain text message from server
Examples — >>> client = Client(‘localhost’, 9000) >>> client.connect() >>> response = client.request(‘vget /camera/0/view’)
-
-
class
unrealcv.BaseClient(endpoint, raw_message_handler)¶ BaseClient send message out and receiving message in a seperate thread. After calling the send function, only True or False will be returned to indicate whether the operation was successful. If you are trying to send a request and get a response, consider using Client instead. This class adds message framing on top of TCP
-
connect(timeout=1)¶ Try to connect to server, return whether connection successful
-
send(message)¶ Send message out, return whether the message was successfully sent
-
MATLAB¶
The matlab client
Core¶
FUE4CVServer uses FCommandDispatcher to execute commands. All CommandHandlers are registered.
-
class
FUE4CVServer¶ UnrealCV server to interact with external programs.
Inherits from FTickableGameObject
Public Functions
-
void
SendClientMessage(FString Message)¶ Send a string message to connected clients.
-
APawn *
GetPawn()¶ Return the Pawn of this game.
Only available during game play.
-
virtual void
Tick(float DeltaTime)¶ Implement ticking function of UE4CVServer itself.
-
void
RegisterCommandHandlers()¶ For UnrealCV server, when a game start:
- Start a TCPserver.
- Create a command dispatcher
- Add command handler to command dispatcher, CameraHandler should be able to access camera
- Bind command dispatcher to TCPserver
- Bind command dispatcher to UE4 console
When a new pawn is created.
- Update this pawn with GTCaptureComponent
-
bool
InitWorld()¶ Make sure UE4CVServer correctly initialized itself in the GameWorld.
Make sure the UE4CVServer is correctly configured.
-
UWorld *
GetGameWorld()¶ Return the GameWorld of the editor or of the game.
Public Members
-
FCommandDispatcher *
CommandDispatcher¶ The CommandDispatcher to handle a pending request.
-
FServerConfig
Config¶ The config of UE4CVServer.
-
UNetworkManager *
NetworkManager¶ The underlying class to handle network connection, ip and port are configured here.
Public Static Functions
-
FUE4CVServer &
Get()¶ Get the singleton.
-
void
Warning
doxygenclass: Cannot find class “UNetworkManager” in doxygen xml output for project “unrealcv” from directory: ./doxygen/xml/
-
class
FExecStatus¶ Present the return value of a command.
If the FExecStatusType is pending, check the promise value.
-
class
FPromise¶ Return by async task, used to check status to see whether the task is finished.
-
class
FCommandDispatcher¶ Engine to execute commands.
-
class
FAsyncWatcher¶ Inherits from FRunnable
The execution result of a command
Basic¶
-
class
AUE4CVPawn¶ UE4CVPawn can move freely in the 3D space.
Inherits from ADefaultPawn
-
class
AUE4CVCharacter¶ UE4CVCharacter acts like a walking human.
Inherits from ACharacter
-
class
AUE4CVGameMode¶ Inherits from AGameMode
-
class
FServerConfig¶
API¶
-
class
FCommandDispatcher¶ Engine to execute commands.
-
class
FCommandHandler¶ Subclassed by FActionCommandHandler, FAliasCommandHandler, FCameraCommandHandler, FObjectCommandHandler, FPluginCommandHandler
-
class
FActionCommandHandler¶ Inherits from FCommandHandler
-
class
FAliasCommandHandler¶ Inherits from FCommandHandler
-
class
FCameraCommandHandler¶ Inherits from FCommandHandler
-
class
FObjectCommandHandler¶ Inherits from FCommandHandler
-
class
FPluginCommandHandler¶ Inherits from FCommandHandler