- Timestamp:
- 08/16/12 15:19:23 (12 years ago)
- Location:
- trunk/extremum_seeking
- Files:
-
- 13 added
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/extremum_seeking/esc_ros/include/esc_ros/esc_ros.h
r5 r11 18 18 #include <esc_common/esc.h> 19 19 #include <string> 20 #include "esc_ros/monitor.h" 21 #include "esc_ros/esc_w_state.h" 20 #include <esc_ros/Monitors.h> 21 #include <esc_ros/StateValue.h> 22 22 23 class ESCROS{ 23 24 protected: … … 39 40 protected: 40 41 virtual void objValCallback(std_msgs::Float32 msg); 41 virtual void objValWithStateCallback(esc_ros:: esc_w_state msg);42 virtual void objValWithStateCallback(esc_ros::StateValue msg); 42 43 43 44 }; -
trunk/extremum_seeking/esc_ros/src/esc_ros.cpp
r5 r11 49 49 50 50 if(monitor_){ 51 pub_monitor_ = n_->advertise<esc_ros:: monitor>("monitor_out",1);51 pub_monitor_ = n_->advertise<esc_ros::Monitors>("monitor_out",1); 52 52 } 53 53 … … 57 57 } 58 58 59 void ESCROS::objValWithStateCallback(esc_ros:: esc_w_state msg)59 void ESCROS::objValWithStateCallback(esc_ros::StateValue msg) 60 60 { 61 obj_val_ = msg.obj_val; 62 state_vec_ = msg.states; 61 obj_val_ = msg.value; 62 state_vec_.resize(msg.state.size()); 63 for (size_t ii=0; ii < state_vec_.size(); ++ii) 64 state_vec_[ii] = msg.state[ii]; 63 65 if(!first_obj_val_received_) 64 66 first_obj_val_received_ = true; … … 97 99 98 100 if(monitor_){ 99 esc_ros::monitor msg_monitor; 100 msg_monitor.monitor_values = esc_->monitor(); 101 msg_monitor.monitor_names = esc_->monitorNames(); 101 esc_ros::Monitors msg_monitor; 102 std::vector<double> values = esc_->monitor(); 103 104 msg_monitor.values.resize(values.size()); 105 for (size_t ii=0; ii < values.size(); ++ii) 106 msg_monitor.values[ii] = values[ii]; 107 msg_monitor.names = esc_->monitorNames(); 102 108 pub_monitor_.publish(msg_monitor); 103 109 }
Note: See TracChangeset
for help on using the changeset viewer.