Fawkes API
Fawkes Development Version
|
23 #include "control_thread.h"
25 #include "eclipse_thread.h"
27 #include <core/exception.h>
28 #include <interfaces/TestInterface.h>
44 :
Thread(
"AgentControlThread",
Thread::OPMODE_WAITFORWAKEUP),
46 m_eclipse_thread(eclipse_thread)
63 simulation_shutdown_script_ =
"";
64 allow_shutdown_ =
false;
67 allow_shutdown_ =
config->
get_bool(
"/eclipse-clp/gazebo/allow-shutdown");
72 fawkes_path_ = strdup(
config->
get_string(
"/eclipse-clp/gazebo/fawkes-path").c_str());
75 allow_shutdown_ =
false;
79 simulation_shutdown_script_ =
80 strdup(
config->
get_string(
"/eclipse-clp/gazebo/simulation-shutdown-script").c_str());
83 "error reading config value: /eclipse-clp/gazebo/simulation-shutdown-script");
84 allow_shutdown_ =
false;
88 if (allow_shutdown_) {
108 if (allow_shutdown_) {
119 m_eclipse_thread->
post_event(
"check_debug_msg");
133 m_test_iface->
write();
136 if (allow_shutdown_) {
140 "shutting down: %s%s",
141 fawkes_path_.c_str(),
142 simulation_shutdown_script_.c_str());
143 std::string command = fawkes_path_ + simulation_shutdown_script_;
144 int cmd_rv = system(command.c_str());
147 "Failed to execute '%s'. Return value %d",
bool msgq_first_is()
Check if first message has desired type.
void msgq_pop()
Erase first message from queue.
bool msgq_empty()
Check if queue is empty.
AgentControlThread(EclipseAgentThread *eclipse_thread)
Constructor.
void set_result(const int32_t new_result)
Set result value.
virtual bool prepare_finalize_user()
Prepare finalization user implementation.
virtual void finalize()
Finalize the thread.
int32_t addend() const
Get addend value.
virtual ~AgentControlThread()
Destructor.
virtual bool get_bool(const char *path)=0
virtual void log_info(const char *component, const char *format,...)=0
const char * name() const
virtual void loop()
Code to execute in the thread.
virtual void close(Interface *interface)=0
virtual void log_error(const char *component, const char *format,...)=0
virtual void log_warn(const char *component, const char *format,...)=0
bool has_writer() const
Check if there is a writer for the interface.
void post_event(const char *)
Post an event to the ECLiPSe context.
virtual void init()
Initialize the thread.
virtual std::string get_string(const char *path)=0
virtual Interface * open_for_reading(const char *interface_type, const char *identifier, const char *owner=NULL)=0
int32_t summand() const
Get summand value.
Message * msgq_first()
Get the first message from the message queue.
void write()
Write from local copy into BlackBoard memory.
virtual Interface * open_for_writing(const char *interface_type, const char *identifier, const char *owner=NULL)=0