| 1 | /* | 
|---|
| 2 |  * node.cpp | 
|---|
| 3 |  * | 
|---|
| 4 |  *  Created on: July 24, 2012 | 
|---|
| 5 |  *      Author: Berk Calli | 
|---|
| 6 |  *      Organization: Delft Biorobotics Lab., Delft University of Technology | 
|---|
| 7 |  *              Contact info: b.calli@tudelft.nl, web: www.dbl.tudelft.nl | 
|---|
| 8 |  * | 
|---|
| 9 |  *      Node for neural network extremum seeking control | 
|---|
| 10 |  */ | 
|---|
| 11 |  | 
|---|
| 12 | #include <esc_nn/nn_esc_1d.h> | 
|---|
| 13 | #include "esc_ros/esc_ros.h" | 
|---|
| 14 |  | 
|---|
| 15 | int main(int argc, char **argv) { | 
|---|
| 16 |  | 
|---|
| 17 |         ros::init(argc, argv, "nn_esc_1d"); | 
|---|
| 18 |         ros::NodeHandle n("~"); | 
|---|
| 19 |  | 
|---|
| 20 |         double A, B, M, ddelta, delta, period; | 
|---|
| 21 |         if (!n.getParam("A", A)){ | 
|---|
| 22 |                 ROS_WARN("[nn_esc_1D]: Failed to get the parameter A from the parameter server. Using the default value."); | 
|---|
| 23 |                 A = 0; | 
|---|
| 24 |         } | 
|---|
| 25 |         if (!n.getParam("B", B)){ | 
|---|
| 26 |                 ROS_WARN("[nn_esc_1D]: Failed to get the parameter B from the parameter server. Using the default value."); | 
|---|
| 27 |                 B = 0; | 
|---|
| 28 |         } | 
|---|
| 29 |         if (!n.getParam("M", M)){ | 
|---|
| 30 |                 ROS_WARN("[nn_esc_1D]: Failed to get the parameter M from the parameter server. Using the default value."); | 
|---|
| 31 |                 M = 0; | 
|---|
| 32 |         } | 
|---|
| 33 |         if (!n.getParam("ddelta", ddelta)){ | 
|---|
| 34 |                 ROS_WARN("[nn_esc_1D]: Failed to get the parameter ddelta from the parameter server. Using the default value."); | 
|---|
| 35 |                 ddelta = 0; | 
|---|
| 36 |         } | 
|---|
| 37 |         if (!n.getParam("delta", delta)){ | 
|---|
| 38 |                 ROS_WARN("[nn_esc_1D]: Failed to get the parameter delta from the parameter server. Using the default value."); | 
|---|
| 39 |                 delta = 0; | 
|---|
| 40 |         } | 
|---|
| 41 |         if (!n.getParam("period", period)){ | 
|---|
| 42 |                 ROS_WARN("[nn_esc_1D]: Failed to get the parameter period from the parameter server. Using the default value."); | 
|---|
| 43 |                 period = 0; | 
|---|
| 44 |         } | 
|---|
| 45 |  | 
|---|
| 46 |         ESCROS esc_ros(&n); | 
|---|
| 47 |         NNESC1D* nn_esc_1d = new NNESC1D(A,M,B,ddelta,delta,period); | 
|---|
| 48 |         esc_ros.init(nn_esc_1d); | 
|---|
| 49 |         esc_ros.spin(); | 
|---|
| 50 |  | 
|---|
| 51 |         return 0; | 
|---|
| 52 | } | 
|---|