Tetrapod Project
footstep_planner_node.cpp
Go to the documentation of this file.
2 
5 
6 #include "ros/ros.h"
7 #include "ros/console.h"
8 #include "geometry_msgs/PoseArray.h"
9 
10 bool footstep_planner_service(sensor_msgs::SetCameraInfoRequest &req, sensor_msgs::SetCameraInfoResponse &res){ return true;}
11 
12 int main(int argc, char **argv)
13 {
14  ros::init(argc, argv, "footstep_planner_server");
15 
16  ros::NodeHandle n;
17 
18  ros::Publisher footstep_pub = n.advertise<geometry_msgs::PoseArray>("/footstep_planner/footstep_plan", 1000);
19 
20  ros::Duration(1).sleep();
21 
22  Eigen::Array<bool, 4, 1> bool_bridge;
23 
24  bool_bridge << true, true, true, true;
25 
26  //Terrain terrain(bool_bridge);
27  Terrain terrain;
28 
29  int n_steps = 4*20;
30 
31  int n_legs = 4;
32 
34 
35  double step_span = 0.5;
36 
37  double step_height = 0.2;
38 
39  double length_legs = 0.6;
40 
41  double bbox_len = 0.3;
42 
43  ROS_INFO("About to begin planning");
44 
45  DecVars_res res = footstep_planner(terrain, n_steps, n_legs, length_legs, step_sequence, bbox_len, step_span, step_height);
46  double wp_dist = 2;
47  int n_points = 4;
48  //DecVars_res res = waypoint_planner(terrain, n_points, length_legs, bbox_len, wp_dist);
49  if (res.success)
50  {
51  ROS_INFO("Writing to file...");
52 
53  writeDecVarsToFile(res, "/home/melyso/Documents/csv_files/footstep_planner");
54 
55 
56  ROS_INFO("Successfully wrote to file!");
57 
58  geometry_msgs::PoseArray msg = pose_array_from_eigen_matr(res.position_ts);
59  ROS_INFO("Successfully got poseArray");
60  footstep_pub.publish(msg);
61  ROS_INFO("Successfully published");
62  }
63 
64  ros::spinOnce();
65 
66  return 0;
67 }
geometry_msgs::PoseArray pose_array_from_eigen_matr(Eigen::MatrixXd pos)
DecVars_res footstep_planner(Terrain &terrain, int n_steps, int n_legs, double length_legs, Leg step_sequence[], double bbox_len, double step_span, double step_height, bool use_gurobi=true)
bool footstep_planner_service(sensor_msgs::SetCameraInfoRequest &req, sensor_msgs::SetCameraInfoResponse &res)
int main(int argc, char **argv)
void step_sequence(drake::solvers::MathematicalProgram &prog, int n_steps, double step_span, DecVars &decision_variables)
Definition: miqp_biped.cpp:93
void writeDecVarsToFile(DecVars_res &decision_variables, std::string base_name="footstep_planner")
Definition: miqp_biped.cpp:263
int step_span
Definition: visualize.py:14