28     ss << setprecision(1) << Number;
 
   42     cout << 
"--------------------------------------" << endl;
 
   46 void recordCOP(
const geometry_msgs::PointStamped& msg)
 
   50     string path = 
dir_path + 
"recorded_cop" + 
".csv";
 
   52     ofstream recorded_cop(path.c_str(), ios::app);
 
   54     if (recorded_cop.is_open())
 
   56         recorded_cop << msg.header.stamp.sec << 
"," << msg.point.x <<  
"," << msg.point.y << 
"," << msg.point.z << 
"\n";
 
   60         cout << 
"Unable to open file." << endl;      
 
   66     string path = 
dir_path + 
"recorded_cop_filtered" + 
".csv";
 
   68     ofstream recorded_cop_filtered(path.c_str(), ios::app);
 
   70     if (recorded_cop_filtered.is_open())
 
   72         recorded_cop_filtered << msg.header.stamp.sec << 
"," << msg.point.x <<  
"," << msg.point.y << 
"," << msg.point.z << 
"\n";
 
   73         recorded_cop_filtered.close();
 
   76         cout << 
"Unable to open file." << endl;      
 
   82     string path = 
dir_path + 
"recorded_phua" + 
".csv";
 
   84     ofstream recorded_phua(path.c_str(), ios::app);
 
   86     if (recorded_phua.is_open())
 
   88         recorded_phua << msg.header.stamp.sec << 
"," << msg.pose.position.x <<  
"," << msg.pose.position.y << 
"," << msg.pose.position.z - 0.075 << 
"\n";
 
   89         recorded_phua.close();
 
   92         cout << 
"Unable to open file." << endl;      
 
   98     string path = 
dir_path + 
"recorded_phua_theoretical" + 
".csv";
 
  100     ofstream recorded_phua_theoretical(path.c_str(), ios::app);
 
  102     if (recorded_phua_theoretical.is_open())
 
  104         recorded_phua_theoretical << msg.header.stamp.sec << 
"," << -msg.point.x <<  
"," << -msg.point.y << 
"," << -msg.point.z << 
"\n";
 
  105         recorded_phua_theoretical.close();
 
  108         cout << 
"Unable to open file." << endl;      
 
  114     string path = 
dir_path + 
"recorded_reaction" + 
".csv";
 
  116     ofstream recorded_reaction(path.c_str(), ios::app);
 
  118     if (recorded_reaction.is_open())
 
  120         recorded_reaction << msg.header.stamp.sec << 
"," << msg.vector.x <<  
"," << msg.vector.y << 
"," << msg.vector.z << 
"\n";
 
  121         recorded_reaction.close();
 
  124         cout << 
"Unable to open file." << endl;      
 
  130     string path = 
dir_path + 
"recorded_force_stab" + 
".csv";
 
  132     ofstream recorded_force_stab(path.c_str(), ios::app);
 
  134     if (recorded_force_stab.is_open())
 
  136         recorded_force_stab << msg.header.stamp.sec << 
"," << msg.vector.x <<  
"," << msg.vector.y << 
"," << msg.vector.z << 
"\n";
 
  137         recorded_force_stab.close();
 
  140         cout << 
"Unable to open file." << endl;      
 
  146     string path = 
dir_path + 
"recorded_force_instab" + 
".csv";
 
  148     ofstream recorded_force_instab(path.c_str(), ios::app);
 
  150     if (recorded_force_instab.is_open())
 
  152         recorded_force_instab << msg.header.stamp.sec << 
"," << msg.vector.x <<  
"," << msg.vector.y << 
"," << msg.vector.z << 
"\n";
 
  153         recorded_force_instab.close();
 
  156         cout << 
"Unable to open file." << endl;      
 
  162     string path = 
dir_path + 
"recorded_force" + 
".csv";
 
  164     ofstream recorded_force(path.c_str(), ios::app);
 
  166     if (recorded_force.is_open())
 
  168         recorded_force << msg.header.stamp.sec << 
"," << msg.vector.x <<  
"," << msg.vector.y << 
"," << msg.vector.z << 
"\n";
 
  169         recorded_force.close();
 
  172         cout << 
"Unable to open file." << endl;      
 
  178     string path = 
dir_path + 
"recorded_force_filtered" + 
".csv";
 
  180     ofstream recorded_force_filtered(path.c_str(), ios::app);
 
  182     if (recorded_force_filtered.is_open())
 
  184         recorded_force_filtered << msg.header.stamp.sec << 
"," << msg.vector.x <<  
"," << msg.vector.y << 
"," << msg.vector.z << 
"\n";
 
  185         recorded_force_filtered.close();
 
  188         cout << 
"Unable to open file." << endl;      
 
  194     string path_t = 
dir_path + 
"recorded_joints_torque" + 
".csv";
 
  195     string path_p = 
dir_path + 
"recorded_joints_position" + 
".csv";
 
  196     string path_v = 
