Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
55639a3
Emphasize that Maxon owns these components
jc-luna Mar 10, 2026
7ee5614
Nested epos meson.build for grabbing it as a dependency
jc-luna Mar 10, 2026
70290a4
Acquire device info
jc-luna Mar 11, 2026
ee6b5ad
Actually to EPOS2 libraries (if they're there)
jc-luna Mar 11, 2026
9d6caff
Don't add controller interface sources if you can't
jc-luna Mar 11, 2026
352f88d
an actually proper guard for CI only
jc-luna Mar 11, 2026
7afd564
Don't forget the comma
jc-luna Mar 11, 2026
3d55ef6
dll export
jc-luna Mar 16, 2026
8fdd467
Just put it all into one src for now
jc-luna Mar 18, 2026
2c6238b
Wrap around EPOS device init
jc-luna Mar 18, 2026
36ce013
Merge branch 'main' of github.com:team-gets/libtestrig into epos2-doc…
jc-luna Mar 18, 2026
32e1f79
Don't forget the (non)portable pragma guard
jc-luna Mar 19, 2026
e3bc459
More fixups on meson.builds
jc-luna Mar 19, 2026
f549b83
minimal implements of devve ident + comms opens/closes
jc-luna Mar 19, 2026
bffbb9f
Controller identity printer
jc-luna Mar 19, 2026
18a2823
EPOS Sources reorganized
jc-luna Mar 19, 2026
2a3e4dc
It acquires only the first device
jc-luna Mar 19, 2026
4c5daf4
Actually i should make these discrete things
jc-luna Mar 19, 2026
3817959
Proper device identifiers
jc-luna Mar 20, 2026
a13a180
Node set
jc-luna Mar 20, 2026
707f880
Set enable/disable states
jc-luna Mar 20, 2026
6ea658e
Gateway topology subdevice functions
jc-luna Mar 20, 2026
51d302a
All files to lib dir
jc-luna Mar 22, 2026
ef65536
Pass struct arrs and not dbl stars
jc-luna Mar 23, 2026
fd72de5
Warn about probing for way too many controllers
jc-luna Mar 23, 2026
b9010bb
Change dbl star to arr in connect.c
jc-luna Mar 23, 2026
6b457e8
Error Decoder
jc-luna Mar 23, 2026
47e03b0
Init/open one device
jc-luna Mar 23, 2026
aab18a7
Init a CMakeLists.txt
jc-luna Mar 23, 2026
88c247b
Build systems actions
jc-luna Mar 23, 2026
4407907
CI Action to target proper files
jc-luna Mar 23, 2026
7c039b2
Less verbose action names
jc-luna Mar 23, 2026
9781ce4
DLL compile define in CMake
jc-luna Mar 23, 2026
de504ba
Link to windows lib
jc-luna Mar 24, 2026
4bf1a1d
Merge pull request #19 from team-gets/cmake-building
jc-luna Mar 24, 2026
cb1fb61
Device resetter
jc-luna Mar 24, 2026
93e9e28
Merge branch 'epos2-docs-only' of github.com:team-gets/libtestrig int…
jc-luna Mar 24, 2026
e7031e3
Test rig abort
jc-luna Mar 24, 2026
16f0c3b
Check for uninit handles
jc-luna Mar 24, 2026
1b08c38
CMake operate relative to THIS CMakeLists.txt
jc-luna Mar 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/build-cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CMake

on:
pull_request:
branches: ["main"]
paths:
- ".github/workflows/build-cmake.yml"
- "ipc/**/*.c"
- "ipc/**/*.h"
- "**/CMakeLists.txt"
- "cmake/*.cmake"
push:
branches: ["main"]
paths:
- ".github/workflows/build-cmake.yml"
- "ipc/**/*.c"
- "ipc/**/*.h"
- "**/CMakeLists.txt"
- "cmake/*.cmake"

jobs:
linux-build-cmake:
name: Linux
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
compiler: ["gcc", "clang"]
steps:
- uses: actions/checkout@v5
- name: Setup CMake
run: |
CC=${{ matrix.compiler }} cmake -S . -B build
- name: Build
run: |
CC=${{ matrix.compiler }} cmake --build build

windows-build-cmake:
name: Windows
runs-on: windows-latest
strategy:
fail-fast: true
matrix:
compiler: ["cl.exe", "gcc.exe"]
steps:
- uses: actions/checkout@v5
- uses: ilammy/msvc-dev-cmd@v1.13.0
- name: Setup CMake
run: |
cmake -S . -B build
env:
CC: ${{ matrix.compiler }}
- name: Build
run: |
cmake --build build
env:
CC: ${{ matrix.compiler }}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: Build and Test
name: Meson

on:
pull_request:
branches: ["main"]
paths:
- ".github/workflows/build.yml"
- ".github/workflows/build-meson.yml"
- "ipc/**/*.c"
- "ipc/**/*.h"
- "**/meson.build"
push:
branches: ["main"]
paths:
- ".github/workflows/build.yml"
- ".github/workflows/build-meson.yml"
- "ipc/**/*.c"
- "ipc/**/*.h"
- "**/meson.build"
Expand Down Expand Up @@ -41,6 +41,7 @@ jobs:
- name: Verbosely Test
run: |
meson test -v -C build

windows-build-meson:
name: Windows
runs-on: windows-latest
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ build
compile_commands.json
.cache
.meson-subproject-wrap-hash.txt

*.a*
*.so*
*.lib
*.dll
43 changes: 43 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.30..4.0)
project(libtestrig
LANGUAGES C)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

