Skip to content

Commit

Permalink
Set per-point color on markers
Browse files Browse the repository at this point in the history
Signed-off-by: Louise Poubel <louise@openrobotics.org>
  • Loading branch information
chapulina committed Nov 25, 2021
1 parent 875b551 commit b7e3a24
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/plugins/marker_manager/MarkerManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ bool MarkerManagerPrivate::ProcessMarkerMsg(const ignition::msgs::Marker &_msg)
{
// Get the namespace, if it exists. Otherwise, use the global namespace
std::string ns;
if (!_msg.ns().empty()) {
if (!_msg.ns().empty())
{
ns = _msg.ns();
}

Expand Down Expand Up @@ -529,12 +530,6 @@ void MarkerManagerPrivate::SetMarker(const ignition::msgs::Marker &_msg,
_markerPtr->ClearPoints();
}

math::Color color(
_msg.material().diffuse().r(),
_msg.material().diffuse().g(),
_msg.material().diffuse().b(),
_msg.material().diffuse().a());

// Set Marker Points
for (int i = 0; i < _msg.point().size(); ++i)
{
Expand All @@ -543,6 +538,11 @@ void MarkerManagerPrivate::SetMarker(const ignition::msgs::Marker &_msg,
_msg.point(i).y(),
_msg.point(i).z());

math::Color color = msgs::Convert(_msg.material().diffuse());
if (i < _msg.materials().size())
{
color = msgs::Convert(_msg.materials(i).diffuse());
}
_markerPtr->AddPoint(vector, color);
}
if (_msg.has_scale())
Expand Down

0 comments on commit b7e3a24

Please sign in to comment.