Skip to content

Commit

Permalink
Release candiadate (#2310)
Browse files Browse the repository at this point in the history
  • Loading branch information
bernatx authored and marcgpuig committed Dec 21, 2019
1 parent ab97355 commit b9fbbf7
Show file tree
Hide file tree
Showing 41 changed files with 944 additions and 1,344 deletions.
4 changes: 3 additions & 1 deletion LibCarla/source/carla/client/Vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ namespace client {
_is_control_sticky(GetControlIsSticky(GetAttributes())) {}

void Vehicle::SetAutopilot(bool enabled) {
TM &tm = TM::GetInstance(TM::GetUniqueLocalClient());
if (enabled) {
TM &tm = TM::GetInstance(TM::GetUniqueLocalClient());
tm.RegisterVehicles({shared_from_this()});
} else {
tm.UnregisterVehicles({shared_from_this()});
}
}

Expand Down
2 changes: 1 addition & 1 deletion LibCarla/source/carla/client/detail/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace detail {
: endpoint(host + ":" + std::to_string(port)),
rpc_client(host, port),
streaming_client(host) {
rpc_client.set_timeout(1000u);
rpc_client.set_timeout(5000u);
streaming_client.AsyncRun(
worker_threads > 0u ? worker_threads : std::thread::hardware_concurrency());
}
Expand Down
14 changes: 7 additions & 7 deletions LibCarla/source/carla/trafficmanager/BatchControlStage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ namespace traffic_manager {
messenger(messenger),
carla_client(carla_client) {

// Initializing messenger state.
messenger_state = messenger->GetState();
// Initializing number of vehicles to zero in the beginning.
number_of_vehicles = 0u;
}
Expand All @@ -28,7 +26,7 @@ namespace traffic_manager {
void BatchControlStage::Action() {

// Looping over registered actors.
for (uint64_t i = 0u; i < number_of_vehicles; ++i) {
for (uint64_t i = 0u; i < number_of_vehicles && data_frame != nullptr; ++i) {

cr::VehicleControl vehicle_control;

Expand All @@ -44,15 +42,13 @@ namespace traffic_manager {

void BatchControlStage::DataReceiver() {

auto packet = messenger->ReceiveData(messenger_state);
data_frame = packet.data;
messenger_state = packet.id;
data_frame = messenger->Peek();

// Allocating new containers for the changed number of registered vehicles.
if (data_frame != nullptr &&
number_of_vehicles != (*data_frame.get()).size()) {

number_of_vehicles = static_cast<uint>((*data_frame.get()).size());
number_of_vehicles = static_cast<uint64_t>((*data_frame.get()).size());
// Allocating array for command batching.
commands = std::make_shared<std::vector<cr::Command>>(number_of_vehicles);
}
Expand All @@ -61,12 +57,16 @@ namespace traffic_manager {

void BatchControlStage::DataSender() {

messenger->Pop();

if (commands != nullptr) {
carla_client.ApplyBatch(*commands.get());

}

// Limiting updates to 100 frames per second.
std::this_thread::sleep_for(10ms);

}

} // namespace traffic_manager
Expand Down
2 changes: 0 additions & 2 deletions LibCarla/source/carla/trafficmanager/BatchControlStage.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ namespace traffic_manager {

private:

/// Variable to remember messenger state.
int messenger_state;
/// Pointer to frame received from MotionPlanner.
std::shared_ptr<PlannerToControlFrame> data_frame;
/// Pointer to a messenger from MotionPlanner.
Expand Down
21 changes: 0 additions & 21 deletions LibCarla/source/carla/trafficmanager/CarlaDataAccessLayer.cpp

This file was deleted.

39 changes: 0 additions & 39 deletions LibCarla/source/carla/trafficmanager/CarlaDataAccessLayer.h

This file was deleted.

Loading

0 comments on commit b9fbbf7

Please sign in to comment.