Example #1
0
        /// <summary>
        /// Initializes all static classes needed for the urdfSyncher to work
        /// </summary>
        public static void InitializeUrdfSyncher()
        {
            //Attach tooltip factory to the Robot Parser
            tooltipFactory = new AttachableComponentFactory <IAttachableComponent>("tooltip")
            {
                Constructor = () => new RosSharp.Urdf.Attachables.AttachedDataValue(),
            };

            Robot.attachableComponentFactories.Add(tooltipFactory);
        }
Example #2
0
        public void ShouldCreateInstance_WithToolTip()
        {
            string xml = UrdfTests.Properties.Resources.xmlResSingleNode;

            AttachableComponentFactory <IAttachableComponent> factory =
                new AttachableComponentFactory <IAttachableComponent>("tooltip")
            {
                Constructor = () => new AttachedDataValue(),
            };

            Robot.attachableComponentFactories.Add(factory);

            Robot robot = Robot.FromContent(xml);

            var dataValues = factory.ExtractAttachableComponents <AttachedDataValue>(robot);

            Assert.True(robot.attachedComponents.Count > 0);
            Assert.True(robot.attachedComponents[0] != null);
            Assert.True((robot.attachedComponents[0].component as AttachedDataValue).topic == "/test/topic");
            //Assert.True(robot.attachedComponents[0].parentLink != null);
            //Assert.True(robot.attachedComponents[0].component != null);
        }