Skip to content

Commit

Permalink
Add read_only_blockade adapter (#110)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael X. Grey <grey@openrobotics.org>
  • Loading branch information
mxgrey authored Sep 1, 2021
1 parent 0652903 commit dd150e0
Show file tree
Hide file tree
Showing 16 changed files with 1,046 additions and 40 deletions.
13 changes: 13 additions & 0 deletions rmf_fleet_adapter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,18 @@ target_link_libraries(read_only

# -----------------------------------------------------------------------------

add_executable(read_only_blockade
src/read_only_blockade/main.cpp
src/read_only_blockade/FleetAdapterNode.cpp
)

target_link_libraries(read_only_blockade
PRIVATE
rmf_fleet_adapter
)

# -----------------------------------------------------------------------------

add_executable(full_control src/full_control/main.cpp)

target_link_libraries(full_control
Expand Down Expand Up @@ -456,6 +468,7 @@ install(
TARGETS
rmf_fleet_adapter
read_only
read_only_blockade
mock_traffic_light
full_control
lift_supervisor
Expand Down
2 changes: 1 addition & 1 deletion rmf_fleet_adapter/launch/fleet_adapter.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<arg name="use_sim_time" default="false" description="Use the /clock topic for time to sync with simulation"/>

<arg name="control_type" description="Fleet adapter type: full_control or read_only"/>
<arg name="control_type" description="Fleet adapter type: full_control, read_only, or read_only_blockade"/>
<arg name="fleet_name" description="Name of the fleet that this adapter will interface with"/>
<!-- Note: We give a blank default to nav_graph_file because it is not required for read_only
mode. However it is still required for full_control mode.
Expand Down
17 changes: 10 additions & 7 deletions rmf_fleet_adapter/src/read_only/FleetAdapterNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ std::shared_ptr<FleetAdapterNode> FleetAdapterNode::make()
node->_negotiation = rmf_traffic_ros2::schedule::Negotiation(
*node, node->_mirror->snapshot_handle());

// Don't subscribe until everything else is ready
node->_fleet_state_subscription =
node->create_subscription<FleetState>(
FleetStateTopicName, rclcpp::SystemDefaultsQoS(),
[self = node.get()](FleetState::UniquePtr msg)
{
self->fleet_state_update(std::move(msg));
});

return node;
}
}
Expand Down Expand Up @@ -173,13 +182,7 @@ FleetAdapterNode::FleetAdapterNode()
_fleet_name(get_fleet_name_parameter(*this)),
_traits(get_traits_or_default(*this, 0.7, 0.3, 0.5, 1.5, 0.5, 1.5))
{
_fleet_state_subscription =
create_subscription<FleetState>(
FleetStateTopicName, rclcpp::SystemDefaultsQoS(),
[&](FleetState::UniquePtr msg)
{
this->fleet_state_update(std::move(msg));
});
// Do nothing. Everything else is initialized in make()
}

//==============================================================================
Expand Down
4 changes: 0 additions & 4 deletions rmf_fleet_adapter/src/read_only/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@

#include "FleetAdapterNode.hpp"

#include <rmf_traffic/geometry/Circle.hpp>

#include <rclcpp/executors.hpp>

#include "../rmf_fleet_adapter/ParseArgs.hpp"

using namespace rmf_fleet_adapter;

int main(int argc, char* argv[])
Expand Down
Loading

0 comments on commit dd150e0

Please sign in to comment.