29 static const double timeout = 0.000001;
50 if (!ros::isInitialized())
57 "gazebo_footstep_planner",
58 ros::init_options::NoSigintHandler
61 this->
rosNode.reset(
new ros::NodeHandle(
"gazebo_footstep_planner"));
69 this->
gazeboNode.reset(
new gazebo::transport::Node());
78 indicators = Eigen::Matrix<msgs::Visual, Eigen::Dynamic, 1>();
79 ROS_INFO(
"created new indicator matrix.");
80 indicators.conservativeResize(poses.rows(), Eigen::NoChange);
81 ROS_INFO(
"resized new indicator matrix");
85 std::string parent_name =
"default";
89 msgs::Visual *indicator;
91 msgs::Geometry *geometry;
101 ignition::math::Color
c;
103 ignition::math::Color spec(0.1, 0.1, 0.1);
105 for (
int i = 0; i < n_steps; ++i)
107 ROS_INFO(
"start of loop");
108 c.Set(colors(0, i), colors(1, i), colors(2, i));
110 pose = poses.row(i).transpose();
114 name =
"footstep " + std::to_string(i);
115 ROS_INFO(
"about to set name");
116 indicator->set_name(name);
117 ROS_INFO(
"set name completed");
118 indicator->set_visible(
true);
120 indicator->set_parent_name(parent_name);
122 indicator->set_cast_shadows(
false);
124 geometry = indicator->mutable_geometry();
126 geometry->set_type(msgs::Geometry::CYLINDER);
128 geometry->mutable_cylinder()->set_radius(0.02);
130 geometry->mutable_cylinder()->set_length(0.01);
132 msgs::Set(indicator->mutable_pose(), ignition::math::Pose3d(pose(0), pose(1), pose(2), 0, 0, 0));
133 std::cout << pose(0) <<
" " << pose(1) <<
" " << pose(2) << std::endl;
134 msgs::Set(indicator->mutable_material()->mutable_ambient(),
c);
136 msgs::Set(indicator->mutable_material()->mutable_diffuse(),
c);
138 msgs::Set(indicator->mutable_material()->mutable_ambient(), spec);
140 msgs::Set(indicator->mutable_material()->mutable_emissive(),
c);
142 indicator->set_is_static(
true);
143 ROS_INFO(
"end of loop");
151 msgs::Visual *indicator;
153 for (
int i = 0; i < n_steps; ++i)
165 msgs::Visual *indicator;
167 for(
int i = 0; i < n_steps; ++i)
171 indicator->set_delete_me(
true);
179 ROS_INFO(
"Footstep_planner_plugin: Received updated footstep plan");
Eigen::Matrix3Xd interpolateColors(Eigen::Vector3d begin_rgb, Eigen::Vector3d end_rgb, int nsteps)
Eigen::MatrixX3d eigen_matr_from_pose_array(geometry_msgs::PoseArray pose_array)