Skip to content
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
1 change: 1 addition & 0 deletions iCubGenova11/icub_all_no_legs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@

<!-- FINE CALIBRATOR CHECKER DEMO and TEST -->
<xi:include href="wrappers/motorControl/left_arm-mc-rawval-nws_wrapper.xml" />
<xi:include href="wrappers/motorControl/left_arm-mc-rawval-nws_remapper.xml" />
<!-- <xi:include href="wrappers/motorControl/right_arm-mc-rawval-nws_wrapper.xml" /> -->
<xi:include href="checker/fineCalibrationCheckerConfig.xml" />
</devices>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE devices PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd">

<device xmlns:xi="http://www.w3.org/2001/XInclude" name="left_arm-rawval_remapper" type="rawValuesPublisherRemapper">
<param name="axesNames">(l_shoulder_pitch,l_shoulder_roll,l_shoulder_yaw,l_elbow)</param>
<param name="joints"> 4 </param>
<action phase="startup" level="5" type="attach">
<paramlist name="networks">
<elem name="left_arm_joints1"> left_arm-eb1-j0_3-mc</elem>
</paramlist>
</action>
<action phase="shutdown" level="20" type="detach" />
</device>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<param name="name"> /left_arm/raw_data </param>
<param name="period"> 2 </param>
<action phase="startup" level="10" type="attach">
<param name="device"> left_arm-eb1-j0_3-mc </param>
<param name="device"> left_arm-rawval_remapper </param>
</action>
<action phase="shutdown" level="15" type="detach" />
</device>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE devices PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd">

<device xmlns:xi="http://www.w3.org/2001/XInclude" name="right_arm-rawval_remapper" type="rawValuesPublisherRemapper">
<param name="axesNames">(r_shoulder_pitch,r_shoulder_roll,r_shoulder_yaw,r_elbow)</param>
<param name="joints"> 4 </param>
<action phase="startup" level="5" type="attach">
<paramlist name="networks">
<elem name="right_arm_joints1"> right_arm-eb3-j0_3-mc</elem>
</paramlist>
</action>
<action phase="shutdown" level="20" type="detach" />
</device>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<param name="name"> /right_arm/raw_data </param>
<param name="period"> 2 </param>
<action phase="startup" level="10" type="attach">
<param name="device"> right_arm-eb3-j0_3-mc </param>
<param name="device"> right_arm-rawval_remapper </param>
</action>
<action phase="shutdown" level="15" type="detach" />
</device>
9 changes: 8 additions & 1 deletion tests/dry-run/check-xml/schemas/remapper.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="type" type="xs:string" use="required" fixed="controlboardremapper"/>
<xs:attribute name="type" type="remapper-values" use="required" />
</xs:complexType>
</xs:element>

Expand All @@ -85,4 +85,11 @@
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="remapper-values">
<xs:restriction base="xs:string">
<xs:enumeration value="controlboardremapper" />
<xs:enumeration value="rawValuesPublisherRemapper" />
</xs:restriction>
</xs:simpleType>

