Skip to content
Merged
20 changes: 4 additions & 16 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,24 +280,12 @@ Now that you're setup, if you can run it on the command line, you can run it in
- Xbox control allows us to use a connected Xbox controller to control the robots
4. Run our SimulatedPlayTests in Thunderscope
- This will launch the visualizer and simulate AI Plays, allowing us to visually see the robots acting according to their roles.
1. For legacy C++ tests (#2581) with the visualizer:
1. First run Thunderscope configured for receiving protobufs over unix sockets correctly: `./tbots.py run thunderscope_main --visualize_cpp_test`
2. Then run `./tbots.py test [some_target_here] --run_sim_in_realtime`
2. For PyTests:
- With the visualizer: `./tbots.py test [some_target_here] -t`
- Without the visualizer: `./tbots.py test [some_target_here]`
3. For legacy C++ tests (#2581) without the visualizer:
- `./tbots.py test [some_target_here]`
- With the visualizer: `./tbots.py test [some_target_here] -t`
- Without the visualizer: `./tbots.py test [some_target_here]`
5. Run our SimulatedTacticTests in Thunderscope:
- This will launch the visualizer and simulate an AI Tactic on a single robot
1. For legacy C++ tests (#2581) with the visualizer:
- First, run Thunderscope configured for receiving protobufs over unix sockets correctly: `./tbots.py run thunderscope_main --visualize_cpp_test`
- Then run `./tbots.py test [some_target_here] --run_sim_in_realtime`
2. For PyTests:
- With the visualizer: `./tbots.py test [some_target_here] -t`
- Without the visualizer: `./tbots.py test [some_target_here]`
3. For legacy C++ tests (#2581) without the visualizer:
- `./tbots.py test [some_target_here]`
- With the visualizer: `./tbots.py test [some_target_here] -t`
- Without the visualizer: `./tbots.py test [some_target_here]`

## Debugging

Expand Down
1 change: 0 additions & 1 deletion src/cli/cli_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ class DebugBinary(str, Enum):
]

EnableThunderscopeOption = Annotated[bool, Option("-t", "--enable_thunderscope")]
EnableVisualizerOption = Annotated[bool, Option("-v", "--enable_visualizer")]
StopAIOnStartOption = Annotated[bool, Option("-s", "--stop_ai_on_start")]

JobsOption = Annotated[str, Option("-j", "--jobs")]
1 change: 0 additions & 1 deletion src/shared/test_util/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ cc_library(
name = "tbots_gtest_main",
testonly = True,
srcs = ["tbots_gtest_main.cpp"],
hdrs = ["tbots_gtest_main.h"],
deps = [
"//software/logger",
"@boost//:program_options",
Expand Down
67 changes: 4 additions & 63 deletions src/shared/test_util/tbots_gtest_main.cpp
Original file line number Diff line number Diff line change
@@ -1,75 +1,16 @@
#include "shared/test_util/tbots_gtest_main.h"

#include <fenv.h>
#include <gtest/gtest.h>

#include <boost/program_options.hpp>

#include "proto/parameters.pb.h"
#include "software/logger/logger.h"

bool TbotsGtestMain::help = false;
bool TbotsGtestMain::enable_visualizer = false;
bool TbotsGtestMain::run_sim_in_realtime = false;
bool TbotsGtestMain::stop_ai_on_start = false;
std::string TbotsGtestMain::runtime_dir = "/tmp/tbots/yellow_test";
double TbotsGtestMain::test_speed = 1.0;

std::string runtime_dir = "/tmp/tbots/yellow_test";

int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
feenableexcept(FE_INVALID | FE_OVERFLOW);

boost::program_options::options_description desc{"Options"};

// TODO #(2510) Remove this once we port over to simulated pytests entirely
desc.add_options()("help,h",
boost::program_options::bool_switch(&TbotsGtestMain::help),
"Help screen");
desc.add_options()(
"enable_visualizer",
boost::program_options::bool_switch(&TbotsGtestMain::enable_visualizer),
"Displays simulated test on visualizer");
desc.add_options()(
"run_sim_in_realtime",
boost::program_options::bool_switch(&TbotsGtestMain::run_sim_in_realtime),
"Runs simulation in realtime, useful to look at simulated C++ tests in "
"thunderscope without running ThreadedFullsystemGUI");
desc.add_options()(
"stop_ai_on_start",
boost::program_options::bool_switch(&TbotsGtestMain::stop_ai_on_start),
"If enable_visualizer is true, then stops the AI when the test starts");
desc.add_options()(
"runtime_dir",
boost::program_options::value<std::string>(&TbotsGtestMain::runtime_dir),
"The directory to output logs to. Absolute paths are recommended as the "
"working directory is inside the bazel-out directory.");
desc.add_options()(
"test_speed", boost::program_options::value<double>(&TbotsGtestMain::test_speed),
"The speed adjustment factor. Values in the range [0.1, 1) will play the"
"test slower than realtime, and values in the range (1, 10] will play the"
"test faster than realtime i.e. 0.1 would be 10X slower than realtime, "
"and 10 would be 10X faster than realtime. Default value is 1.");

boost::program_options::variables_map vm;
boost::program_options::store(parse_command_line(argc, argv, desc), vm);
boost::program_options::notify(vm);

if (!TbotsGtestMain::help)
{
LoggerSingleton::initializeLogger(TbotsGtestMain::runtime_dir, nullptr);
LoggerSingleton::initializeLogger(runtime_dir, nullptr);

if (TbotsGtestMain::enable_visualizer || TbotsGtestMain::run_sim_in_realtime)
{
// disable floating point errors when using visualizer due to potential
// floating point errors in QT
fedisableexcept(FE_INVALID | FE_OVERFLOW);
}
return RUN_ALL_TESTS();
}
else
{
std::cout << desc << std::endl;
return 0;
}
return RUN_ALL_TESTS();
}
28 changes: 0 additions & 28 deletions src/shared/test_util/tbots_gtest_main.h

This file was deleted.

15 changes: 0 additions & 15 deletions src/software/ai/hl/stp/play/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,6 @@ py_test(
],
)

cc_test(
name = "stop_play_cpp_test",
srcs = ["stop_play_test.cpp"],
deps = [
"//shared/test_util:tbots_gtest_main",
"//software/ai/hl/stp/play:stop_play",
"//software/simulated_tests:simulated_er_force_sim_play_test_fixture",
"//software/simulated_tests/cpp_validation:validation_function",
"//software/simulated_tests/non_terminating_validation_functions",
"//software/test_util",
"//software/time:duration",
"//software/world",
],
)

py_test(
name = "stop_play_test",
srcs = [
Expand Down
14 changes: 0 additions & 14 deletions src/software/ai/hl/stp/play/crease_defense/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,6 @@ py_test(
],
)

cc_test(
name = "crease_defense_play_cpp_test",
srcs = ["crease_defense_play_test.cpp"],
deps = [
":crease_defense_play",
"//shared/test_util:tbots_gtest_main",
"//software/simulated_tests:simulated_er_force_sim_play_test_fixture",
"//software/simulated_tests/cpp_validation:validation_function",
"//software/simulated_tests/non_terminating_validation_functions",
"//software/simulated_tests/terminating_validation_functions",
"//software/test_util",
],
)

cc_test(
name = "crease_defense_play_fsm_test",
srcs = ["crease_defense_play_fsm_test.cpp"],
Expand Down

This file was deleted.

14 changes: 0 additions & 14 deletions src/software/ai/hl/stp/play/example/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,6 @@ cc_library(
alwayslink = True,
)

cc_test(
name = "example_play_cpp_test",
srcs = ["example_play_test.cpp"],
deps = [
"//shared/test_util:tbots_gtest_main",
"//software/ai/hl/stp/play/example:example_play",
"//software/simulated_tests:simulated_er_force_sim_play_test_fixture",
"//software/simulated_tests/cpp_validation:validation_function",
"//software/test_util",
"//software/time:duration",
"//software/world",
],
)

cc_test(
name = "example_play_fsm_test",
srcs = ["example_play_fsm_test.cpp"],
Expand Down
64 changes: 0 additions & 64 deletions src/software/ai/hl/stp/play/example/example_play_test.cpp

This file was deleted.

14 changes: 0 additions & 14 deletions src/software/ai/hl/stp/play/free_kick/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,6 @@ cc_library(
alwayslink = True,
)

cc_test(
name = "free_kick_play_cpp_test",
srcs = ["free_kick_play_test.cpp"],
deps = [
"//shared/test_util:tbots_gtest_main",
"//software/ai/hl/stp/play/free_kick:free_kick_play",
"//software/simulated_tests:simulated_er_force_sim_play_test_fixture",
"//software/simulated_tests/cpp_validation:validation_function",
"//software/test_util",
"//software/time:duration",
"//software/world",
],
)

py_test(
name = "free_kick_play_test",
srcs = ["free_kick_play_test.py"],
Expand Down
Loading
Loading