23 #include "engine_thread.h"
25 #include "skill_wrapper.h"
26 #include "xabsl_tools.h"
28 #include <XabslEngine/XabslEngine.h>
29 #include <core/exceptions/software.h>
30 #include <interfaces/ObjectPositionInterface.h>
31 #include <interfaces/SkillerInterface.h>
32 #include <utils/time/time.h>
44 static unsigned long int
62 :
Thread(
"XabslEngineThread",
Thread::OPMODE_WAITFORWAKEUP),
71 throw Exception(
"Global XabslEngineThread has already been set.");
85 xe_ =
new xabsl::Engine(*xleh_, &xet_current_time);
91 params.push_back(std::make_pair(
"x",
"double"));
92 params.push_back(std::make_pair(
"y",
"double"));
93 params.push_back(std::make_pair(
"ori",
"double"));
95 wrappers_[sw->
name()] = sw;
96 xe_->registerBasicBehavior(*sw);
98 ball_ry_ = ball_rx_ = NULL;
100 if (strcmp(i.get_name(),
"relative_x") == 0) {
103 (
float *)i.get_value());
104 xe_->registerDecimalInputSymbol(
"ball.relative_x",
106 (
double (xabsl::FunctionProvider::*)())
108 }
else if (strcmp(i.get_name(),
"relative_y") == 0) {
111 (
float *)i.get_value());
112 xe_->registerDecimalInputSymbol(
"ball.relative_y",
114 (
double (xabsl::FunctionProvider::*)())
120 xe_->createOptionGraph(xinput);
122 if (xleh_->errorsOccurred) {
124 throw Exception(
"Error while creating XABSL engine, see log for details");
180 for (wit_ = wrappers_.begin(); wit_ != wrappers_.end(); ++wit_) {
204 "Cannot aquire exclusive skiller "
205 "control, exception follows");
220 std::string skill_string =
"";
221 for (wit_ = wrappers_.begin(); wit_ != wrappers_.end(); ++wit_) {
222 std::string css = wit_->second->skill_string();
224 skill_string += css +
"; ";
227 if (skill_string !=
"") {
234 logger->
log_warn(
"XabslEngineThread",
"Executing skill failed, exception follows");