Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Lua and Databroker support #190

Merged
merged 22 commits into from
Jul 5, 2024
Merged

Add Lua and Databroker support #190

merged 22 commits into from
Jul 5, 2024

Conversation

cassava
Copy link
Contributor

@cassava cassava commented Dec 5, 2023

Test this with the following:

# Get the code:
git checkout ben/develop

# (Optional) Reset to origin if necessary:
git fetch
git reset --hard origin/ben/develop

# (Optional) Set up separate conan home:
export CONAN_USER_HOME=~/.cache/cloe-0.25.0
mkdir $CONAN_USER_HOME
make setup-conan

# Build cloe:
make export-vendor
echo "0.25.0-develop" > VERSION
make editable
make clean all

# Launch runtime environment:
make setup-python deploy-cli
cloe-launch shell tests/conanfile_all.py
bats tests

@cassava cassava requested a review from tobifalk as a code owner December 5, 2023 10:12
@cassava cassava force-pushed the ben/develop branch 3 times, most recently from a8e4de2 to 4e84feb Compare December 8, 2023 11:41
@cassava cassava force-pushed the ben/develop branch 3 times, most recently from abcf824 to 1e02a5c Compare March 28, 2024 15:27
@cassava cassava force-pushed the ben/develop branch 2 times, most recently from 523cffa to 25c8196 Compare April 22, 2024 11:03
@cassava cassava changed the title Preparation of commit reorganization for creation of PRs Add Lua and Databroker support May 8, 2024
@cassava cassava added this to the 0.25.0 milestone May 8, 2024
@cassava cassava self-assigned this May 14, 2024
@cassava cassava force-pushed the ben/develop branch 6 times, most recently from e7e0ea4 to d672d71 Compare May 16, 2024 22:09
engine/src/lua_setup.cpp Outdated Show resolved Hide resolved
runtime/include/cloe/data_broker.hpp Show resolved Hide resolved
engine/src/lua_api.hpp Outdated Show resolved Hide resolved
* Detects the presence of the to_lua function (based on ADL)
*/
template <typename T>
constexpr bool has_to_lua_v = has_to_lua<T>::value;
Copy link

@hvolx hvolx May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SEVERITY_LOW If I am not wrong, this does not care about the return type of the to_lua function.

template <typename T>
void to_lua(sol::state_view lua) {
if constexpr (has_to_lua_v<T>) {
to_lua(lua, static_cast<T*>(nullptr));
Copy link

@hvolx hvolx May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SEVERITY_LOW What? :D I know you need that parameter T* functionwise but I from a users perspective this does not make sense. People implementing the to_lua function will ask what they are supposed to do with that parameter.

(As per my understanding, the to_lua function is supposed to be implemented as a member function of T)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And having a look at the implementation of the to_lua function in the Wheel class: According to my own trials, the data type of usertype_table["rotation"] is double Wheel::* - I dont understand what exactly is happening tbh. Could you explain this to me once?

if constexpr (has_to_lua_v<T>) {
to_lua(lua, static_cast<T*>(nullptr));
} else {
// nop
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about throwing a proper exception here?

cassava added 4 commits June 13, 2024 11:30
BREAKING CHANGE: If you have implemented any Actions yourself,
you will need to make sure the `operator()(const Sync& ...)`
returns `cloe::CallbackResult`. You can use `CallbackResult::Ok`
to achieve the same behavior.
cassava and others added 14 commits June 13, 2024 11:30
Linenoise-Source: https://github.com/antirez/linenoise
Linenoise-Commit: 93b2db9bd4968f76148dd62cdadf050ed50b84b3
Linenoise-Date: 2023-03-27
- Add slimmed down LRDB library to the engine/vendor/lrdb directory.
- It can be compiled in or out via option (in by default)
- The command-line flags are --debug-lua and --debug-lua-port
TODO:
- Add documentation on how to use it.
- Add tests using them.

Author: Martin Henselmeyer <[email protected]>
BREAKING CHANGES:

- xdg_ functions take and return std::filesystem::path
  instead of boost::filesystem::path.

- Command takes a std::filesystem::path
  instead of boost::filesystem::path.

For the most part, all you need to do is change the namespace
to migrate.
@cassava
Copy link
Contributor Author

cassava commented Jun 26, 2024

All Lua stuff in the data broker I would leave as is, since in the next version substantial changes will be introduced from Moritz.

This provides an easy mechanism to check a simulation configuration
for available trigers, signals, etc.
@cassava cassava merged commit 4be46cb into master Jul 5, 2024
10 checks passed
@cassava cassava deleted the ben/develop branch July 5, 2024 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants