Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef XPP_VIS_RVIZ_ROBOT_BUILDER_H_
00031 #define XPP_VIS_RVIZ_ROBOT_BUILDER_H_
00032
00033 #include <string>
00034 #include <vector>
00035
00036 #include <visualization_msgs/MarkerArray.h>
00037
00038 #include <xpp_msgs/RobotParameters.h>
00039 #include <xpp_msgs/RobotStateCartesian.h>
00040 #include <xpp_msgs/TerrainInfo.h>
00041
00042 #include <xpp_states/state.h>
00043 #include <xpp_states/robot_state_cartesian.h>
00044
00045
00046 namespace xpp {
00047
00056 class RvizRobotBuilder {
00057 public:
00058 using Marker = visualization_msgs::Marker;
00059 using MarkerVec = std::vector<Marker>;
00060 using MarkerArray = visualization_msgs::MarkerArray;
00061
00062 using ContactState = EndeffectorsContact;
00063 using EEPos = EndeffectorsPos;
00064 using EEForces = Endeffectors<Vector3d>;
00065 using TerrainNormals = Endeffectors<Vector3d>;
00066 using RobotState = RobotStateCartesian;
00067
00068 public:
00072 RvizRobotBuilder();
00073 virtual ~RvizRobotBuilder () = default;
00074
00080 MarkerArray BuildRobotState(const xpp_msgs::RobotStateCartesian& msg) const;
00081
00090 void SetRobotParameters(const xpp_msgs::RobotParameters& msg);
00091
00100 void SetTerrainParameters(const xpp_msgs::TerrainInfo& msg);
00101
00102 private:
00103
00104
00105
00106
00107
00108 MarkerVec CreateEEPositions(const EEPos& pos_W,
00109 const ContactState& c) const;
00110 MarkerVec CreateEEForces(const EEForces& f_W,
00111 const EEPos& pos_W,
00112 const ContactState& c) const;
00113 MarkerVec CreateFrictionCones(const EEPos& pos_W,
00114 const ContactState& c) const;
00115 MarkerVec CreateSupportArea(const ContactState& c,
00116 const EEPos& pos_W) const;
00117 MarkerVec CreateRangeOfMotion(const State3d& base) const;
00118 Marker CreateGravityForce (const Vector3d& base_pos) const;
00119 Marker CreateBasePose(const Vector3d& pos,
00120 Eigen::Quaterniond ori,
00121 const ContactState& c) const;
00122 Marker CreateCopPos(const EEForces& f_W,
00123 const EEPos& pos_W) const;
00124 Marker CreatePendulum(const Vector3d& base_pos,
00125 const EEForces& f_W,
00126 const EEPos& pos_W) const;
00127 Marker CreateFrictionCone(const Vector3d& pos_W,
00128 const Vector3d& terrain_normal,
00129 double friction_coeff) const;
00130 Marker CreateForceArrow(const Vector3d& f,
00131 const Vector3d& pos) const;
00132 Marker CreateSphere(const Vector3d& pos,
00133 double diameter = 0.03) const;
00134 Marker CreateBox(const Vector3d& pos, Eigen::Quaterniond ori,
00135 const Vector3d& edge_length) const;
00136
00137 xpp_msgs::RobotParameters params_msg_;
00138 xpp_msgs::TerrainInfo terrain_msg_;
00139
00140 const std::string frame_id_ = "world";
00141
00147 void FillWithInvisible(int max_size, MarkerVec& vec) const;
00148 const static int max_ee_ = 10;
00149 };
00150
00151 }
00152
00153 #endif