Skip to content

Commit 6c24fae

Browse files
committed
update for dynamic-graph-python v4
1 parent 22e1f28 commit 6c24fae

File tree

7 files changed

+18
-16
lines changed

7 files changed

+18
-16
lines changed

CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,14 @@ COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
3333
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
3434

3535
# Project dependencies
36-
ADD_PROJECT_DEPENDENCY(dynamic-graph REQUIRED PKG_CONFIG_REQUIRES dynamic-graph)
36+
ADD_PROJECT_DEPENDENCY(dynamic-graph REQUIRED)
3737
IF(BUILD_TESTING)
3838
FIND_PACKAGE(Boost REQUIRED COMPONENTS unit_test_framework)
3939
ENDIF(BUILD_TESTING)
4040

4141
IF(BUILD_PYTHON_INTERFACE)
4242
FINDPYTHON()
43-
ADD_PROJECT_DEPENDENCY(dynamic-graph-python REQUIRED
44-
PKG_CONFIG_REQUIRES dynamic-graph-python)
43+
ADD_PROJECT_DEPENDENCY(dynamic-graph-python 4.0.0 REQUIRED)
4544
SEARCH_FOR_BOOST_PYTHON(REQUIRED)
4645
ENDIF(BUILD_PYTHON_INTERFACE)
4746

@@ -70,7 +69,9 @@ IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
7069
ENDIF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
7170

7271
ADD_SUBDIRECTORY(src)
73-
ADD_SUBDIRECTORY(tests)
72+
IF(BUILD_TESTING)
73+
ADD_SUBDIRECTORY(tests)
74+
ENDIF(BUILD_TESTING)
7475
ADD_SUBDIRECTORY(doc)
7576

7677
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)

include/dynamic-graph/tutorial/feedback-controller.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class FeedbackController : public Entity {
5454
@}
5555
*/
5656

57-
protected:
57+
public:
5858
/*
5959
\brief Class name
6060
*/

include/dynamic-graph/tutorial/inverted-pendulum.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class InvertedPendulum : public Entity {
125125
@}
126126
*/
127127

128-
protected:
128+
public:
129129
/*
130130
\brief Class name
131131
*/

src/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
IF(BUILD_PYTHON_INTERFACE)
22
PYTHON_INSTALL_ON_SITE("dynamic_graph/tutorial" simu.py)
3-
DYNAMIC_GRAPH_PYTHON_MODULE("tutorial" ${PROJECT_NAME} tutorial-wrap)
3+
DYNAMIC_GRAPH_PYTHON_MODULE("tutorial" ${PROJECT_NAME} tutorial-wrap
4+
MODULE_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/tutorial-python.h")
45
ENDIF(BUILD_PYTHON_INTERFACE)

src/dynamic_graph/tutorial/simu.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,9 @@ def build_graph():
2626
s = stateOut
2727
f = forceIn
2828

29-
s.value = (0.0, 0.1, 0.0, 0.0)
30-
31-
gain = ((
32-
0.0,
33-
27.0,
34-
0.001,
35-
0.001,
36-
), )
29+
s.value = np.array((0.0, 0.1, 0.0, 0.0))
30+
31+
gain = np.array((0.0, 27.0, 0.001, 0.001))
3732
b.setGain(gain, )
3833

3934
return s, f, a

src/tutorial-python.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include "dynamic-graph/tutorial/feedback-controller.hh"
2+
#include "dynamic-graph/tutorial/inverted-pendulum.hh"
3+
4+
typedef boost::mpl::vector<dynamicgraph::tutorial::FeedbackController, dynamicgraph::tutorial::InvertedPendulum>
5+
entities_t;

0 commit comments

Comments
 (0)