set(LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib")
set(IPC_DIR "${LIB_DIR}/ipc")
set(EPOS_DIR "${LIB_DIR}/epos2")

set(IPC_SOURCES
"${IPC_DIR}/ipc.c"
"${IPC_DIR}/constants.c"
"${IPC_DIR}/message.c"
"${IPC_DIR}/os.c")

set(EPOS_SOURCES
"${EPOS_DIR}/epos2.c"
"${EPOS_DIR}/connect.c"
"${EPOS_DIR}/definitions.c"
"${EPOS_DIR}/manage.c"
"${EPOS_DIR}/identify.c")

set(LIBTESTRIG_SOURCES ${IPC_SOURCES})

find_package(EPOSCmd)
if (EPOSCmd_FOUND)
list(APPEND LIBTESTRIG_SOURCES ${EPOS_SOURCES})
else()
message("Controller capabilities not being built.")
endif()

add_library(Libtestrig SHARED ${LIBTESTRIG_SOURCES})
target_compile_definitions(Libtestrig PRIVATE COMPILING_TESTRIG_DLL)
target_include_directories(Libtestrig PUBLIC ${LIB_DIR})

if (WIN32)
target_link_libraries(Libtestrig PRIVATE Ws2_32)
endif()

if (EPOSCmd_FOUND)
target_link_libraries(Libtestrig PUBLIC EPOSCmd)
endif()
Empty file added cmake/FindEPOSCmd.cmake
Empty file.
533 changes: 0 additions & 533 deletions epos2/definitions.h

This file was deleted.

3 changes: 3 additions & 0 deletions lib/epos2/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The EPOS brand of controllers and associated command library is copyright © maxon. All rights reserved.

No infringement or intent thereof is made by the developers of this software.
111 changes: 111 additions & 0 deletions lib/epos2/connect.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#include <stdio.h>

#include "epos2.h"
#include "connect.h"
#include "definitions.h"
#include "identify.h"

static void FailedOpenDevice(uint32_t error_code) {
PrintError(error_code);
printf("Failed to open device with with following characteristics:\n");
}

uint32_t InitializeDevice(struct Controller* controller_out, void* node, uint8_t node_id) {
uint32_t error_code = 0;

node = VCS_OpenDevice(controller_out->Name,
controller_out->Protocol,
controller_out->Interface,
controller_out->Port,
&error_code);

controller_out->NodeId = node_id;

if (node == 0 || error_code != 0) {
FailedOpenDevice(error_code);
PrintControllerCharacteristics(controller_out);
}

CleanEnableDevice(controller_out, node);

return error_code;
}

uint32_t InitializeDevices(struct Controller controllers_out[], void* node_1, void* node_2, void* node_3) {
uint32_t error_code = 0;

node_1 = VCS_OpenDevice(controllers_out[0].Name,
controllers_out[0].Protocol,
controllers_out[0].Interface,
controllers_out[0].Port,
&error_code);

controllers_out[0].NodeId = 1;

if (node_1 == 0 || error_code != 0) {
FailedOpenDevice(error_code);
PrintControllerCharacteristics(&controllers_out[0]);
return error_code;
};

CleanEnableDevice(&controllers_out[0], node_1);

node_2 = VCS_OpenSubDevice(node_1,
controllers_out[1].Name,
controllers_out[1].Protocol,
&error_code);

controllers_out[1].NodeId = 2;

if (node_2 == 0 || error_code != 0) {
FailedOpenDevice(error_code);
PrintControllerCharacteristics(&controllers_out[1]);
return error_code;
};

CleanEnableDevice(&controllers_out[1], node_2);

node_3 = VCS_OpenSubDevice(node_2,
controllers_out[2].Name,
controllers_out[2].Protocol,
&error_code);

if (node_3 == 0 || error_code != 0) {
FailedOpenDevice(error_code);
PrintControllerCharacteristics(&controllers_out[2]);
return error_code;
};

controllers_out[2].NodeId = 3;

CleanEnableDevice(&controllers_out[2], node_2);

return 0;
} // uint32_t InitializeThreeDevices

uint32_t CleanEnableDevice(struct Controller* controller, void* device_handle) {
if (device_handle == 0) { return 0x2000000B; }
uint32_t error_code = 0;
int ret;

ret = VCS_ClearFault(device_handle, controller->NodeId, &error_code);
if (ret == 0) { return error_code; }

ret = VCS_SetEnableState(device_handle, controller->NodeId, &error_code);
controller->State = CTRL_STATE_OPENED;
return error_code;
}

uint32_t CloseDevice(struct Controller* controller, void* device_handle) {
if (device_handle == 0) { return 0x2000000B; }
uint32_t error_code = 0;
int ret;

ret = VCS_CloseDevice(device_handle, &error_code);
if (ret == 0) { return error_code; }

ret = VCS_SetDisableState(device_handle, controller->NodeId, &error_code);
controller->State = CTRL_STATE_CLOSED;
return error_code;
}

48 changes: 48 additions & 0 deletions lib/epos2/connect.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

#include "libtestrig_api.h"
#include "controller.h"

#ifdef __cplusplus
} // extern "C" (headers)
namespace VSCL::Rig {
extern "C" {
#endif // __cplusplus

uint32_t TESTRIG_API CleanEnableDevice(struct Controller* controller, void* device_handle);

/*
* @brief Opens communication to the device and sets its state for a clean init.
*
* Refer to Page 162 of the manual under INITIALIZATION,
* which describes several of the methods wrapped here.
*/
uint32_t TESTRIG_API InitializeDevice(struct Controller* controller_out, void* node, uint8_t node_id);

/*
* @brief Opens communication to the device and sets its state for a clean init.
* This makes a lot of assumptions
*
* Refer to Page 162 of the manual under INITIALIZATION,
* which describes several of the methods wrapped here.
*/
uint32_t TESTRIG_API InitializeDevices(struct Controller controllers_out[], void* node_1, void* node_2, void* node_3);

/*
* Closes all connections to the controller
*
* Refer to Page 162 of the manual under CLOSING PROCEDURE,
* which describes several of the methods wrapped here.
*/
uint32_t TESTRIG_API CloseDevice(struct Controller* controller, void* device_handle);

#ifdef __cplusplus
} // extern "C"
} // namespace VSCL::Rig
#endif // __cplusplus
43 changes: 43 additions & 0 deletions lib/epos2/controller.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#pragma once

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

#include <stdint.h>

#ifdef __cplusplus
} // extern "C" (headers)
namespace VSCL::Rig {
extern "C" {
#endif // __cplusplus

enum ControllerState {
CTRL_STATE_CLOSED = 1,
CTRL_STATE_OPENED = 2,
};

/*
* @brief A struct representing a controller.
*
* Refer to the parameters passed to VCS_OpenDevice, Page 13 of the Manual.
*/
struct Controller {
// The name of the controller.
char Name[8];
// The name of the communication protocol.
char Protocol[16];
// The name of the connection interface.
char Interface[64];
// The name of the port used in connection.
char Port[8];
// The node of the controller.
uint8_t NodeId;
// State of the controller.
enum ControllerState State;
};

#ifdef __cplusplus
} // extern "C"
} // namespace VSCL::Rig
#endif // __cplusplus
Loading
Loading