dir_path + 
"recorded_joints_velocity" + 
".csv";
 
  198     ofstream recorded_joints_torque(path_t.c_str(), ios::app);
 
  199     ofstream recorded_joints_position(path_p.c_str(), ios::app);
 
  200     ofstream recorded_joints_velocity(path_v.c_str(), ios::app);
 
  202     if (recorded_joints_torque.is_open())
 
  204         recorded_joints_torque << msg.header.stamp.sec << 
"," << msg.effort[0] << 
"," << msg.effort[1] <<  
"," << msg.effort[2] << 
"," << msg.effort[3] << 
"," << msg.effort[4] <<  
"," << msg.effort[5] << 
"," << msg.effort[7] <<  
"," << msg.effort[8] << 
"," << msg.effort[9] << 
"," << msg.effort[10] <<  
"," << msg.effort[11] << 
"," << msg.effort[12] << 
"\n";
 
  205         recorded_joints_torque.close();
 
  208         cout << 
"Unable to open file." << endl; 
 
  211     if (recorded_joints_position.is_open())
 
  213         recorded_joints_position << msg.header.stamp.sec << 
"," << msg.position[0] << 
"," << msg.position[1] <<  
"," << msg.position[2] << 
"," << msg.position[3] << 
"," << msg.position[4] <<  
"," << msg.position[5] << 
"," << msg.position[7] <<  
"," << msg.position[8] << 
"," << msg.position[9] << 
"," << msg.position[10] <<  
"," << msg.position[11] << 
"," << msg.position[12] << 
"\n";
 
  214         recorded_joints_position.close();
 
  217         cout << 
"Unable to open file." << endl; 
 
  220     if (recorded_joints_velocity.is_open())
 
  222         recorded_joints_velocity << msg.header.stamp.sec << 
"," << msg.velocity[0] << 
"," << msg.velocity[1] <<  
"," << msg.velocity[2] << 
"," << msg.velocity[3] << 
"," << msg.velocity[4] <<  
"," << msg.velocity[5] << 
"," << msg.velocity[7] <<  
"," << msg.velocity[8] << 
"," << msg.velocity[9] << 
"," << msg.velocity[10] <<  
"," << msg.velocity[11] << 
"," << msg.velocity[12] << 
"\n";
 
  223         recorded_joints_velocity.close();
 
  226         cout << 
"Unable to open file." << endl; 
 
  231 void recordBOS(
const geometry_msgs::PolygonStamped& msg)
 
  233     string path = 
dir_path + 
"recorded_bos" + 
".csv";
 
  235     ofstream recorded_bos(path.c_str(), ios::app);
 
  237     if (recorded_bos.is_open())
 
  239         recorded_bos << msg.header.stamp.sec << 
",";
 
  241         for (uint i=0; i<msg.polygon.points.size()-1; i++)
 
  243           recorded_bos << msg.polygon.points[i].x << 
"," << msg.polygon.points[i].y << 
",";
 
  246         recorded_bos << msg.polygon.points[msg.polygon.points.size()-1].x << 
"," << msg.polygon.points[msg.polygon.points.size()-1].y << 
"\n";
 
  248         recorded_bos.close();
 
  251         cout << 
"Unable to open file." << endl;      
 
  257     string path = 
dir_path + 
"recorded_imu_data" + 
".csv";
 
  259     ofstream recorded_imu_data(path.c_str(), ios::app);
 
  261     if (recorded_imu_data.is_open())
 
  263         recorded_imu_data << msg.unitData[0].header.stamp.sec << 
",";
 
  265         for (uint i=0; i<msg.unitData.size()-1; i++)
 
  267           recorded_imu_data << msg.unitData[i].angular_velocity.x << 
"," << msg.unitData[i].angular_velocity.y << 
"," << msg.unitData[i].angular_velocity.z << 
"," << msg.unitData[i].linear_acceleration.x << 
"," << msg.unitData[i].linear_acceleration.y << 
"," << msg.unitData[i].linear_acceleration.z << 
",";
 
  270         recorded_imu_data << msg.unitData[msg.unitData.size()-1].angular_velocity.x << 
"," << msg.unitData[msg.unitData.size()-1].angular_velocity.y << 
"," << msg.unitData[msg.unitData.size()-1].angular_velocity.z << 
"," << msg.unitData[msg.unitData.size()-1].linear_acceleration.x << 
"," << msg.unitData[msg.unitData.size()-1].linear_acceleration.y << 
"," << msg.unitData[msg.unitData.size()-1].linear_acceleration.z << 
"\n";
 
  272         recorded_imu_data.close();
 
  275         cout << 
"Unable to open file." << endl;  
 
  281     string path = 
dir_path + 
"recorded_platform_left" + 
".csv";
 
  283     ofstream recorded_platform_left(path.c_str(), ios::app);
 
  285     if (recorded_platform_left.is_open())
 
  287         recorded_platform_left << msg.header.stamp.sec << 
