@@ -26,16 +26,13 @@ using namespace vrx;
26
26
27
27
// ///////////////////////////////////////////////
28
28
WaypointMarkers::WaypointMarkers (const std::string &_namespace)
29
- : ns(_namespace), material( " Gazebo/Red " ), scaling{0.2 , 0.2 , 1.5 }, height(4.0 )
29
+ : ns(_namespace), scaling{0.2 , 0.2 , 1.5 }, height(4.0 )
30
30
{
31
31
}
32
32
33
33
// ///////////////////////////////////////////////
34
34
void WaypointMarkers::Load (const std::shared_ptr<const sdf::Element> &_sdf)
35
35
{
36
- if (_sdf->HasElement (" material" ))
37
- this ->material = _sdf->Get <std::string>(" material" );
38
-
39
36
if (_sdf->HasElement (" scaling" ))
40
37
this ->scaling = _sdf->Get <math::Vector3d>(" scaling" );
41
38
@@ -47,22 +44,27 @@ void WaypointMarkers::Load(const std::shared_ptr<const sdf::Element> &_sdf)
47
44
}
48
45
49
46
// ///////////////////////////////////////////////
50
- bool WaypointMarkers::DrawMarker (double _x, double _y, double _yaw,
51
- const std::string &_text)
47
+ bool WaypointMarkers::DrawMarker (double _x, double _y, double _yaw)
52
48
{
53
- return this ->DrawMarker (this ->id ++, _x, _y, _yaw, _text );
49
+ return this ->DrawMarker (this ->id ++, _x, _y, _yaw);
54
50
}
55
51
56
52
// ///////////////////////////////////////////////
57
53
bool WaypointMarkers::DrawMarker (int _markerId, double _x, double _y,
58
- double _yaw, const std::string &_text )
54
+ double _yaw)
59
55
{
60
- // TODO: Fix below. The markers are not showing up.
61
56
msgs::Marker markerMsg;
62
57
markerMsg.set_ns (this ->ns );
63
58
markerMsg.set_action (msgs::Marker_Action_ADD_MODIFY);
64
- msgs::Material *matMsg = markerMsg.mutable_material ();
65
- matMsg->mutable_script ()->set_name (this ->material );
59
+ markerMsg.set_visibility (gz::msgs::Marker::GUI);
60
+ markerMsg.mutable_material ()->mutable_ambient ()->set_r (1 );
61
+ markerMsg.mutable_material ()->mutable_ambient ()->set_g (1 );
62
+ markerMsg.mutable_material ()->mutable_ambient ()->set_b (1 );
63
+ markerMsg.mutable_material ()->mutable_ambient ()->set_a (1 );
64
+ markerMsg.mutable_material ()->mutable_diffuse ()->set_r (1 );
65
+ markerMsg.mutable_material ()->mutable_diffuse ()->set_g (1 );
66
+ markerMsg.mutable_material ()->mutable_diffuse ()->set_b (1 );
67
+ markerMsg.mutable_material ()->mutable_diffuse ()->set_a (1 );
66
68
67
69
// draw cylinder
68
70
markerMsg.set_type (msgs::Marker_Type_CYLINDER);
@@ -79,25 +81,9 @@ bool WaypointMarkers::DrawMarker(int _markerId, double _x, double _y,
79
81
msgs::Set (markerMsg.mutable_scale (), this ->scaling );
80
82
msgs::Set (markerMsg.mutable_pose (), math::Pose3d (
81
83
_x + cos (_yaw), _y + sin (_yaw), this ->height + this ->scaling .Z () / 2.0 ,
82
- 0 , M_PI/ 2 , _yaw));
84
+ 0 , M_PI / 2 , _yaw));
83
85
markerMsg.set_id ((_markerId + 1 ) * 1000 );
84
86
result = node.Request (" /marker" , markerMsg);
85
- if (!result)
86
- return false ;
87
87
88
- // draw text
89
- // if (!_text.empty())
90
- // {
91
- // markerMsg.set_type(msgs::Marker_Type_TEXT);
92
- // markerMsg.set_text(_text);
93
- // msgs::Set(markerMsg.mutable_scale(),
94
- // math::Vector3d(1.0, 1.0, 1.0));
95
- // msgs::Set(markerMsg.mutable_pose(),
96
- // math::Pose3d(_x, _y - 0.2,
97
- // this->height + this->scaling.Z() + 0.8,
98
- // 0, 0, 0));
99
- // markerMsg.set_id((_markerId + 1) * 10000);
100
- // result = node.Request("/marker", markerMsg);
101
- // }
102
88
return result;
103
89
}
0 commit comments