Skip to content

Add EnableObject #148

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 15 additions & 2 deletions include/mujincontrollerclient/binpickingtask.h
Original file line number Diff line number Diff line change
Expand Up @@ -556,14 +556,27 @@ class MUJINCLIENT_API BinPickingTaskResource : public TaskResource
/// \param robotname name of the robot to grab with
/// \param toolname name of the tool to grab with
/// \param timeout timeout of communication
virtual void Grab(const std::string& targetname, const std::string& robotname = "", const std::string& toolname = "", const double timeout = 1);
virtual void Grab(const std::string& targetname, const std::string& robotname = "", const std::string& toolname = "", const double timeout = 5);

/// \brief releases object
/// \param targetname name of the target to release
/// \param robotname name of the robot to release from
/// \param toolname name of the tool to release from
/// \param timeout timeout of communication
virtual void Release(const std::string& targetname, const std::string& robotname = "", const std::string& toolname = "", const double timeout = 1);
virtual void Release(const std::string& targetname, const std::string& robotname = "", const std::string& toolname = "", const double timeout = 5);

/// \brief manipulates enabled state of object
/// \param objectName name of the object to modify enabled state of.
/// \param state whether to enable (true) or disable (false) link
/// \param timeout timeout of communication
virtual void EnableObject(const std::string& objectName, bool state, const double timeout = 5);

/// \brief manipulates enabled state of link
/// \param objectName name of the object link belongs to
/// \param linkName name of the link to modify enabled state of.
/// \param state whether to enable (true) or disable (false) link.
/// \param timeout timeout of communication
virtual void EnableLink(const std::string& objectName, const std::string& linkName, bool state, const double timeout = 5);

/// \brief calls planning GetRobotBridgeIOVariableString and returns the contents of the signal in a string with correct endianness
virtual void GetRobotBridgeIOVariableString(const std::vector<std::string>& ionames, std::vector<std::string>& iovalues, const double timeout=10);
Expand Down
23 changes: 23 additions & 0 deletions src/binpickingtask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,29 @@ void BinPickingTaskResource::Release(const std::string& targetname, const std::s
ExecuteCommand(_ss.str(), d, timeout);
}

void BinPickingTaskResource::EnableObject(const std::string& objectName, bool state, const double timeout)
{
SetMapTaskParameters(_ss, _mapTaskParameters);
_ss << GetJsonString("command", "EnableObject");
_ss << ", " << GetJsonString("objectName", objectName);
_ss << ", " << GetJsonString("state", state);
_ss << "}";
rapidjson::Document d;
ExecuteCommand(_ss.str(), d, timeout);
}

void BinPickingTaskResource::EnableLink(const std::string& objectName, const std::string& linkName, bool state, const double timeout)
{
SetMapTaskParameters(_ss, _mapTaskParameters);
_ss << GetJsonString("command", "EnableLink");
_ss << ", " << GetJsonString("objectName", objectName);
_ss << ", " << GetJsonString("linkName", linkName);
_ss << ", " << GetJsonString("state", state);
_ss << "}";
rapidjson::Document d;
ExecuteCommand(_ss.str(), d, timeout);
}

void BinPickingTaskResource::GetRobotBridgeIOVariableString(const std::vector<std::string>& ionames, std::vector<std::string>& iovalues, const double timeout)
{
SetMapTaskParameters(_ss, _mapTaskParameters);
Expand Down