22 : ns(_namespace), material(
"Gazebo/Red"), scaling{0.2, 0.2, 1.5}, height(4.0)
29 if (_sdf->HasElement(
"material"))
31 this->
material = _sdf->Get<std::string>(
"material");
34 if (_sdf->HasElement(
"scaling"))
36 this->
scaling = _sdf->Get<ignition::math::Vector3d>(
"scaling");
39 if (_sdf->HasElement(
"height"))
41 this->
height = _sdf->Get<
double>(
"height");
48 #if GAZEBO_MAJOR_VERSION >= 8 57 double _yaw, std::string _text)
59 #if GAZEBO_MAJOR_VERSION >= 8 60 ignition::msgs::Marker markerMsg;
61 markerMsg.set_ns(this->
ns);
62 markerMsg.set_action(ignition::msgs::Marker::ADD_MODIFY);
63 ignition::msgs::Material *matMsg = markerMsg.mutable_material();
64 matMsg->mutable_script()->set_name(this->
material);
67 markerMsg.set_type(ignition::msgs::Marker::CYLINDER);
68 ignition::msgs::Set(markerMsg.mutable_scale(),
70 ignition::msgs::Set(markerMsg.mutable_pose(),
71 ignition::math::Pose3d(_x, _y,
74 markerMsg.set_id(_marker_id);
75 bool result =
node.Request(
"/marker", markerMsg);
81 markerMsg.set_type(ignition::msgs::Marker::CYLINDER);
82 ignition::msgs::Set(markerMsg.mutable_scale(),
84 ignition::msgs::Set(markerMsg.mutable_pose(),
85 ignition::math::Pose3d(_x +
cos(_yaw), _y +
sin(_yaw),
88 markerMsg.set_id((_marker_id+1)*1000);
89 result =
node.Request(
"/marker", markerMsg);
97 markerMsg.set_type(ignition::msgs::Marker::TEXT);
98 markerMsg.set_text(_text);
99 ignition::msgs::Set(markerMsg.mutable_scale(),
100 ignition::math::Vector3d(1.0, 1.0, 1.0));
101 ignition::msgs::Set(markerMsg.mutable_pose(),
102 ignition::math::Pose3d(_x, _y - 0.2,
105 markerMsg.set_id((_marker_id + 1) * 10000);
106 result =
node.Request(
"/marker", markerMsg);
bool IsAvailable()
Returns if markers are available for current system.
std::string material
Name of Gazebo material for marker.
WaypointMarkers(std::string _namespace)
Constructor.
double height
Height of marker above water.
void Load(sdf::ElementPtr _sdf)
Load marker parameters from SDF.
std::string ns
Namespace for Gazebo markers.
bool DrawMarker(int _marker_id, double _x, double _y, double _yaw, std::string _text="")
Draw waypoint marker in Gazebo.
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
ignition::math::Vector3d scaling
Scaling factor for cylinder marker.