[5] | 1 | /* |
---|
| 2 | * node.cpp |
---|
| 3 | * |
---|
| 4 | * Created on: Jul 31, 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 two dimensional approximation based network extremum seeking control |
---|
| 10 | */ |
---|
| 11 | |
---|
| 12 | #include <esc_approx/approx_esc_2d.h> |
---|
| 13 | #include "esc_ros/esc_ros.h" |
---|
| 14 | |
---|
| 15 | int main(int argc, char **argv) { |
---|
| 16 | |
---|
| 17 | ros::init(argc, argv, "approx_esc_2d"); |
---|
| 18 | ros::NodeHandle n("~"); |
---|
| 19 | |
---|
| 20 | int data_size, sampling; |
---|
| 21 | double k_grad, init_vel; |
---|
| 22 | if (!n.getParam("data_size", data_size)){ |
---|
| 23 | ROS_WARN("[approx_esc_2d]: Failed to get the parameter data_size from the parameter server. Using the default value."); |
---|
| 24 | data_size = 0; |
---|
| 25 | } |
---|
| 26 | if (!n.getParam("sampling", sampling)){ |
---|
| 27 | ROS_WARN("[approx_esc_2d]: Failed to get the parameter sampling from the parameter server. Using the default value."); |
---|
| 28 | sampling = 0; |
---|
| 29 | } |
---|
| 30 | if (!n.getParam("k_grad", k_grad)){ |
---|
| 31 | ROS_WARN("[approx_esc_2d]: Failed to get the parameter k_grad from the parameter server. Using the default value."); |
---|
| 32 | k_grad = 0; |
---|
| 33 | } |
---|
| 34 | if (!n.getParam("init_vel", init_vel)){ |
---|
| 35 | ROS_WARN("[approx_esc_2d]: Failed to get the parameter init_vel from the parameter server. Using the default value."); |
---|
| 36 | init_vel = 0; |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | ESCROS esc_ros(&n); |
---|
| 40 | ApproxESC2D* approx_esc_2d = new ApproxESC2D(data_size,k_grad,init_vel,sampling); |
---|
| 41 | esc_ros.init(approx_esc_2d); |
---|
| 42 | esc_ros.spin(); |
---|
| 43 | |
---|
| 44 | return 0; |
---|
| 45 | } |
---|