Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds new RFComms system #1428

Merged
merged 71 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
fd7a39a
Initial layout
caguero Mar 2, 2022
fbc954d
Testing broker
caguero Mar 9, 2022
135ceef
Working version.
caguero Mar 13, 2022
80678b3
Layout updates.
caguero Mar 14, 2022
971efab
move comms files to comms dir and update namespace
iche033 Mar 15, 2022
4fe15bf
add unit tests
iche033 Mar 15, 2022
68628d8
add integration test
iche033 Mar 15, 2022
ca49142
refactor CommsModel class
iche033 Mar 15, 2022
b38f470
Updates.
caguero Mar 26, 2022
d3c7395
More updates.
caguero Mar 27, 2022
9baf15e
Updates.
caguero Mar 27, 2022
9d2e2e3
Tweak tests
caguero Mar 28, 2022
72922d3
Merge branch 'ign-gazebo6' into comms
caguero Mar 28, 2022
5363fca
Style.
caguero Mar 28, 2022
714e136
Merge branch 'ign-gazebo6' into comms
caguero Mar 28, 2022
5e7d4a8
switch to unordered_map
arjo129 Mar 30, 2022
aa7081e
Merge branch 'comms' of github.com:ignitionrobotics/ign-gazebo into c…
arjo129 Mar 30, 2022
beefb6b
Step size and doxygen.
caguero Mar 30, 2022
bfd3c7e
Merge branch 'ign-gazebo6' into comms
caguero Mar 30, 2022
07f7f39
Merge branch 'ign-gazebo6' into comms
caguero Mar 31, 2022
c531b25
Style.
caguero Apr 2, 2022
c73d1b4
Data structures, SDF parsing and pose updates.
caguero Apr 2, 2022
6b84404
Working version.
caguero Apr 3, 2022
f6fde6b
Tweak
caguero Apr 3, 2022
0398cee
rand_r
caguero Apr 5, 2022
6ac5f9d
Rename
caguero Apr 5, 2022
744ec07
Merge branch 'comms' into caguero/wireless_comms
caguero Apr 5, 2022
06123e8
Update step
caguero Apr 5, 2022
327eb47
Updates.
caguero Apr 5, 2022
2eb30e9
Merge branch 'comms' into caguero/wireless_comms
caguero Apr 5, 2022
9e626e7
Missing include
caguero Apr 5, 2022
5d0521a
Merge branch 'comms' into caguero/wireless_comms
caguero Apr 5, 2022
2099ec7
Add test
caguero Apr 5, 2022
1ff2b39
Example world.
caguero Apr 5, 2022
5d3111c
Merge branch 'ign-gazebo6' into comms
caguero Apr 6, 2022
5472d97
Tweaks
caguero Apr 7, 2022
c41706e
Merge branch 'comms' into caguero/wireless_comms
caguero Apr 7, 2022
991b690
Tweaks
caguero Apr 7, 2022
0162d74
fix sending empty msgs by changing AttemptSend to use msg->ByteSizeLo…
iche033 Apr 8, 2022
1140b56
Tweaks
caguero Apr 11, 2022
c56d177
Add ICommsModel.cc
caguero Apr 11, 2022
f4a03e2
Merge branch 'comms' into caguero/wireless_comms
caguero Apr 11, 2022
e39c85d
Use DblUniform()
caguero Apr 11, 2022
9789e66
Experimental message.
caguero Apr 11, 2022
de15145
Use ByteSize().
caguero Apr 11, 2022
eb6350a
Merge branch 'ign-gazebo6' into comms
caguero Apr 11, 2022
cfb0b99
Explicit
caguero Apr 11, 2022
b7022e5
Merge branch 'comms' of github.com:ignitionrobotics/ign-gazebo into c…
caguero Apr 11, 2022
96e062b
Merge branch 'comms' into caguero/wireless_comms
caguero Apr 11, 2022
2fc863d
Explicit
caguero Apr 11, 2022
4be8dbe
Windows
caguero Apr 11, 2022
fdf7245
Win
caguero Apr 12, 2022
c8d3bd8
Test
caguero Apr 12, 2022
fdae1ab
Win
caguero Apr 12, 2022
886a811
Merge branch 'ign-gazebo6' into comms
caguero Apr 12, 2022
8636c29
Win
caguero Apr 12, 2022
3d4ea64
Include
caguero Apr 13, 2022
098bc96
Merge branch 'ign-gazebo6' into comms
caguero Apr 13, 2022
d6aa6ef
Windows
caguero Apr 13, 2022
9bd38a1
Visibility
caguero Apr 13, 2022
e9ac2de
Windows
caguero Apr 13, 2022
553f3a0
Merge branch 'comms' into caguero/wireless_comms
caguero Apr 13, 2022
13c788f
Win
caguero Apr 13, 2022
088a68c
Visibility
caguero Apr 13, 2022
0bb43e5
Merge branch 'comms' into caguero/wireless_comms
caguero Apr 13, 2022
67a54f2
Warning
caguero Apr 13, 2022
b3d5ce6
Merge branch 'comms' into caguero/wireless_comms
caguero Apr 13, 2022
1803d74
Tweak
caguero Apr 13, 2022
784a655
merge from ign-gazebo6
iche033 Apr 13, 2022
59c0215
fix warnings on homebrew
iche033 Apr 13, 2022
8757e98
add ifdef for ByteSizeLong
iche033 Apr 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions examples/standalone/comms/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)

