footstep_marker.h
Go to the documentation of this file.
1 // -*- mode: c++ -*-
2 /*********************************************************************
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2015, JSK Lab
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/o2r other materials provided
17  * with the distribution.
18  * * Neither the name of the JSK Lab nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *********************************************************************/
35 
36 #include <ros/ros.h>
38 
39 #include <jsk_recognition_msgs/PolygonArray.h>
40 #include <jsk_recognition_msgs/ModelCoefficientsArray.h>
41 #include <jsk_interactive_marker/FootstepMarkerConfig.h>
42 
44 #include <jsk_interactive_marker/SetPose.h>
45 #include <jsk_interactive_marker/MarkerSetPose.h>
47 
48 #include <geometry_msgs/PointStamped.h>
52 
53 #include <tf/transform_listener.h>
55 #include <jsk_footstep_msgs/PlanFootstepsAction.h>
56 #include <jsk_footstep_msgs/ExecFootstepsAction.h>
57 #include <geometry_msgs/Polygon.h>
58 #include <std_msgs/UInt8.h>
59 #include <std_msgs/Empty.h>
60 #include <std_srvs/Empty.h>
61 #include <jsk_recognition_msgs/SimpleOccupancyGridArray.h>
62 #include <dynamic_reconfigure/server.h>
63 
65 public:
66  typedef jsk_interactive_marker::FootstepMarkerConfig Config;
68  virtual ~FootstepMarker();
69  void updateInitialFootstep();
74  typedef jsk_footstep_msgs::PlanFootstepsResult PlanResult;
75 protected:
77  void processFeedbackCB(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback);
78  void menuFeedbackCB(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback);
79  void moveMarkerCB(const geometry_msgs::PoseStamped::ConstPtr& msg);
80  void menuCommandCB(const std_msgs::UInt8::ConstPtr& msg);
81  void executeCB(const std_msgs::Empty::ConstPtr& msg);
82  void resumeCB(const std_msgs::Empty::ConstPtr& msg);
84  const PlanResult::ConstPtr &result);
85  void processMenuFeedback(uint8_t id);
86  geometry_msgs::Polygon computePolygon(uint8_t leg);
87  void snapLegs();
88  geometry_msgs::Pose computeLegTransformation(uint8_t leg);
89  geometry_msgs::Pose getFootstepPose(bool leftp);
90  void changePlannerHeuristic(const std::string& heuristic);
91  void callEstimateOcclusion();
92  void cancelWalk();
93  void planIfPossible();
94  void resetLegPoses();
95  void lookGround();
96  void configCallback(Config& config, uint32_t level);
97  bool forceToReplan(std_srvs::Empty::Request& req, std_srvs::Empty::Request& res);
100  std::shared_ptr<dynamic_reconfigure::Server<Config> > srv_;
101  // projection to the planes
102  bool projectMarkerToPlane();
103 
104  jsk_recognition_msgs::SimpleOccupancyGridArray::ConstPtr latest_grids_;
105  // read a geometry_msgs/pose from the parameter specified.
106  // the format of the parameter is [x, y, z, xx, yy, zz, ww].
107  // where x, y and z means position and xx, yy, zz and ww means
108  // orientation.
109  void readPoseParam(ros::NodeHandle& pnh, const std::string param,
110  tf::Transform& offset);
111 
112  // execute footstep
113  // sending action goal to footstep controller
114  void executeFootstep();
115  void resumeFootstep();
116 
117  void projectionCallback(const geometry_msgs::PoseStamped& pose);
118 
119  visualization_msgs::Marker makeFootstepMarker(geometry_msgs::Pose pose);
120 
121  std::shared_ptr<interactive_markers::InteractiveMarkerServer> server_;
123  double foot_size_x_;
124  double foot_size_y_;
125  double foot_size_z_;
127  std::string marker_frame_id_;
128  geometry_msgs::PoseStamped marker_pose_;
141  std::shared_ptr<tf::TransformListener> tf_listener_;
149  bool plan_run_;
156  bool use_2d_;
158  geometry_msgs::Pose lleg_pose_;
159  geometry_msgs::Pose rleg_pose_;
160  geometry_msgs::Pose lleg_initial_pose_;
161  geometry_msgs::Pose rleg_initial_pose_;
164  std::string lfoot_frame_id_;
165  std::string rfoot_frame_id_;
166 
167  // footstep plannner result
168  PlanResult::ConstPtr plan_result_;
169 };
std::string rfoot_frame_id_
void processFeedbackCB(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback)
geometry_msgs::Pose lleg_initial_pose_
PlanningActionClient ac_
void initializeInteractiveMarker()
bool use_initial_footstep_tf_
ros::Publisher current_pose_pub_
void callEstimateOcclusion()
ros::Subscriber projection_sub_
std::string initial_reference_frame_
std::string marker_frame_id_
std::shared_ptr< interactive_markers::InteractiveMarkerServer > server_
tf::Transform lleg_offset_
ros::Subscriber resume_sub_
ros::Publisher footstep_pub_
void menuFeedbackCB(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback)
ros::ServiceServer plan_if_possible_srv_
geometry_msgs::Pose getFootstepPose(bool leftp)
interactive_markers::MenuHandler menu_handler_
actionlib::SimpleActionClient< jsk_footstep_msgs::ExecFootstepsAction > ExecuteActionClient
void projectionCallback(const geometry_msgs::PoseStamped &pose)
geometry_msgs::Pose lleg_pose_
visualization_msgs::Marker makeFootstepMarker(geometry_msgs::Pose pose)
std::shared_ptr< tf::TransformListener > tf_listener_
jsk_recognition_msgs::SimpleOccupancyGridArray::ConstPtr latest_grids_
void resumeCB(const std_msgs::Empty::ConstPtr &msg)
void moveMarkerCB(const geometry_msgs::PoseStamped::ConstPtr &msg)
boost::mutex plane_mutex_
boost::mutex plan_run_mutex_
ros::ServiceClient estimate_occlusion_client_
actionlib::SimpleActionClient< jsk_footstep_msgs::PlanFootstepsAction > PlanningActionClient
jsk_footstep_msgs::PlanFootstepsResult PlanResult
geometry_msgs::Pose rleg_pose_
ros::Subscriber move_marker_sub_
geometry_msgs::Pose computeLegTransformation(uint8_t leg)
void planDoneCB(const actionlib::SimpleClientGoalState &state, const PlanResult::ConstPtr &result)
ros::ServiceClient snapit_client_
ros::Publisher project_footprint_pub_
ros::Subscriber exec_sub_
void menuCommandCB(const std_msgs::UInt8::ConstPtr &msg)
std::string lfoot_frame_id_
PlanResult::ConstPtr plan_result_
tf::Transform rleg_offset_
ExecuteActionClient ac_exec_
void configCallback(Config &config, uint32_t level)
geometry_msgs::Pose rleg_initial_pose_
bool forceToReplan(std_srvs::Empty::Request &req, std_srvs::Empty::Request &res)
jsk_interactive_marker::FootstepMarkerConfig Config
void processMenuFeedback(uint8_t id)
ros::Subscriber menu_command_sub_
void changePlannerHeuristic(const std::string &heuristic)
geometry_msgs::Polygon computePolygon(uint8_t leg)
virtual ~FootstepMarker()
void executeCB(const std_msgs::Empty::ConstPtr &msg)
bool use_projection_service_
ros::Publisher snapped_pose_pub_
void updateInitialFootstep()
void readPoseParam(ros::NodeHandle &pnh, const std::string param, tf::Transform &offset)
boost::mutex mutex
bool use_footstep_controller_
std::shared_ptr< dynamic_reconfigure::Server< Config > > srv_
geometry_msgs::PoseStamped marker_pose_


jsk_interactive_marker
Author(s): furuta
autogenerated on Sat Mar 20 2021 03:03:33