Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
7 changes: 4 additions & 3 deletions src/software/ai/hl/stp/play/play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Play::Play(TbotsProto::AiConfig ai_config, bool requires_goalie)
goalie_tactic(std::make_shared<GoalieTactic>(ai_config)),
halt_tactics(),
requires_goalie(requires_goalie),
tactic_sequence(boost::bind(&Play::getNextTacticsWrapper, this, _1)),
tactic_sequence(
std::bind(&Play::getNextTacticsWrapper, this, std::placeholders::_1)),
world_ptr_(std::nullopt),
obstacle_factory(ai_config.robot_navigation_obstacle_config())
{
Expand All @@ -42,7 +43,7 @@ PriorityTacticVector Play::getTactics(const WorldPtr &world_ptr)
{
// Make a new tactic_sequence
tactic_sequence = TacticCoroutine::pull_type(
boost::bind(&Play::getNextTacticsWrapper, this, _1));
std::bind(&Play::getNextTacticsWrapper, this, std::placeholders::_1));
// Run the coroutine. This will call the bound getNextTactics function
tactic_sequence();
}
Expand All @@ -61,7 +62,7 @@ PriorityTacticVector Play::getTactics(const WorldPtr &world_ptr)
{
// Make a new tactic_sequence
tactic_sequence = TacticCoroutine::pull_type(
boost::bind(&Play::getNextTacticsWrapper, this, _1));
std::bind(&Play::getNextTacticsWrapper, this, std::placeholders::_1));
// Run the coroutine. This will call the bound getNextTactics function
tactic_sequence();
if (tactic_sequence)
Expand Down
9 changes: 7 additions & 2 deletions src/software/embedded/services/network/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ NetworkService::NetworkService(const std::string& ip_address,
udp_listener_primitive_set =
std::make_unique<ThreadedProtoUdpListener<TbotsProto::PrimitiveSet>>(
ip_address, primitive_listener_port,
boost::bind(&NetworkService::primitiveSetCallback, this, _1), multicast);
[&](TbotsProto::PrimitiveSet primitive_set) {
primitiveSetCallback(primitive_set);
},
multicast);

radio_listener_primitive_set =
std::make_unique<ThreadedProtoRadioListener<TbotsProto::PrimitiveSet>>(
boost::bind(&NetworkService::primitiveSetCallback, this, _1));
[&](TbotsProto::PrimitiveSet primitive_set) {
primitiveSetCallback(primitive_set);
});
}

TbotsProto::PrimitiveSet NetworkService::poll(TbotsProto::RobotStatus& robot_status)
Expand Down
2 changes: 1 addition & 1 deletion src/software/embedded/services/power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ PowerService::PowerService()
throw std::runtime_error("USB not plugged into the Jetson Nano");
}
this->uart = std::make_unique<BoostUartCommunication>(BAUD_RATE, DEVICE_SERIAL_PORT);
this->read_thread = std::thread(boost::bind(&PowerService::continuousRead, this));
this->read_thread = std::thread(std::bind(&PowerService::continuousRead, this));
}

PowerService::~PowerService()
Expand Down
8 changes: 4 additions & 4 deletions src/software/estop/threaded_estop_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ ThreadedEstopReader::ThreadedEstopReader(std::unique_ptr<UartCommunication> uart
timer(io_service, boost::posix_time::milliseconds(INTERVAL_BETWEEN_READS_MS)),
uart_reader(std::move(uart_reader))
{
estop_thread = std::thread(boost::bind(&ThreadedEstopReader::continousRead, this));
estop_thread = std::thread(std::bind(&ThreadedEstopReader::continousRead, this));
}

void ThreadedEstopReader::continousRead()
{
timer.async_wait(
boost::bind(&ThreadedEstopReader::tick, this, boost::asio::placeholders::error));
std::bind(&ThreadedEstopReader::tick, this, boost::asio::placeholders::error));
io_service.run();
}