project(ign-gazebo-comms)

find_package(ignition-transport11 QUIET REQUIRED)
set(IGN_TRANSPORT_VER ${ignition-transport11_VERSION_MAJOR})

add_executable(publisher publisher.cc)
target_link_libraries(publisher
ignition-transport${IGN_TRANSPORT_VER}::core)
106 changes: 106 additions & 0 deletions examples/standalone/comms/publisher.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
* Copyright (C) 2022 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

// Example: ./publisher addr1

#include <atomic>
#include <chrono>
#include <csignal>
#include <iostream>
#include <string>
#include <thread>

#include <ignition/msgs.hh>
#include <ignition/transport.hh>

/// \brief Flag used to break the publisher loop and terminate the program.
static std::atomic<bool> g_terminatePub(false);

//////////////////////////////////////////////////
/// \brief Usage function.
void usage()
{
std::cerr << "./publisher <dst_address>" << std::endl;
}

//////////////////////////////////////////////////
/// \brief Function callback executed when a SIGINT or SIGTERM signals are
/// captured. This is used to break the infinite loop that publishes messages
/// and exit the program smoothly.
void signal_handler(int _signal)
{
if (_signal == SIGINT || _signal == SIGTERM)
g_terminatePub = true;
}

//////////////////////////////////////////////////
int main(int argc, char **argv)
{
if (argc != 2)
{
usage();
return -1;
}

// Install a signal handler for SIGINT and SIGTERM.
std::signal(SIGINT, signal_handler);
std::signal(SIGTERM, signal_handler);

// Create a transport node and advertise a topic.
ignition::transport::Node node;
std::string topic = "/broker/msgs";

auto pub = node.Advertise<ignition::msgs::Dataframe>(topic);
if (!pub)
{
std::cerr << "Error advertising topic [" << topic << "]" << std::endl;
return -1;
}

std::this_thread::sleep_for(std::chrono::milliseconds(100));

// Prepare the message.
ignition::msgs::Dataframe msg;
msg.set_src_address("addr1");
msg.set_dst_address(argv[1]);

// Publish messages at 1Hz.
int counter = 0;
while (!g_terminatePub)
{
// Prepare the payload.
ignition::msgs::StringMsg payload;
payload.set_data("hello world " + std::to_string(counter));
std::string serializedData;
if (!payload.SerializeToString(&serializedData))
{
std::cerr << "Error serializing message\n"
<< payload.DebugString() << std::endl;
}
msg.set_data(serializedData);

if (!pub.Publish(msg))
break;

++counter;

std::cout << "Publishing hello on topic [" << topic << "]" << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
}

return 0;
}
177 changes: 177 additions & 0 deletions examples/worlds/perfect_comms.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
<?xml version="1.0" ?>
<!--
Ignition Gazebo perfect-comms plugin demo.

