mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-22 08:43:54 +08:00
common/params: support nonblocking write (#29808)
* Safe and efficient asynchronous writing parameters * call putNonBlocking in locationd * remove space * ->AsyncWriter * remove semicolon * use member function * asyc write multiple times * add test case for AsyncWriter * merge master * add missing include * public * cleanup * create once * cleanup * update that * explicit waiting * improve test case * pass prefix to asywriter * move to params * assert(queue.empty()) * add comment * add todo * test_power_monitoring: remove patch * rm laikad.py * fix import --------- Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> old-commit-hash: 3c4c4d1f7f22884f84f0f52ad45ab0412fab1eb5
This commit is contained in:
@@ -678,9 +678,10 @@ void Localizer::configure_gnss_source(const LocalizerGnssSource &source) {
|
||||
}
|
||||
|
||||
int Localizer::locationd_thread() {
|
||||
Params params;
|
||||
LocalizerGnssSource source;
|
||||
const char* gps_location_socket;
|
||||
if (Params().getBool("UbloxAvailable")) {
|
||||
if (params.getBool("UbloxAvailable")) {
|
||||
source = LocalizerGnssSource::UBLOX;
|
||||
gps_location_socket = "gpsLocationExternal";
|
||||
} else {
|
||||
@@ -737,10 +738,7 @@ int Localizer::locationd_thread() {
|
||||
VectorXd posGeo = this->get_position_geodetic();
|
||||
std::string lastGPSPosJSON = util::string_format(
|
||||
"{\"latitude\": %.15f, \"longitude\": %.15f, \"altitude\": %.15f}", posGeo(0), posGeo(1), posGeo(2));
|
||||
|
||||
std::thread([] (const std::string gpsjson) {
|
||||
Params().put("LastGPSPosition", gpsjson);
|
||||
}, lastGPSPosJSON).detach();
|
||||
params.putNonBlocking("LastGPSPosition", lastGPSPosJSON);
|
||||
}
|
||||
cnt++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user