anyKode Marilou
Find the complete device's name

Find the complete device's name and use it with MODA.

This section describes how to find the name (path) of a device. The path of a device is its relative name "mymotor" prefixed with the path of its parent entity. 


Relative/Absolute name:

(Exemple 1): For exemple, the path of a motor named "mymotor", attached on an axis named "axisred", owned by a joint named "myjoint" placed in the world, is : "/myjoint/axisred/mymotor". 

(Exemple 2) If this joint is inside a PHX, and the PHX is imported in the world as "/Robot1", the motor path is "/Robot1/myjoint/axisred/mymotor". 


A device query (using QueryDevicexxxxx) is always done from a PHX (startup point). The higher level PHX is the world and is named "/". Using MODA, we can find and use the device using several methods: 


(1) : The joint is inside the world:

//Get the higher level PHX
ModaCPP::RobotPHX *phx=connection->QueryRobotPHX("/");
//Query the device using relative name
ModaCPP::DeviceMotor *mymotor=phx->QueryDeviceMotor("myjoint/axisred/mymotor");


(2) : If the joint is inside a PHX, imported as "/Robot1":

ModaCPP::RobotPHX *phx=connection->QueryRobotPHX("/Robot1");
ModaCPP::DeviceMotor *mymotor=phx->QueryDeviceMotor("myjoint/axisred/mymotor");

//Is the same than:

ModaCPP::RobotPHX *phx=connection->QueryRobotPHX("/");
ModaCPP::DeviceMotor *mymotor=phx->QueryDeviceMotor("Robot1/myjoint/axisred/mymotor");


Using Devices Explorer tool:

Devices Explorer tool can connect to a running simulation and enum devices. The devices names are relative to the PHX startup point. Also, Devices Explorer generates C++ or C# code that shows how to use devices using MODA.

  1. Start a simulation (in this sample we started Samples/Scenes/Testworld)
  2. From Marilou-Exec, Tools menu, start Devices Explorer.
  3. Click on 'connect' button
  4. Choose "/Robot1" as startup point (PHX) : you can see in the listbox the devices that can be reached from "/Robot1"
  5. Choose for exemple devices "rayl/r" and "rayr/r"
  6. You can see the C++ code required to use these devices in your own application, using MODA. You can also change the startup point.




Using Marilou-Exec debug console:

Marilou-Exec displays in a debug console the entities, devices and PHX that are used for creating complete simulation. To activate the debug console, open the Options panel: 

Menu Options->Settings->Options: check the "Allocate DOS console at Exec startup" checkbox. The console will be available at the next Exec startup. See the "MODA enums" text section. 


Using Class Creator tool:

Your easily create your robot's class using the Class Creator tool: the generated class contains all the devices names, relative from a startup point.

Documentation v4.7 (18/01/2015), Copyright (c) 2015 anyKode. All rights reserved.
What do you think about this topic? Send feedback!