Skip to content

Commit

Permalink
Update loading of yarp robot interface configuration to handle URIs
Browse files Browse the repository at this point in the history
Add this check to unit tests
  • Loading branch information
xela-95 committed Mar 12, 2024
1 parent 2ce97ee commit e6f7c57
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
7 changes: 5 additions & 2 deletions plugins/robotinterface/RobotInterface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,11 @@ class RobotInterface : public System, public ISystemConfigure
return false;
}

m_xmlRobotInterfaceResult
= m_xmlRobotInterfaceReader.getRobotFromFile(robotinterface_file_name);
// Resolve potential URIs
auto sysPaths = gz::common::SystemPaths();
auto filepath = sysPaths.FindFileURI(robotinterface_file_name);

m_xmlRobotInterfaceResult = m_xmlRobotInterfaceReader.getRobotFromFile(filepath);

if (!m_xmlRobotInterfaceResult.parsingIsSuccessful)
{
Expand Down
18 changes: 18 additions & 0 deletions tests/commons/conf/camera_nws.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE robot PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd">

<robot name="camera" portprefix="camera" build="0" xmlns:xi="http://www.w3.org/2001/XInclude">
<devices>
<device name="camera_nws_yarp" type="frameGrabber_nws_yarp">
<!-- See https://www.yarp.it/latest/classFrameGrabber__nws__yarp.html#details for parameter documentation -->
<param name="name"> /camera </param>
<param name="period"> 0.033333 </param>
<param name="capabilities"> COLOR </param>
<action phase="startup" level="5" type="attach">
<!-- This is the same name that we passed with the yarpDeviceName to the camera plugin -->
<param name="device"> camera_plugin_device </param>
</action>
<action phase="shutdown" level="5" type="detach" />
</device>
</devices>
</robot>
11 changes: 5 additions & 6 deletions tests/commons/model_configuration_file.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@

<!-- LASER PLUGIN -->
<plugin name="gzyarp::Laser" filename="gz-sim-yarp-laser-system">
<!--
<yarpConfigurationFile>/home/acroci/repos/gz-sim-yarp-plugins/tests/commons/conf/laser.ini</yarpConfigurationFile> -->
<yarpConfigurationFile>model://commons/conf/laser.ini</yarpConfigurationFile>
</plugin>

Expand Down Expand Up @@ -104,6 +102,11 @@
</yarpConfigurationFile>
</plugin>

<!-- ROBOT INTERFACE PLUGIN -->
<plugin name="gzyarp::RobotInterface" filename="gz-sim-yarp-robotinterface-system">
<yarpRobotInterfaceConfigurationFile>model://commons/conf/camera_nws.xml</yarpRobotInterfaceConfigurationFile>
</plugin>

<link name="link_1">
<visual name="visual">
<geometry>
Expand Down Expand Up @@ -209,10 +212,6 @@
</geometry>
</collision>
</link>

<!-- <plugin name="gzyarp::RobotInterface" filename="gz-sim-yarp-robotinterface-system">
<yarpRobotInterfaceConfigurationFile>../../../tests/camera/camera_nws.xml</yarpRobotInterfaceConfigurationFile>
</plugin> -->
</model>

</world>
Expand Down

0 comments on commit e6f7c57

Please sign in to comment.