Compatibility with RoboidControl

This commit is contained in:
Pascal Serrarens 2025-02-26 08:51:30 +01:00
parent 25a0d5e9a4
commit e4cd11db60
4 changed files with 16 additions and 16 deletions

View File

@ -5,7 +5,7 @@ if(ESP_PLATFORM)
INCLUDE_DIRS "." INCLUDE_DIRS "."
) )
else() else()
project(ControlCore) project(RoboidCOntrol)
add_subdirectory(LinearAlgebra) add_subdirectory(LinearAlgebra)
set(CMAKE_CXX_STANDARD 17) # Enable c++11 standard set(CMAKE_CXX_STANDARD 17) # Enable c++11 standard
@ -35,30 +35,30 @@ else()
Posix/*.cpp Posix/*.cpp
Windows/*.cpp Windows/*.cpp
) )
add_library(ControlCore STATIC ${srcs}) add_library(RoboidControl STATIC ${srcs})
enable_testing() enable_testing()
file(GLOB_RECURSE test_srcs test/*_test.cc) file(GLOB_RECURSE test_srcs test/*_test.cc)
add_executable( add_executable(
ControlCoreTest RoboidControlTest
${test_srcs} ${test_srcs}
) )
target_link_libraries( target_link_libraries(
ControlCoreTest RoboidControlTest
gtest_main gtest_main
ControlCore RoboidControl
LinearAlgebra LinearAlgebra
) )
# if(MSVC) # if(MSVC)
# target_compile_options(ControlCoreTest PRIVATE /W4 /WX) # target_compile_options(RoboidControlTest PRIVATE /W4 /WX)
# # else() # # else()
# # target_compile_options(ControlCoreTest PRIVATE -Wall -Wextra -Wpedantic -Werror) # # target_compile_options(RoboidControlTest PRIVATE -Wall -Wextra -Wpedantic -Werror)
# endif() # endif()
include(GoogleTest) include(GoogleTest)
gtest_discover_tests(ControlCoreTest) gtest_discover_tests(RoboidControlTest)
endif() endif()

View File

@ -73,7 +73,7 @@ void Participant::Receive() {
inet_ntop(AF_INET, &(client_addr.sin_addr), sender_ipAddress, INET_ADDRSTRLEN); inet_ntop(AF_INET, &(client_addr.sin_addr), sender_ipAddress, INET_ADDRSTRLEN);
int sender_port = ntohs(client_addr.sin_port); int sender_port = ntohs(client_addr.sin_port);
RoboidControl::Participant* remoteParticipant = this->GetParticipant(sender_ipAddress, sender_port); RoboidControl::RemoteParticipant* remoteParticipant = this->GetParticipant(sender_ipAddress, sender_port);
if (remoteParticipant == nullptr) { if (remoteParticipant == nullptr) {
remoteParticipant = this->AddParticipant(sender_ipAddress, sender_port); remoteParticipant = this->AddParticipant(sender_ipAddress, sender_port);
// std::cout << "New sender " << sender_ipAddress << ":" << sender_port // std::cout << "New sender " << sender_ipAddress << ":" << sender_port

View File

@ -30,14 +30,14 @@ TEST_F(ControlCoreSuite2, Dummytest2) {
} }
TEST_F(ControlCoreSuite2, Basic2) { TEST_F(ControlCoreSuite2, Basic2) {
Thing t = Thing(); // Thing t = Thing();
unsigned long milliseconds = (unsigned long)std::chrono::steady_clock::now() // unsigned long milliseconds = (unsigned long)std::chrono::steady_clock::now()
.time_since_epoch() // .time_since_epoch()
.count(); // .count();
// Thing::UpdateAll(milliseconds); // // Thing::UpdateAll(milliseconds);
t.Update(milliseconds); // t.Update(milliseconds);
} }
#endif #endif

View File

@ -80,7 +80,7 @@ TEST_F(ControlCoreSuite, SiteParticipant) {
TEST_F(ControlCoreSuite, Thing) { TEST_F(ControlCoreSuite, Thing) {
SiteServer site = SiteServer(7681); SiteServer site = SiteServer(7681);
Participant participant = Participant("127.0.0.1", 7681); Participant participant = Participant("127.0.0.1", 7681);
Thing thing = Thing(); Thing thing = Thing(&participant);
unsigned long milliseconds = get_time_ms(); unsigned long milliseconds = get_time_ms();
unsigned long startTime = milliseconds; unsigned long startTime = milliseconds;