"," << msg.pose.position.x << 
"," << msg.pose.position.y << 
"," << msg.pose.position.z << 
"," << msg.pose.orientation.x << 
"," << msg.pose.orientation.y << 
"," << msg.pose.orientation.z << 
"," << msg.pose.orientation.w << 
"\n";
 
  288         recorded_platform_left.close();
 
  291         cout << 
"Unable to open file." << endl;      
 
  297     string path = 
dir_path + 
"recorded_platform_right" + 
".csv";
 
  299     ofstream recorded_platform_right(path.c_str(), ios::app);
 
  301     if (recorded_platform_right.is_open())
 
  303         recorded_platform_right << msg.header.stamp.sec << 
"," << msg.pose.position.x << 
"," << msg.pose.position.y << 
"," << msg.pose.position.z << 
"," << msg.pose.orientation.x << 
"," << msg.pose.orientation.y << 
"," << msg.pose.orientation.z << 
"," << msg.pose.orientation.w << 
"\n";
 
  304         recorded_platform_right.close();
 
  307         cout << 
"Unable to open file." << endl;      
 
  311 int main(
int argc, 
char **argv)
 
  316     struct tm * timeinfo;
 
  317     timeinfo = localtime (&rawtime);
 
  321     strftime(date_time, 
sizeof(date_time), 
"%Y%m%d_%H%M%S", timeinfo);
 
  323     ros::init(argc, argv, 
"record_data");
 
  326     if (!ros::param::get(
"plane", 
plane))
 
  327         ROS_ERROR(
"Failed to read symbols on parameter server");
 
  328     else if (!ros::param::get(
"amplitude", 
amplitude))
 
  329         ROS_ERROR(
"Failed to read symbols on parameter server");
 
  330     else if (!ros::param::get(
"frequency", 
frequency))
 
  331         ROS_ERROR(
"Failed to read symbols on parameter server");
 
  332     else if (!ros::param::get(
"user", 
user))
 
  333         ROS_ERROR(
"Failed to read symbols on parameter server");
 
  335     string dir_location (
"/home/phua3-lar/Experiments/Results_");
 
  337     mkdir(
dir_path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
 
  340     ros::Subscriber phua_position_sub = nh.subscribe(
"/phua_position", 1000, 
recordPHUA);
 
  341     ros::Subscriber joints_state_sub = nh.subscribe(
"/phua_joints_state", 1000, 
recordState);
 
  342     ros::Subscriber cop_global_position_sub = nh.subscribe(
"/cop_global_position", 1000, 
recordCOP);
 
  343     ros::Subscriber support_base_position_sub = nh.subscribe(
"/support_base_position", 1000, 
recordBOS);
 
  345     ros::Subscriber phua_theoretical_position_sub = nh.subscribe(
"/command_pelvis_position_stamped", 1000, 
recordPHUA_theoretical);
 
  346     ros::Subscriber feedback_force_stability_sub = nh.subscribe(
"/feedback_force_stability", 1000, 
recordForce_stab);
 
  347     ros::Subscriber feedback_force_instability_sub = nh.subscribe(
"/feedback_force_instability", 1000, 
recordForce_instab);
 
  348     ros::Subscriber feedback_force_sub = nh.subscribe(
"/feedback_force", 1000, 
recordForce);
 
  350     ros::Subscriber reaction_force_sub = nh.subscribe(
"/reaction_force", 1000, 
recordReaction);
 
  351     ros::Subscriber imu_network_data_sub = nh.subscribe(
"/imu_network_data", 1000, 
recordIMU);
 
  352     ros::Subscriber left_platform_sub = nh.subscribe(
"/vrep/command_left_platform", 1000, 
recordPlatform_left);
 
  353     ros::Subscriber right_platform_sub = nh.subscribe(
"/vrep/command_right_platform", 1000, 
recordPlatform_right);
 
ros::Subscriber simulation_state_sub
 
void recordBOS(const geometry_msgs::PolygonStamped &msg)
 
void recordCOP(const geometry_msgs::PointStamped &msg)
 
void recordIMU(const vrep_common::ImuData &msg)
 
void simulationState(const vrep_common::VrepInfo &msg)
 
void recordReaction(const geometry_msgs::Vector3Stamped &msg)
 
void recordForce(const geometry_msgs::Vector3Stamped &msg)
 
void recordState(const sensor_msgs::JointState &msg)
 
ros::Subscriber feedback_force_filtered_sub
 
string NumberToString(T Number)
 
void recordPHUA_theoretical(const geometry_msgs::PointStamped &msg)
 
void recordPHUA(const geometry_msgs::PoseStamped &msg)
 
int main(int argc, char **argv)
 
void recordForce_stab(const geometry_msgs::Vector3Stamped &msg)
 
void recordPlatform_left(const geometry_msgs::PoseStamped &msg)
 
void recordForce_instab(const geometry_msgs::Vector3Stamped &msg)
 
void recordCOP_filtered(const geometry_msgs::PointStamped &msg)
 
void recordForce_filtered(const geometry_msgs::Vector3Stamped &msg)
 
void recordPlatform_right(const geometry_msgs::PoseStamped &msg)