Expand Down Expand Up @@ -87,8 +87,8 @@ void ThreadedEstopReader::tick(const boost::system::error_code& error)
// Reschedule the timer for interval seconds in the future:
timer.expires_from_now(next_interval);
// Posts the timer event
timer.async_wait(boost::bind(&ThreadedEstopReader::tick, this,
boost::asio::placeholders::error));
timer.async_wait(std::bind(&ThreadedEstopReader::tick, this,
boost::asio::placeholders::error));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/software/multithreading/threaded_observer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ ThreadedObserver<T>::ThreadedObserver(size_t buffer_size, bool log_buffer_full)
in_destructor(false),
IN_DESTRUCTOR_CHECK_PERIOD(Duration::fromSeconds(0.1))
{
pull_from_buffer_thread = std::thread(
boost::bind(&ThreadedObserver::continuouslyPullValuesFromBuffer, this));
pull_from_buffer_thread =
std::thread(std::bind(&ThreadedObserver::continuouslyPullValuesFromBuffer, this));
}

template <typename T>
Expand Down
6 changes: 3 additions & 3 deletions src/software/networking/udp/proto_udp_listener.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ void ProtoUdpListener<ReceiveProtoT>::startListen()
// https://stackoverflow.com/questions/34680985/what-is-the-difference-between-asynchronous-programming-and-multithreading
socket_.async_receive_from(boost::asio::buffer(raw_received_data_, MAX_BUFFER_LENGTH),
sender_endpoint_,
boost::bind(&ProtoUdpListener::handleDataReception, this,
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred));
std::bind(&ProtoUdpListener::handleDataReception, this,
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred));
}

template <class ReceiveProtoT>
Expand Down
6 changes: 3 additions & 3 deletions src/software/networking/unix/proto_unix_listener.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ void ProtoUnixListener<ReceiveProtoT>::startListen()
// https://stackoverflow.com/questions/34680985/what-is-the-difference-between-asynchronous-programming-and-multithreading
socket_.async_receive_from(boost::asio::buffer(raw_received_data_, UNIX_BUFFER_SIZE),
listen_endpoint_,
boost::bind(&ProtoUnixListener::handleDataReception, this,
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred));
std::bind(&ProtoUnixListener::handleDataReception, this,
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred));
}

template <class ReceiveProtoT>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ NonTerminatingFunctionValidator::NonTerminatingFunctionValidator(
// otherwise the World inside the coroutine will not update properly when the
// pointer is updated, and the wrong validation_function may be run.
validation_sequence(
boost::bind(&NonTerminatingFunctionValidator::executeAndCheckForFailuresWrapper,
this, _1, world, validation_function)),
std::bind(&NonTerminatingFunctionValidator::executeAndCheckForFailuresWrapper,
this, std::placeholders::_1, world, validation_function)),
world_(world),
validation_function_(validation_function)
{
Expand All @@ -24,9 +24,9 @@ std::optional<std::string> NonTerminatingFunctionValidator::executeAndCheckForFa
if (!validation_sequence)
{
// Re-start the coroutine by re-creating it
validation_sequence = ValidationCoroutine::pull_type(boost::bind(
&NonTerminatingFunctionValidator::executeAndCheckForFailuresWrapper, this, _1,
world_, validation_function_));
validation_sequence = ValidationCoroutine::pull_type(
std::bind(&NonTerminatingFunctionValidator::executeAndCheckForFailuresWrapper,
this, std::placeholders::_1, world_, validation_function_));
}

// Run the coroutine. This will call the bound executeAndCheckForFailuresWrapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ TerminatingFunctionValidator::TerminatingFunctionValidator(
// otherwise the World inside the coroutine will not update properly when the
// pointer is updated, and the wrong validation_function may be run.
validation_sequence(
boost::bind(&TerminatingFunctionValidator::executeAndCheckForSuccessWrapper,
this, _1, world, validation_function)),
std::bind(&TerminatingFunctionValidator::executeAndCheckForSuccessWrapper, this,
std::placeholders::_1, world, validation_function)),
current_error_message("")
{
}
Expand Down