Skip to content

Commit

Permalink
Add Racing sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
ivazhuk committed Feb 23, 2024
1 parent 636988a commit 8049410
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 5 deletions.
22 changes: 22 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma de
Barcelona (UAB).

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,3 @@ if (!stream_in )
## Contact
Please feel free to provide feedback or ask questions by creating a Github issue. For inquiries about collaboration, please email us at sim@soda.auto.

## Copyright and License
Copyright © 2023 SODA.AUTO UK LTD. ALL RIGHTS RESERVED.
This software contains code licensed as described in [LICENSE](https://github.com/soda-auto/SodaSim/blob/master/LICENSE.md).
53 changes: 53 additions & 0 deletions include/soda/sim/proto-v1/racing.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#pragma once

#include <cstdint>

namespace soda
{
namespace sim
{
namespace proto_v1
{

#pragma pack(push, 1)

struct RacingSensor
{
// Valid only if border_is_valid [m]
float left_border_offset;

// Valid only if border_is_valid [m]
float right_border_offset;

// Valid only if border_is_valid [rad]
float center_line_yaw;

// Valid only if lap_counter_is_valid
std::int32_t lap_caunter;

// Valid only if lap_counter_is_valid [m]
float covered_distance_current_lap;

// [m]
float covered_distance_full;

bool border_is_valid;
bool lap_counter_is_valid;

// [ns]
std::int64_t timestemp;

// [ns]
std::int64_t start_timestemp;

// Valid only if lap_counter_is_valid [ns]
std::int64_t lap_timestemp;
};

static_assert(sizeof(float) == 4);

#pragma pack (pop)

} // namespace sim
} // namespace proto_v1
} // namespace soda
36 changes: 34 additions & 2 deletions include/soda/sim/proto-v1/vehicleState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,38 @@ enum class EControlMode : std::uint8_t

};

enum class ESteerReqMode: std::int8_t
{
ByRatio,
ByAngle
};

enum class EDriveEffortReqMode : std::int8_t
{
ByRatio,
ByAcc
};

#pragma pack(push, 1)

struct GenericVehicleControlMode1
{
float steer_req; // [rad]
float acc_decel_req; // [m/s^2]
union
{
float by_angle; // [rad]
float by_ratio; // [-1..1]
} steer_req;

/** Zero value means change speed as quickly as possible to TargetSpeed */
union
{
float by_acc; // [m/s^2]
float by_ratio; // [-1..1]
} drive_effort_req;

/** [cm/s]. Zero TargetSpeed means don't used */
float target_speed_req;

EGearState gear_state_req;

/**
Expand All @@ -49,6 +75,9 @@ struct GenericVehicleControlMode1
* - others - desire gear number;
*/
std::int8_t gear_num_req;

ESteerReqMode steer_req_mode;
EDriveEffortReqMode drive_effort_req_mode;
};

// State estimated by localization.
Expand All @@ -65,6 +94,9 @@ struct GenericVehicleState
EGearState gear_state;
std::int8_t gear_num;
EControlMode mode;

// [ns]
std::int64_t timestemp;
};

static_assert(sizeof(float) == 4);
Expand Down

0 comments on commit 8049410

Please sign in to comment.