westonrobot / ugv_sdk

C++ SDK for Mobile Robot Platforms
Apache License 2.0
58 stars 87 forks source link

stop io ctx on destruct #20

Closed lesomnus closed 2 years ago

lesomnus commented 2 years ago

This fix prevents invalid reference to AsyncCAN::io_context_. ProtocolDectctor::io_thread_ does not joined when ProtocolDectctor is destroyed, so that thread continues to access to this (which is pointer to destroyed ProtocolDectctor). This is very fatal to program execution.

I think StopService must be called in the AsyncCAN::~AsyncCAN() according to RAII pattern but since I do not have an knowledge of the codes that use this class, I implemented it here.

Also, there is a typo ProtocolDectctor -> ProtocolDetector.

lesomnus commented 2 years ago

Oh man, I think I misunderstood the repo. This PR was supposed to be for https://github.com/agilexrobotics/ugv_sdk.

rdu-weston commented 2 years ago

Oh man, I think I misunderstood the repo. This PR was supposed to be for https://github.com/agilexrobotics/ugv_sdk.

A better solution might be reminding the maintainer of agilexrobotics/ugv_sdk of synchronizing from upstream to get the fix. Anyway, I will check with them tomorrow.

lesomnus commented 2 years ago

Do I have to use westonrobot/ugv_sdk rather than agilexrobotics/ugv_sdk for new project? Since we bought your product via agilex so we thought we should use the agilexrobotics/ugv_sdk. They linked the SDK download button to https://github.com/agilexrobotics. It's confising. I'm sorry if the two companies are not related.

rdu-weston commented 2 years ago

Do I have to use westonrobot/ugv_sdk rather than agilexrobotics/ugv_sdk for new project? Since we bought your product via agilex so we thought we should use the agilexrobotics/ugv_sdk. They linked the SDK download button to https://github.com/agilexrobotics. It's confising. I'm sorry if the two companies are not related.

Both repositories should work for most robot types and the public interface is the same.

We (Weston Robot) have been having close collaboration with AgileX since very early days. At the time, AgileX put most of their resource on iterating hardware while we prepared and released the first version of the SDK. That's why you can see agilexrobotics/ugv_sdk is forked from our repo. At present, we still maintain this SDK since we're a regional distributor and service provider of AgileX robots (in Singapore and other ASEAN countries). For bugs like the one you pointed out, it's likely that we can provide a fix faster. But for newer robot models, it's likely that you can find support from the AgileX fork first. But we do sync between each other once a while since we may collect different user feedback from different regions.