Compile the comms publisher:
cd ign-gazebo/examples/standalone/comms
mkdir build
cd build
cmake ..
make

Try launching a comms subscriber:
ign topic -e -t addr2/rx

Try launching a comms publisher:
./publisher addr2
-->
<sdf version="1.6">
<world name="perfect_comms">

<physics name="1ms" type="ignored">
<max_step_size>0.001</max_step_size>
<real_time_factor>1.0</real_time_factor>
</physics>
<plugin
filename="ignition-gazebo-physics-system"
name="ignition::gazebo::systems::Physics">
</plugin>
<plugin
filename="ignition-gazebo-user-commands-system"
name="ignition::gazebo::systems::UserCommands">
</plugin>
<plugin
filename="ignition-gazebo-scene-broadcaster-system"
name="ignition::gazebo::systems::SceneBroadcaster">
</plugin>
<plugin
filename="ignition-gazebo-perfect-comms-system"
name="ignition::gazebo::systems::PerfectComms">
</plugin>

<light type="directional" name="sun">
<cast_shadows>true</cast_shadows>
<pose>0 0 10 0 0 0</pose>
<diffuse>1 1 1 1</diffuse>
<specular>0.5 0.5 0.5 1</specular>
<attenuation>
<range>1000</range>
<constant>0.9</constant>
<linear>0.01</linear>
<quadratic>0.001</quadratic>
</attenuation>
<direction>-0.5 0.1 -0.9</direction>
</light>

<model name="ground_plane">
<static>true</static>
<link name="link">
<collision name="collision">
<geometry>
<plane>
<normal>0 0 1</normal>
<size>100 100</size>
</plane>
</geometry>
</collision>
<visual name="visual">
<geometry>
<plane>
<normal>0 0 1</normal>
<size>100 100</size>
</plane>
</geometry>
<material>
<ambient>0.8 0.8 0.8 1</ambient>
<diffuse>0.8 0.8 0.8 1</diffuse>
<specular>0.8 0.8 0.8 1</specular>
</material>
</visual>
</link>
</model>

<model name="box1">
<pose>2 0 0.5 0 0 0</pose>
<link name="box_link">
<inertial>
<inertia>
<ixx>0.16666</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>0.16666</iyy>
<iyz>0</iyz>
<izz>0.16666</izz>
</inertia>
<mass>1.0</mass>
</inertial>
<collision name="box_collision">
<geometry>
<box>
<size>1 1 1</size>
</box>
</geometry>
</collision>

<visual name="box_visual">
<geometry>
<box>
<size>1 1 1</size>
</box>
</geometry>
<material>
<ambient>1 0 0 1</ambient>
<diffuse>1 0 0 1</diffuse>
<specular>1 0 0 1</specular>
</material>
</visual>
</link>

<plugin
filename="ignition-gazebo-comms-endpoint-system"
name="ignition::gazebo::systems::CommsEndpoint">
<address>addr1</address>
<topic>addr1/rx</topic>
</plugin>
</model>

<model name="box2">
<pose>-2 0 0.5 0 0 0</pose>
<link name="box_link">
<inertial>
<inertia>
<ixx>0.16666</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>0.16666</iyy>
<iyz>0</iyz>
<izz>0.16666</izz>
</inertia>
<mass>1.0</mass>
</inertial>
<collision name="box_collision">
<geometry>
<box>
<size>1 1 1</size>
</box>
</geometry>
</collision>

<visual name="box_visual">
<geometry>
<box>
<size>1 1 1</size>
</box>
</geometry>
<material>
<ambient>0 0 1 1</ambient>
<diffuse>0 0 1 1</diffuse>
<specular>0 0 1 1</specular>
</material>
</visual>
</link>

<plugin
filename="ignition-gazebo-comms-endpoint-system"
name="ignition::gazebo::systems::CommsEndpoint">
<address>addr2</address>
<topic>addr2/rx</topic>
<broker>
<bind_service>/broker/bind</bind_service>
<unbind_service>/broker/unbind</unbind_service>
</broker>
</plugin>

</model>

</world>
</sdf>
Loading