Skip to content

Commit

Permalink
behaviors now get loaded and work to the best of my knowledge
Browse files Browse the repository at this point in the history
  • Loading branch information
Octavian Neamtu committed Nov 16, 2011
1 parent ef4eb47 commit 04218e5
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Expand Up @@ -4,6 +4,10 @@ cmake_minimum_required(VERSION 2.8.0)


# set up sub projects and includes # set up sub projects and includes


set( NBITES_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
set( MAN_SRC_DIR ${NBITES_SRC_DIR}/man )
set( QTOOL_SRC_DIR ${NBITES_SRC_DIR}/qtool )

include_directories( . ) #current directory include_directories( . ) #current directory
add_subdirectory(man) add_subdirectory(man)
# this pulls all the include dependencies of man so that the qtool can inherit them # this pulls all the include dependencies of man so that the qtool can inherit them
Expand Down
2 changes: 1 addition & 1 deletion src/man/comm/__init__.py
@@ -1,5 +1,5 @@
try: try:
from ._comm import (Comm, from _comm import (Comm,
GameController, GameController,
inst, inst,
STATE_FINISHED, STATE_FINISHED,
Expand Down
10 changes: 8 additions & 2 deletions src/man/noggin/Noggin.cpp
Expand Up @@ -527,14 +527,15 @@ void Noggin::modifySysPath ()
const char *cwd = test.c_str(); const char *cwd = test.c_str();
# else //WEBOTS # else //WEBOTS
# if defined OFFLINE || defined STRAIGHT # if defined OFFLINE || defined STRAIGHT
const char *cwd = "/usr/local/nao-1.6/modules/lib"; string dir1 = string(getenv("NBITES_DIR")) + "/build/qtool";
string dir2 = string(getenv("NBITES_DIR")) + "/build/qtool/man";
# else # else
const char *cwd = "/home/nao/naoqi/lib"; const char *cwd = "/home/nao/naoqi/lib";
# endif # endif
# endif # endif


#ifdef DEBUG_NOGGIN_INITIALIZATION #ifdef DEBUG_NOGGIN_INITIALIZATION
printf(" Adding %s to sys.path\n", cwd); // printf(" Adding %s to sys.path\n", cwd);
#endif #endif


PyObject *sys_module = PyImport_ImportModule("sys"); PyObject *sys_module = PyImport_ImportModule("sys");
Expand All @@ -547,7 +548,12 @@ void Noggin::modifySysPath ()
}else { }else {
PyObject *dict = PyModule_GetDict(sys_module); PyObject *dict = PyModule_GetDict(sys_module);
PyObject *path = PyDict_GetItemString(dict, "path"); PyObject *path = PyDict_GetItemString(dict, "path");
#ifdef OFFLINE
PyList_Append(path, PyString_FromString(dir1.c_str()));
PyList_Append(path, PyString_FromString(dir2.c_str()));
#else
PyList_Append(path, PyString_FromString(cwd)); PyList_Append(path, PyString_FromString(cwd));
#endif
Py_DECREF(sys_module); Py_DECREF(sys_module);
} }
} }
Expand Down
2 changes: 1 addition & 1 deletion src/man/noggin/navigator/NavStates.py
Expand Up @@ -3,7 +3,7 @@
from . import NavHelper as helper from . import NavHelper as helper
from . import WalkHelper as walker from . import WalkHelper as walker
from . import NavTransitions as navTrans from . import NavTransitions as navTrans
from ..objects import RobotLocation from objects import RobotLocation


from math import fabs from math import fabs


Expand Down
27 changes: 25 additions & 2 deletions src/qtool/offline/CMakeLists.txt
Expand Up @@ -36,5 +36,28 @@ target_link_libraries(
manpreloader manpreloader
${QT_LIBRARIES} ${QT_LIBRARIES}
) )


add_dependencies( offline man ) # Copy files from source directory to destination directory, substituting any
# variables. Create destination directory if it does not exist.
# http://stackoverflow.com/questions/697560/how-to-copy-directory-from-source-tree-to-binary-tree

macro(copy_py_sources srcDir destDir)
message(STATUS "Configuring directory ${destDir}")
make_directory(${destDir})

file(GLOB_RECURSE templateFiles RELATIVE ${srcDir} ${srcDir}/*.py)
foreach(templateFile ${templateFiles})
set(srcTemplatePath ${srcDir}/${templateFile})
if(NOT IS_DIRECTORY ${srcTemplatePath})
message(STATUS "Configuring file ${templateFile}")
configure_file(
${srcTemplatePath}
${destDir}/${templateFile}
@ONLY)
endif(NOT IS_DIRECTORY ${srcTemplatePath})
endforeach(templateFile)
endmacro(copy_py_sources)

add_dependencies( offline man )

copy_py_sources( ${MAN_SRC_DIR} ${CMAKE_BINARY_DIR}/man )

0 comments on commit 04218e5

Please sign in to comment.