-
Notifications
You must be signed in to change notification settings - Fork 81
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
private ControllerList in the controller manager #39
Comments
bump |
Seems reasonable... Just to clarify, currently there is this: HandlePtr ControllerManager::getHandle(const std::string& name)
{
// Try joints first
for (JointHandleList::iterator j = joints_.begin(); j != joints_.end(); j++)
{
if ((*j)->getName() == name)
return *j;
}
// Then controllers
for (ControllerList::iterator c = controllers_.begin(); c != controllers_.end(); c++)
{
if ((*c)->getController()->getName() == name)
return (*c)->getController();
}
// Not found
return HandlePtr();
}
JointHandlePtr ControllerManager::getJointHandle(const std::string& name)
{
// Try joints first
for (JointHandleList::iterator j = joints_.begin(); j != joints_.end(); j++)
{
if ((*j)->getName() == name)
return *j;
}
// Not found
return JointHandlePtr();
} And I think you want: ControllerPtr ControllerManager::getController(const std::string& name)
{
for (ControllerList::iterator c = controllers_.begin(); c != controllers_.end(); c++)
{
if ((*c)->getController()->getName() == name)
return (*c)->getController();
}
// Not found
return ControllerPtr();
} ? |
this is great, thank you for your response. Maybe while we are at it, we could also add a function that returns list of the controller names? For example:
or alternatively:
|
I think std::vector<std::string> ControllerManager::getControllerNames()
{
std::vector<std::string> controller_names;
for (ControllerList::iterator c = controllers_.begin(); c != controllers_.end(); c++)
{
controller_names.push_back((*c)->getController()->getName());
}
return controller_names;
} Fits better with the rest of the code. |
looks good to me! |
mikeferguson
added a commit
to mikeferguson/robot_controllers
that referenced
this issue
Jun 17, 2020
this was discussed in ZebraDevs#39
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi I was wondering what the reason was to have the ControllerList private in the ControllerManager class. I'm trying to work with this class, but keep wanting more info about controllers. Since I can't access the list, and since i can only get the pointers to the handles for the controllers, it's proving difficult to get the info i need. I can get the joint handles by name, wondering why i cant actualyl get the controllers (as controller classes) by name. Thanks.
The text was updated successfully, but these errors were encountered: