Skip to content
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

Added support for retrieving present options and modules #46

Merged
merged 4 commits into from
Jun 14, 2019
Merged
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
31 changes: 30 additions & 1 deletion include/abb_librws/rws_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,16 @@ class RWSClient : public POCOClient
logout();
}

/**
* \brief A method for retrieving the configuration instances of a type, belonging to a specific configuration topic.
*
* \param topic specifying the configuration topic.
* \param type specifying the type in the configuration topic.
gavanderhoorn marked this conversation as resolved.
Show resolved Hide resolved
*
* \return RWSResult containing the result.
*/
RWSResult getConfigurationInstances(const std::string topic, const std::string type);

/**
* \brief A method for retrieving the value of an IO signal.
*
Expand Down Expand Up @@ -408,7 +418,16 @@ class RWSClient : public POCOClient
* \return RWSResult containing the result.
*/
RWSResult getRAPIDExecution();


/**
* \brief A method for retrieving information about the RAPID modules of a RAPID task.
*
* \param task specifying the RAPID task.
*
* \return RWSResult containing the result.
*/
RWSResult getRAPIDModulesInfo(const std::string task);
gavanderhoorn marked this conversation as resolved.
Show resolved Hide resolved

/**
* \brief A method for retrieving the RAPID tasks that are defined in the robot controller system.
*
Expand Down Expand Up @@ -656,6 +675,16 @@ class RWSClient : public POCOClient
*/
RWSResult evaluatePOCOResult(const POCOResult& poco_result, const EvaluationConditions& conditions);

/**
* \brief Method for generating a configuration URI path.
*
* \param topic for the configuration topic.
* \param type for the configuration type (belonging to the topic).
*
* \return std::string containing the path.
*/
std::string generateConfigurationPath(const std::string& topic, const std::string& type);
gavanderhoorn marked this conversation as resolved.
Show resolved Hide resolved

/**
* \brief Method for generating an IO signal URI path.
*
Expand Down
54 changes: 52 additions & 2 deletions include/abb_librws/rws_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,11 @@ struct SystemConstants
*/
struct XMLAttributes
{
/**
* \brief Class & cfg-ia-t-li.
gavanderhoorn marked this conversation as resolved.
Show resolved Hide resolved
*/
static const XMLAttribute CLASS_CFG_IA_T_LI;

/**
* \brief Class & controller execution state.
*/
Expand Down Expand Up @@ -393,11 +398,16 @@ struct SystemConstants
*/
static const XMLAttribute CLASS_OPMODE;

/**
* \brief Class & rap-module-info-li.
*/
static const XMLAttribute CLASS_RAP_MODULE_INFO_LI;

/**
* \brief Class & rap-task-li.
*/
static const XMLAttribute CLASS_RAP_TASK_LI;

/**
* \brief Class & RobotWare version name.
*/
Expand Down Expand Up @@ -434,11 +444,16 @@ struct SystemConstants
*/
static const std::string CLASS;

/**
* \brief Configuration list item.
*/
static const std::string CFG_IA_T_LI;

/**
* \brief Controller execution state.
*/
static const std::string CTRLEXECSTATE;

/**
* \brief Controller state.
*/
Expand Down Expand Up @@ -479,6 +494,16 @@ struct SystemConstants
*/
static const std::string OPMODE;

/**
* \brief Options present on the controller.
*/
static const std::string PRESENT_OPTIONS;

/**
* \brief RAPID module info list item.
*/
static const std::string RAP_MODULE_INFO_LI;

/**
* \brief RAPID task list item.
*/
Expand All @@ -493,6 +518,11 @@ struct SystemConstants
* \brief State.
*/
static const std::string STATE;

/**
* \brief Controller topic in the system configurations (abbreviated as sys).
*/
static const std::string SYS;

/**
* \brief Sys system list item.
Expand Down Expand Up @@ -554,13 +584,23 @@ struct SystemConstants
* \brief Stop action query.
*/
static const std::string ACTION_STOP;

/**
* \brief Task query.
*/
static const std::string TASK;
};

/**
* \brief RWS resources and queries.
*/
struct Resources
{
/**
* \brief Instances.
*/
static const std::string INSTANCES;

/**
* \brief Jointtarget.
*/
Expand All @@ -576,6 +616,11 @@ struct SystemConstants
*/
static const std::string ROBTARGET;

/**
* \brief Configurations.
*/
static const std::string RW_CFG;

/**
* \brief Signals.
*/
Expand Down Expand Up @@ -606,6 +651,11 @@ struct SystemConstants
*/
static const std::string RW_RAPID_EXECUTION;

/**
* \brief RAPID modules.
*/
static const std::string RW_RAPID_MODULES;

/**
* \brief RAPID symbol data.
*/
Expand Down
91 changes: 80 additions & 11 deletions include/abb_librws/rws_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,75 @@ class RWSInterface
*/
std::string system_name;
};

/**
* \brief A struct for containing information about the RAPID tasks defined in the robot controller.
* \brief A struct for containing information about a RobotWare option.
*/
struct RAPIDTask
struct RobotWareOptionInfo
{
/**
* \brief A constructor.
*
* \param name for the name of the option.
* \param description for the description of the option.
*/
RobotWareOptionInfo(std::string name, std::string description)
:
name(name),
gavanderhoorn marked this conversation as resolved.
Show resolved Hide resolved
description(description)
gavanderhoorn marked this conversation as resolved.
Show resolved Hide resolved
{}

/**
* \brief The option's name.
*/
std::string name;
gavanderhoorn marked this conversation as resolved.
Show resolved Hide resolved

/**
* \brief The options's description.
*/
std::string description;
gavanderhoorn marked this conversation as resolved.
Show resolved Hide resolved
};

/**
* \brief A struct for containing information about a RAPID module.
*/
struct RAPIDModuleInfo
{
/**
* \brief A constructor.
*
* \param name for the name of the module.
* \param type for the type of the module.
*/
RAPIDModuleInfo(std::string name, std::string type)
:
name(name),
gavanderhoorn marked this conversation as resolved.
Show resolved Hide resolved
type(type)
gavanderhoorn marked this conversation as resolved.
Show resolved Hide resolved
{}

/**
* \brief The module's name.
*/
std::string name;
gavanderhoorn marked this conversation as resolved.
Show resolved Hide resolved

/**
* \brief The module's type.
*/
std::string type;
gavanderhoorn marked this conversation as resolved.
Show resolved Hide resolved
};

/**
* \brief A struct for containing information about a RAPID task.
*/
struct RAPIDTaskInfo
{
/**
* \brief A constructor.
*
* \param name for the name of the task.
* \param is_motion_task indicating if the task is a motion task or not.
*/
RAPIDTask(std::string name, bool is_motion_task)
RAPIDTaskInfo(std::string name, bool is_motion_task)
:
name(name),
is_motion_task(is_motion_task)
Expand All @@ -101,7 +157,7 @@ class RWSInterface
/**
* \brief Information about the defined RAPID tasks.
*/
std::vector<RAPIDTask> rapid_tasks;
std::vector<RAPIDTaskInfo> rapid_tasks;

/**
* \brief System information.
Expand Down Expand Up @@ -204,17 +260,24 @@ class RWSInterface
/**
* \brief A method for collecting runtime information of the robot controller.
*
* \return RuntimeInfo container for the runtime information.
* \return RuntimeInfo containing the runtime information.
gavanderhoorn marked this conversation as resolved.
Show resolved Hide resolved
*/
RuntimeInfo collectRuntimeInfo();

/**
* \brief A method for collecting static information (at least during runtime) of the robot controller.
*
* \return StaticInfo container for the static information (at least during runtime).
* \return StaticInfo containing the static information (at least during runtime).
*/
StaticInfo collectStaticInfo();


/**
* \brief A method for retrieving the RobotWare options present on the active robot controller system.
*
* \return std::vector<OptionInfo> containing a list of the present RobotWare options.
gavanderhoorn marked this conversation as resolved.
Show resolved Hide resolved
*/
std::vector<RobotWareOptionInfo> getPresentRobotWareOptions();

/**
* \brief A method for retrieving the value if an IO signal.
*
Expand Down Expand Up @@ -271,13 +334,19 @@ class RWSInterface
bool getRAPIDSymbolData(const std::string task,
const RWSClient::RAPIDSymbolResource symbol,
RAPIDSymbolDataAbstract* p_data);
/**
* \brief A method for retrieving information about the RAPID modules of a RAPID task defined in the robot controller.
*
* \return std::vector<RAPIDModuleInfo> containing the RAPID modules information.
*/
std::vector<RAPIDModuleInfo> getRAPIDModulesInfo(const std::string task);

/**
* \brief A method for retrieving information about the RAPID tasks defined in the robot controller.
*
* \return std::vector<RAPIDTask> container for the RAPID tasks information.
* \return std::vector<RAPIDTaskInfo> containing the RAPID tasks information.
*/
std::vector<RAPIDTask> getRAPIDTasks();
std::vector<RAPIDTaskInfo> getRAPIDTasks();

/**
* \brief A method for retrieving some system information from the robot controller.
Expand Down Expand Up @@ -511,4 +580,4 @@ class RWSInterface
} // end namespace rws
} // end namespace abb

#endif
#endif
27 changes: 27 additions & 0 deletions src/rws_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ void RWSClient::SubscriptionResources::add(const std::string resource_uri, const
* Primary methods
*/

RWSClient::RWSResult RWSClient::getConfigurationInstances(const std::string topic, const std::string type)
{
uri_ = generateConfigurationPath(topic, type) + Resources::INSTANCES;

evaluation_conditions_.reset();
evaluation_conditions_.parse_message_into_xml = true;
evaluation_conditions_.accepted_outcomes.push_back(HTTPResponse::HTTP_OK);

return evaluatePOCOResult(httpGet(uri_), evaluation_conditions_);
}

RWSClient::RWSResult RWSClient::getIOSignal(const std::string iosignal)
{
uri_ = generateIOSignalPath(iosignal);
Expand Down Expand Up @@ -146,6 +157,17 @@ RWSClient::RWSResult RWSClient::getRAPIDExecution()
return evaluatePOCOResult(httpGet(uri_), evaluation_conditions_);
}

RWSClient::RWSResult RWSClient::getRAPIDModulesInfo(const std::string task)
{
uri_ = Resources::RW_RAPID_MODULES + "?" + Queries::TASK + task;

evaluation_conditions_.reset();
evaluation_conditions_.parse_message_into_xml = true;
evaluation_conditions_.accepted_outcomes.push_back(HTTPResponse::HTTP_OK);

return evaluatePOCOResult(httpGet(uri_), evaluation_conditions_);
}

RWSClient::RWSResult RWSClient::getRAPIDTasks()
{
uri_ = Resources::RW_RAPID_TASKS;
Expand Down Expand Up @@ -622,6 +644,11 @@ std::string RWSClient::getLogText(const bool verbose)
return ss.str();
}

std::string RWSClient::generateConfigurationPath(const std::string& topic, const std::string& type)
{
return Resources::RW_CFG + "/" + topic + "/" + type;
gavanderhoorn marked this conversation as resolved.
Show resolved Hide resolved
}

std::string RWSClient::generateIOSignalPath(const std::string& iosignal)
{
return Resources::RW_IOSYSTEM_SIGNALS + "/" + iosignal;
Expand Down
Loading