Skip to content

Commit

Permalink
Added header to Color and Light ROS messages
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamLewww committed Nov 16, 2021
1 parent 128ba48 commit 45c5fd5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ros_ign_bridge/src/convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ convert_ros_to_ign(
const ros_ign_interfaces::msg::Color & ros_msg,
ignition::msgs::Color & ign_msg)
{
convert_ros_to_ign(ros_msg.header, (*ign_msg.mutable_header()));

ign_msg.set_r(ros_msg.r);
ign_msg.set_g(ros_msg.g);
ign_msg.set_b(ros_msg.b);
Expand All @@ -68,6 +70,8 @@ convert_ign_to_ros(
const ignition::msgs::Color & ign_msg,
ros_ign_interfaces::msg::Color & ros_msg)
{
convert_ign_to_ros(ign_msg.header(), ros_msg.header);

ros_msg.r = ign_msg.r();
ros_msg.g = ign_msg.g();
ros_msg.b = ign_msg.b();
Expand All @@ -80,6 +84,8 @@ convert_ros_to_ign(
const ros_ign_interfaces::msg::Light & ros_msg,
ignition::msgs::Light & ign_msg)
{
convert_ros_to_ign(ros_msg.header, (*ign_msg.mutable_header()));

ign_msg.set_name(ros_msg.name);
if (ros_msg.type == 0) {
ign_msg.set_type(ignition::msgs::Light_LightType::Light_LightType_POINT);
Expand Down Expand Up @@ -116,6 +122,8 @@ convert_ign_to_ros(
const ignition::msgs::Light & ign_msg,
ros_ign_interfaces::msg::Light & ros_msg)
{
convert_ign_to_ros(ign_msg.header(), ros_msg.header);

ros_msg.name = ign_msg.name();
if (ign_msg.type() ==
ignition::msgs::Light_LightType::Light_LightType_POINT) {
Expand Down
2 changes: 2 additions & 0 deletions ros_ign_interfaces/msg/Color.msg
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
std_msgs/Header header

float32 r # Red component
float32 g # Green component
float32 b # Blue component
Expand Down
2 changes: 2 additions & 0 deletions ros_ign_interfaces/msg/Light.msg
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
std_msgs/Header header

string name

# Light type: constant definition
Expand Down

0 comments on commit 45c5fd5

Please sign in to comment.