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

feat(accel_brake_map_calibrator): replace polling takeData function with the callback function #7282

Closed
Closed
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
2ac6e68
get steer msg by take instead of callback
N-Eiki Jun 5, 2024
e004617
use take function for get actuation_status
N-Eiki Jun 5, 2024
cc08670
use take function for get actuation cmd from subscriber
N-Eiki Jun 5, 2024
4461684
delete comment out \n add debug values of steer
N-Eiki Jun 5, 2024
0ea237d
use take function for get velocity from subscriber
N-Eiki Jun 5, 2024
899cfa0
clean code : delete temporary comment out. add comments what code exp…
N-Eiki Jun 5, 2024
493caa2
style(pre-commit): autofix
pre-commit-ci[bot] Jun 5, 2024
fedba85
undo copyright change.\n move to new autoware msg from old autoware_a…
N-Eiki Jun 6, 2024
46d34ae
undo copyright year.\n delete if nest for CodeScene Cloud Delta Analy…
N-Eiki Jun 6, 2024
fae4cfd
style(pre-commit): autofix
pre-commit-ci[bot] Jun 6, 2024
e832a83
add fetchData to decrease timerCallback func's cyclomatic complexity\…
N-Eiki Jun 6, 2024
f029367
solve conflict
N-Eiki Jun 6, 2024
62946c6
style(pre-commit): autofix
pre-commit-ci[bot] Jun 6, 2024
beb026d
fortmat by clang and camelCase function name to snake_case
N-Eiki Jun 6, 2024
671ef8a
solve conflict
N-Eiki Jun 6, 2024
6069593
fix: treat CI warning eg: add static_cast, to snake_case, delete redu…
N-Eiki Jun 6, 2024
49b65a5
style(pre-commit): autofix
pre-commit-ci[bot] Jun 6, 2024
ad843d6
Merge branch 'autowarefoundation:main' into feat/use_takeData_in_abc_…
N-Eiki Jun 6, 2024
865c2a4
Merge branch 'main' into feat/use_takeData_in_abc_module
N-Eiki Jun 6, 2024
3cd3286
Merge branch 'main' into feat/use_takeData_in_abc_module
N-Eiki Jun 6, 2024
2022fc9
refactor(autoware_velocity_walkway_module): prefix package with autow…
esteve Jun 6, 2024
a749eda
ci(openai-pr-reviewer): remove the action (#7332)
xmfcx Jun 6, 2024
4c434d0
ci(pr-agent): update configuration (#7334)
xmfcx Jun 6, 2024
ce1a86a
ci(build-and-test): run on self hosted (#7336)
xmfcx Jun 6, 2024
321e1c7
chore(steer_offset_estimator): add prefix autoware_ to steer_offset_e…
go-sakayori Jun 7, 2024
e800d54
refactor(pose2twist): apply static analysis (#7307)
a-maumau Jun 7, 2024
28cb715
fix : use not used variable
N-Eiki Jun 7, 2024
118e4bb
feat(pointcloud_preprocessor): add z filter in vector map inside (#7…
YoshiRi Jun 7, 2024
f1f7fcb
style(pre-commit): autofix
pre-commit-ci[bot] Jun 7, 2024
b24507f
fix(map_based_prediction): fix generatePathForOnLaneVehicle (#7238)
kosuke55 Jun 7, 2024
675edab
Remove unused statement causing build error
N-Eiki Jun 7, 2024
cb225d7
Merge branch 'feat/use_takeData_in_abc_module' of github.com:N-Eiki/a…
N-Eiki Jun 7, 2024
64f82a8
style(pre-commit): autofix
pre-commit-ci[bot] Jun 7, 2024
cac7eb3
refactor(surround_obstacle_checker)!: prefix package and namespace wi…
satoshi-ota Jun 7, 2024
17aad93
refactor(behavior_path_side_shift_module)!: prefix package and namesp…
kyoichi-sugahara Jun 7, 2024
cc9512b
fix(yabloc): suppress no viable conversion error (#7299)
KYabuuchi Jun 7, 2024
d54e1ff
feat(obstacle_curise): revert lateral stop margin for unknown objects…
yuki-takagi-66 Jun 7, 2024
9202dab
chore(mrm_comfortable_stop_operator): remove unused main file (#7191)
isamu-takagi Jun 7, 2024
c672f86
refactor(sampling_based_planner): add autoware prefix (#7348)
maxime-clem Jun 7, 2024
e24f48d
chore: update CODEOWNERS (#7165)
awf-autoware-bot[bot] Jun 7, 2024
e752cad
refactor(behavior velocity intersection)!: prefix package and namespa…
soblin Jun 7, 2024
9cb51d0
feat(emergency_handler, mrm_handler): change to read topic by polling…
Autumn60 Jun 7, 2024
c85b83d
fix(pose2twist): compute angular velocity through quaternion (#7322)
KYabuuchi Jun 7, 2024
722e822
chore(smart_mpc): add maitainers (#7346)
kosuke55 Jun 7, 2024
9c961a9
refactor(behavior_path_start_planner_module)!: prefix package and nam…
danielsanchezaran Jun 7, 2024
ce0fcf5
refactor(mpc_lateral_controller, trajectory_follower_node)!: prefix p…
HansOersted Jun 7, 2024
a3955e9
fix(static_obstacle_avoidance): return shift validation (#7229)
satoshi-ota Jun 7, 2024
6013a78
refactor(sampling_planner_module): use std::make_shared (#7226)
maxime-clem Jun 7, 2024
6669213
refactor(behavior_velocity_planner_common)!: prefix package and names…
rej55 Jun 7, 2024
7d6c2fd
refactor(planning_validator)!: prefix package and namespace with auto…
kyoichi-sugahara Jun 7, 2024
2b7c0db
feat(pose_instability_detector): change validation algorithm (#7042)
TaikiYamada4 Jun 7, 2024
4aeb69f
ci(clang-tidy-differential): split it out of build-and-test-different…
xmfcx Jun 7, 2024
e6b56a4
feat(imu_corrector): componentize ImuCorrector and GyroBiasEstimator …
a-maumau Jun 7, 2024
1f6c264
refactor(path_optimizer, velocity_smoother)!: prefix package and name…
satoshi-ota Jun 7, 2024
fbe57b1
refactor(costmap_generator)!: add autoware prefix (#7329)
kosuke55 Jun 7, 2024
2b0de17
refactor(gyro_odometer): apply static analysis (#7360)
a-maumau Jun 7, 2024
565589c
feat(obstacle_cruise)!: type specified stop deccel limit and enabling…
yuki-takagi-66 Jun 7, 2024
4577719
fix(perception_online_evaluator): add metric_value not only stat (#7…
kosuke55 Jun 7, 2024
2f6cd2b
chore(lane_departure_checker): add maintainer (#7366)
zulfaqar-azmi-t4 Jun 7, 2024
f03323f
refactor(lane_departure_checker)!: prefix package and namespace with …
kyoichi-sugahara Jun 7, 2024
dfa31a6
fix(mrm_handler): fix stop judgement (#7362)
Autumn60 Jun 7, 2024
ed038d8
chore(smart_mpc_trajectory_follower): add prefix autoware_ to smart_m…
go-sakayori Jun 7, 2024
b1749af
feat(autonomous_emergency_braking): prefix package and namespace with…
danielsanchezaran Jun 7, 2024
f93e5b3
refactor(rtc_interface)!: prefix package and namespace with autoware …
rej55 Jun 7, 2024
d891ef7
feat(lidar_transfusion): add lidar_transfusion 3D detection package (…
amadeuszsz Jun 7, 2024
f328a15
fix(autoware_planning_validator): revert node name change (#7371)
kyoichi-sugahara Jun 7, 2024
57786a7
refactor(behavior_path_avoidance_by_lane_change_module)!: prefix pack…
esteve Jun 7, 2024
7d12dcf
fix(tier4_planning_launch): unexpected modules were registered (#7377)
takayuki5168 Jun 8, 2024
3b036b1
feat(autoware_velocity_smoother): use polling subscriber (#7216)
takayuki5168 Jun 8, 2024
14c75e6
feat(joy_controller): use polling subscriber (#7286)
takayuki5168 Jun 8, 2024
af9db8c
refactor(joy_controller)!: prefix package and namespace with autoware…
takayuki5168 Jun 8, 2024
a6ef8bb
feat(tier4_autoware_utils): suppress too many warning of TF transform…
takayuki5168 Jun 8, 2024
a082e64
refactor(pid_longitudinal_controller)!: prefix package and namespace …
takayuki5168 Jun 8, 2024
240c976
refactor(path_smoother)!: prefix package and namespace with autoware …
takayuki5168 Jun 8, 2024
ac483b9
refactor(out_of_lane): remove from behavior_velocity (#7359)
maxime-clem Jun 9, 2024
09f7676
fix(multi_object_tracker): fix segmentation fault bug of the debug ob…
technolojin Jun 10, 2024
a8b7620
delete blank sentence
N-Eiki Jun 10, 2024
a137560
chore(vehicle_cmd_gate): add prefix autoware_ to vehicle_cmd_gate (#7…
go-sakayori Jun 10, 2024
2235e20
feat(autoware_lane_departure_checker): use polling subscriber (#7358)
kyoichi-sugahara Jun 10, 2024
af9194e
chore(control): add maintainer for several control modules (#7389)
zulfaqar-azmi-t4 Jun 10, 2024
b9c66fc
fix : handle to review, eliminate redundant cast
N-Eiki Jun 10, 2024
3eccd71
fix: undo miss delete
N-Eiki Jun 11, 2024
ff3ef6a
Merge branch 'feat/use_takeData_in_abc_module' of github.com:N-Eiki/a…
N-Eiki Jun 11, 2024
54de65a
Merge branch 'N-Eiki-feat/use_takeData_in_abc_module'
N-Eiki Jun 11, 2024
1a7288a
solve conflict
N-Eiki Jun 11, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "rclcpp/rclcpp.hpp"
#include "tf2/utils.h"
#include "tier4_autoware_utils/ros/logger_level_configure.hpp"
#include "tier4_autoware_utils/ros/polling_subscriber.hpp"
#include "tier4_autoware_utils/ros/transform_listener.hpp"

#include <Eigen/Dense>
Expand Down Expand Up @@ -55,7 +56,6 @@

namespace accel_brake_map_calibrator
{

using autoware_vehicle_msgs::msg::SteeringReport;
using autoware_vehicle_msgs::msg::VelocityReport;
using geometry_msgs::msg::TwistStamped;
Expand Down Expand Up @@ -107,18 +107,22 @@ class AccelBrakeMapCalibrator : public rclcpp::Node
rclcpp::Publisher<Float32Stamped>::SharedPtr map_error_ratio_pub_;
rclcpp::Publisher<CalibrationStatus>::SharedPtr calibration_status_pub_;

rclcpp::Subscription<VelocityReport>::SharedPtr velocity_sub_;
rclcpp::Subscription<SteeringReport>::SharedPtr steer_sub_;
rclcpp::Subscription<ActuationStatusStamped>::SharedPtr actuation_status_sub_;
rclcpp::Subscription<ActuationCommandStamped>::SharedPtr actuation_cmd_sub_;
tier4_autoware_utils::InterProcessPollingSubscriber<SteeringReport> steer_sub_{
this, "~/input/steer"};
tier4_autoware_utils::InterProcessPollingSubscriber<ActuationStatusStamped> actuation_status_sub_{
this, "~/input/actuation_status"};
tier4_autoware_utils::InterProcessPollingSubscriber<ActuationCommandStamped> actuation_cmd_sub_{
this, "~/input/actuation_cmd"};
tier4_autoware_utils::InterProcessPollingSubscriber<VelocityReport> velocity_sub_{
this, "~/input/velocity"};

// Service
rclcpp::Service<UpdateAccelBrakeMap>::SharedPtr update_map_dir_server_;

rclcpp::TimerBase::SharedPtr timer_;
rclcpp::TimerBase::SharedPtr timer_output_csv_;
void initTimer(double period_s);
void initOutputCSVTimer(double period_s);
void init_timer(double period_s);
void init_output_csv_timer(double period_s);

TwistStamped::ConstSharedPtr twist_ptr_;
std::vector<std::shared_ptr<TwistStamped>> twist_vec_;
Expand Down Expand Up @@ -230,78 +234,79 @@ class AccelBrakeMapCalibrator : public rclcpp::Node
// output log
std::ofstream output_log_;

bool getCurrentPitchFromTF(double * pitch);
void timerCallback();
void timerCallbackOutputCSV();
void executeUpdate(
bool get_current_pitch_from_tf(double * pitch);
void timer_callback();
void timer_callback_output_csv();
void execute_update(
const bool accel_mode, const int accel_pedal_index, const int accel_vel_index,
const int brake_pedal_index, const int brake_vel_index);
bool updateFourCellAroundOffset(
bool update_four_cell_around_offset(
const bool accel_mode, const int accel_pedal_index, const int accel_vel_index,
const int brake_pedal_index, const int brake_vel_index, const double measured_acc);
bool updateEachValOffset(
bool update_each_val_offset(
const bool accel_mode, const int accel_pedal_index, const int accel_vel_index,
const int brake_pedal_index, const int brake_vel_index, const double measured_acc,
const double map_acc);
void updateTotalMapOffset(const double measured_acc, const double map_acc);
void callbackActuation(
const std_msgs::msg::Header header, const double accel, const double brake);
void callbackActuationCommand(const ActuationCommandStamped::ConstSharedPtr msg);
void callbackActuationStatus(const ActuationStatusStamped::ConstSharedPtr msg);
void callbackVelocity(const VelocityReport::ConstSharedPtr msg);
void callbackSteer(const SteeringReport::ConstSharedPtr msg);
bool callbackUpdateMapService(
void update_total_map_offset(const double measured_acc, const double map_acc);

void take_actuation(const std_msgs::msg::Header & header, const double accel, const double brake);
void take_actuation_command(const ActuationCommandStamped::ConstSharedPtr msg);
void take_actuation_status(const ActuationStatusStamped::ConstSharedPtr msg);
void take_velocity(const VelocityReport::ConstSharedPtr msg);
bool fetch_data();

bool callback_update_map_service(
const std::shared_ptr<rmw_request_id_t> request_header,
UpdateAccelBrakeMap::Request::SharedPtr req, UpdateAccelBrakeMap::Response::SharedPtr res);
bool getAccFromMap(const double velocity, const double pedal);
double lowpass(const double original, const double current, const double gain = 0.8);
double getPedalSpeed(
bool get_acc_from_map(const double velocity, const double pedal);
static double lowpass(const double original, const double current, const double gain = 0.8);
static double get_pedal_speed(
const DataStampedPtr & prev_pedal, const DataStampedPtr & current_pedal,
const double prev_pedal_speed);
double getAccel(
double get_accel(
const TwistStamped::ConstSharedPtr & prev_twist,
const TwistStamped::ConstSharedPtr & current_twist);
double getJerk();
bool indexValueSearch(
const std::vector<double> value_index, const double value, const double value_thresh,
int * searched_index);
int nearestValueSearch(const std::vector<double> value_index, const double value);
int nearestPedalSearch();
int nearestVelSearch();
void takeConsistencyOfAccelMap();
void takeConsistencyOfBrakeMap();
bool updateAccelBrakeMap();
void publishFloat32(const std::string publish_type, const double val);
void publishUpdateSuggestFlag();
double getPitchCompensatedAcceleration();
void executeEvaluation();
double calculateEstimatedAcc(
const TwistStamped::ConstSharedPtr & current_twist) const;
double get_jerk();
bool index_value_search(
const std::vector<double> & value_index, const double value, const double value_thresh,
int * searched_index) const;
static int nearest_value_search(const std::vector<double> & value_index, const double value);
int nearest_pedal_search();
int nearest_vel_search();
void take_consistency_of_accel_map();
void take_consistency_of_brake_map();
bool update_accel_brake_map();
void publish_float32(const std::string & publish_type, const double val);
void publish_update_suggest_flag();
double get_pitch_compensated_acceleration() const;
void execute_evaluation();
static double calculate_estimated_acc(
const double throttle, const double brake, const double vel, AccelMap & accel_map,
BrakeMap & brake_map);
double calculateAccelSquaredError(
double calculate_accel_squared_error(
const double throttle, const double brake, const double vel, AccelMap & accel_map,
BrakeMap & brake_map);
double calculateAccelErrorL1Norm(
double calculate_accel_error_l1_norm(
const double throttle, const double brake, const double vel, AccelMap & accel_map,
BrakeMap & brake_map);
std::vector<double> getMapColumnFromUnifiedIndex(
static std::vector<double> get_map_column_from_unified_index(
const Map & accel_map_value, const Map & brake_map_value, const std::size_t index);
double getPedalValueFromUnifiedIndex(const std::size_t index);
int getUnifiedIndexFromAccelBrakeIndex(const bool accel_map, const std::size_t index);
void pushDataToQue(
double get_pedal_value_from_unified_index(const std::size_t index);
int get_unified_index_from_accel_brake_index(const bool accel_map, const std::size_t index);
static void push_data_to_que(
const TwistStamped::ConstSharedPtr & data, const std::size_t max_size,
std::queue<TwistStamped::ConstSharedPtr> * que);
template <class T>
void pushDataToVec(const T data, const std::size_t max_size, std::vector<T> * vec);
void push_data_to_vec(const T data, const std::size_t max_size, std::vector<T> * vec);
template <class T>
T getNearestTimeDataFromVec(
static T get_nearest_time_data_from_vec(
const T base_data, const double back_time, const std::vector<T> & vec);
DataStampedPtr getNearestTimeDataFromVec(
DataStampedPtr get_nearest_time_data_from_vec(
DataStampedPtr base_data, const double back_time, const std::vector<DataStampedPtr> & vec);
double getAverage(const std::vector<double> & vec);
double getStandardDeviation(const std::vector<double> & vec);
bool isTimeout(const builtin_interfaces::msg::Time & stamp, const double timeout_sec);
bool isTimeout(const DataStampedPtr & data_stamped, const double timeout_sec);
static double get_average(const std::vector<double> & vec);
double get_standard_deviation(const std::vector<double> & vec);
bool is_timeout(const builtin_interfaces::msg::Time & stamp, const double timeout_sec);
bool is_timeout(const DataStampedPtr & data_stamped, const double timeout_sec);

/* for covariance calculation */
// mean value on each cell (counting method depends on the update algorithm)
Expand All @@ -314,24 +319,24 @@ class AccelBrakeMapCalibrator : public rclcpp::Node
Eigen::MatrixXd accel_data_num_;
Eigen::MatrixXd brake_data_num_;

OccupancyGrid getOccMsg(
const std::string frame_id, const double height, const double width, const double resolution,
OccupancyGrid get_occ_msg(
const std::string & frame_id, const double height, const double width, const double resolution,
const std::vector<int8_t> & map_value);

/* Diag*/
void checkUpdateSuggest(diagnostic_updater::DiagnosticStatusWrapper & stat);
void check_update_suggest(diagnostic_updater::DiagnosticStatusWrapper & stat);

/* Debug */
void publishMap(
const Map accel_map_value, const Map brake_map_value, const std::string publish_type);
void publishOffsetCovMap(const Map accel_map_value, const Map brake_map_value);
void publishCountMap();
void publishIndex();
bool writeMapToCSV(
void publish_map(
const Map & accel_map_value, const Map & brake_map_value, const std::string & publish_type);
void publish_offset_cov_map(const Map accel_map_value, const Map brake_map_value);
void publish_count_map();
void publish_index();
bool write_map_to_csv(
std::vector<double> vel_index, std::vector<double> pedal_index, Map value_map,
std::string filename);
void addIndexToCSV(std::ofstream * csv_file);
void addLogToCSV(
static void add_index_to_csv(std::ofstream * csv_file);
static void add_log_to_csv(
std::ofstream * csv_file, const double & timestamp, const double velocity, const double accel,
const double pitched_accel, const double accel_pedal, const double brake_pedal,
const double accel_pedal_speed, const double brake_pedal_speed, const double pitch,
Expand Down
1 change: 1 addition & 0 deletions vehicle/accel_brake_map_calibrator/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<maintainer email="[email protected]">Tomoya Kimura</maintainer>
<maintainer email="[email protected]">Taiki Tanaka</maintainer>
<maintainer email="[email protected]">Takeshi Miura</maintainer>
<maintainer email="[email protected]">Eiki Nagata</maintainer>

<license>Apache License 2.0</license>

Expand Down
Loading
Loading