</xs:schema>
42 changes: 30 additions & 12 deletions tests/dry-run/check-xml/src/check-xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ check wrappers that are independent from calibrators and remappers
2- for each file found, look for the device name and save in a list
3- compare this list of targets with the devices inside *-rawval-nws_wrapper.xml
*/
bool checkMotorControlWrappers(const std::string& robot_dir, std::vector<std::string>& vectorAllFiles, std::vector<std::string>& vectorUnremapped, bool& pass){
bool checkMotorControlWrappers(const std::string& robot_dir, std::vector<std::string>& vectorAllFiles, std::vector<std::string>& vectorNotMC, bool& pass){
std::vector<std::string> list_of_targets;
std::vector<std::string> list_raw_remappers;
pugi::xml_document doc_mc;
std::string device, target;

Expand All @@ -131,20 +132,30 @@ bool checkMotorControlWrappers(const std::string& robot_dir, std::vector<std::st
list_of_targets.push_back(device);
doc_mc.reset();
}
else if(ele.find("wrappers/motorControl") != std::string::npos && ele.find("-rawval-nws_remapper.xml") != std::string::npos) {
if(!loadXmlFile(robot_dir, ele, doc_mc)) return false;
pugi::xpath_node device_name = doc_mc.select_node("device");
target = trim(device_name.node().attribute("name").value());
list_raw_remappers.push_back(target);
vectorNotMC.push_back(ele);
std::cout << "Adding device: " << target << " to the list of raw remappers to be checked" << std::endl;
doc_mc.reset();
}
}

for (auto ele : vectorAllFiles)
{
if(ele.find("wrappers/motorControl") != std::string::npos && ele.find("rawval-nws_wrapper.xml") != std::string::npos) {
if(ele.find("wrappers/motorControl") != std::string::npos && ele.find("-rawval-nws_wrapper.xml") != std::string::npos) {
if(!loadXmlFile(robot_dir, ele, doc_mc)) return false;
pugi::xpath_node action_startup = doc_mc.select_node("//action[@phase='startup']/param[@name='device']/text()");
target = trim(action_startup.node().value());
if(std::find(list_of_targets.begin(), list_of_targets.end(), target) != list_of_targets.end()){
vectorUnremapped.push_back(ele);
std::cout << target << " - MOTOR CONTROL WRAPPER CHECK PASSED!" << std::endl;
std::cout << "Checking raw nws wrapper device: " << target << " against the list of raw remappers" << std::endl;
if(std::find(list_raw_remappers.begin(), list_raw_remappers.end(), target) != list_raw_remappers.end()){
vectorNotMC.push_back(ele);
std::cout << target << " - RAW WRAPPER CHECK PASSED!" << std::endl;
}
else{
std::cerr << target << " - MOTOR CONTROL WRAPPER CHECK FAILED!" << std::endl;
std::cerr << target << " - RAW WRAPPER CHECK FAILED!" << std::endl;
pass = false;
}
doc_mc.reset();
Expand All @@ -154,7 +165,7 @@ bool checkMotorControlWrappers(const std::string& robot_dir, std::vector<std::st
return true;
}

bool checkWrappersRemappers(const std::string& robot_dir, std::vector<std::string>& vectorAllFiles, std::vector<std::string>& vectorUnremapped,
bool checkWrappersRemappers(const std::string& robot_dir, std::vector<std::string>& vectorAllFiles, std::vector<std::string>& vectorNotMC,
const std::string& part, const std::string& target, bool& pass){
bool found = false;
pugi::xml_document doc_wrapper, doc_remapper;
Expand All @@ -179,9 +190,9 @@ bool checkWrappersRemappers(const std::string& robot_dir, std::vector<std::strin
if(!loadXmlFile(robot_dir, ele, doc_wrapper)) return false;
pugi::xpath_node device_name = doc_wrapper.select_node("device");
device = trim(device_name.node().attribute("name").value());
if (std::find(vectorUnremapped.begin(), vectorUnremapped.end(), ele) != vectorUnremapped.end())
if (std::find(vectorNotMC.begin(), vectorNotMC.end(), ele) != vectorNotMC.end())
{
std::cout << part << " - SKIPPED DEVICE " << device << " SINCE UNREMAPPED!" << std::endl;
std::cout << part << " - SKIPPED DEVICE " << device << " SINCE NOT MOTION CONTROL DEVICE!" << std::endl;
found = true;
continue;
}
Expand All @@ -198,6 +209,13 @@ bool checkWrappersRemappers(const std::string& robot_dir, std::vector<std::strin
if(!loadXmlFile(robot_dir, ele, doc_remapper)) return false;
pugi::xpath_node device_name = doc_remapper.select_node("device");
device = trim(device_name.node().attribute("name").value());
if (std::find(vectorNotMC.begin(), vectorNotMC.end(), ele) != vectorNotMC.end())
{
std::cout << part << " - SKIPPED DEVICE " << device << " SINCE NOT MOTION CONTROL DEVICE!" << std::endl;
found = true;
continue;
}
std::cout << "Checking remapper device: " << device << " against the target: " << target << std::endl;
if(device == target) std::cout << part << " - REMAPPER CHECK PASSED!" << std::endl;
else {
std::cerr << part << " - REMAPPER CHECK FAILED!" << std::endl;
Expand Down Expand Up @@ -239,8 +257,8 @@ bool checkCalibratorsWrappersRemappers(const std::string& robot_dir, std::vector
// we cannot check the single element inside the for loop by passing ele to method
// since we first need to fill the list of targets by looking in hardware/motorControl directory
// while the unramapped devices are inside wrappers/motorControl directory
std::vector<std::string> vectorUnremapped;
checkMotorControlWrappers(robot_dir, vectorAllFiles, vectorUnremapped, pass);
std::vector<std::string> vectorNotMC;
checkMotorControlWrappers(robot_dir, vectorAllFiles, vectorNotMC, pass);

for (auto ele : vectorAllFiles)
{
Expand Down Expand Up @@ -268,7 +286,7 @@ bool checkCalibratorsWrappersRemappers(const std::string& robot_dir, std::vector
pass = false;
}

checkWrappersRemappers(robot_dir, vectorAllFiles, vectorUnremapped, part, target1, pass);
checkWrappersRemappers(robot_dir, vectorAllFiles, vectorNotMC, part, target1, pass);
if(ele.find("arm") != std::string::npos){
checkCartesian(robot_dir, vectorAllFiles, part, target1, pass);
}
Expand Down