-
Notifications
You must be signed in to change notification settings - Fork 2
User/adambrett40/259 global waypoint cache #493
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
base: main
Are you sure you want to change the base?
Conversation
…Global-Waypoint-Cache
try running this command in the terminal before launching ros I'm not sure why this is not on the path anymore, but hopefully this works as a temporary fix! |
…Global-Waypoint-Cache
…Global-Waypoint-Cache
sailbot.code-workspace
Outdated
{ | ||
"label": "setup", | ||
"detail": "Set up the workspace", | ||
"type": "shell", | ||
"command": "./scripts/setup.sh", | ||
"problemMatcher": [] | ||
} | ||
|
||
], | ||
"inputs": [ | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you revert these small formatting changes? they dont seem to be related
if another lead request this be done please include it in another PR
return std::async(std::launch::async, [receivedDataBuffer] { | ||
try { | ||
std::filesystem::path cache{CACHE_PATH}; | ||
if (std::filesystem::exists(cache)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please look into creating the cache file in the constructor of LocalTransceiver
, and deleting the file in the destructor of LocalTransceiver
is it possible to clear the file and write it directly instead of creating another file and renaming it? please look into using std::ios::trunc
if possible
@@ -337,6 +369,18 @@ custom_interfaces::msg::Path LocalTransceiver::parseInMsg(const std::string & ms | |||
return soln; | |||
} | |||
|
|||
std::optional<custom_interfaces::msg::Path> LocalTransceiver::getCache() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please make this function async as well
@@ -91,6 +104,9 @@ class LocalTransceiverIntf : public NetNode | |||
sub_local_path_data = this->create_subscription<custom_interfaces::msg::LPathData>( | |||
ros_topics::LOCAL_PATH, ROS_Q_SIZE, | |||
std::bind(&LocalTransceiverIntf::sub_local_path_data_cb, this, std::placeholders::_1)); | |||
|
|||
std::thread cache_thread(&LocalTransceiverIntf::getAndPublishCache, this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since the get function is now async, we do not need to launch it in a thread
please take a look at the 2019 answer in https://stackoverflow.com/questions/5645375/how-do-i-make-a-function-asynchronous-in-c
@@ -302,6 +332,8 @@ custom_interfaces::msg::Path LocalTransceiver::receive() | |||
break; | |||
} | |||
|
|||
cacheGlobalWaypointsAsync(receivedDataBuffer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://stackoverflow.com/questions/5645375/how-do-i-make-a-function-asynchronous-in-c
try the 2019 answer in the link above and see if that works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comments
…Global-Waypoint-Cache
…Global-Waypoint-Cache
…Global-Waypoint-Cache
Description
Verification
To view what's published on the global_path topic, need to do
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/workspaces/sailbot_workspace/install/lib
in the terminal first as below (thanks Sean :))Resources