Skip to content

Commit

Permalink
Merge branch 'inis-and-readme' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jgvictores committed Jan 21, 2020
2 parents ca032b9 + 8baf691 commit 9fc1e41
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 41 deletions.
35 changes: 14 additions & 21 deletions libraries/YarpPlugins/RealToSimControlboard/DeviceDriverImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ bool RealToSimControlboard::open(yarp::os::Searchable& config)
}
CD_DEBUG("%s\n", controlledDeviceList->toString().c_str());

std::string prefix;
if(config.check("prefix","prefix for all local and remote ports"))
{
prefix = config.find("prefix").asString();
CD_INFO("Using prefix: %s\n",prefix.c_str());
}
std::string name = config.find("name").asString();

std::map<std::string,int> controlledDeviceNameToIdx;
for(size_t controlledDeviceIdx=0; controlledDeviceIdx< controlledDeviceList->size(); controlledDeviceIdx++)
Expand All @@ -47,22 +42,20 @@ bool RealToSimControlboard::open(yarp::os::Searchable& config)
CD_INFO("%s\n", controlledDeviceGroup.toString().c_str());
yarp::os::Property controlledDeviceOptions;
controlledDeviceOptions.fromString(controlledDeviceGroup.toString());
if(!prefix.empty())

if(controlledDeviceOptions.check("remote"))
{
if(controlledDeviceOptions.check("remote"))
{
std::string remote(prefix);
remote += controlledDeviceOptions.find("remote").asString();
controlledDeviceOptions.unput("remote");
controlledDeviceOptions.put("remote",remote);
}
if(controlledDeviceOptions.check("local"))
{
std::string local(prefix);
local += controlledDeviceOptions.find("local").asString();
controlledDeviceOptions.unput("local");
controlledDeviceOptions.put("local",local);
}
std::string remote(name);
remote += controlledDeviceOptions.find("remote").asString();
controlledDeviceOptions.unput("remote");
controlledDeviceOptions.put("remote",remote);
}
if(controlledDeviceOptions.check("local"))
{
std::string local(name);
local += controlledDeviceOptions.find("local").asString();
controlledDeviceOptions.unput("local");
controlledDeviceOptions.put("local",local);
}

yarp::dev::PolyDriver* controlledDevice = new yarp::dev::PolyDriver(controlledDeviceOptions);
Expand Down
24 changes: 20 additions & 4 deletions libraries/YarpPlugins/RealToSimControlboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@
yarp server
```

## Example with Dextra
Example invocation with a `leftDextra`:
## Example with Left Dextra
```bash
openrave --module OpenraveYarpPluginLoader "env openrave/dextra/leftDextra.robot.xml open --device controlboardwrapper2 --subdevice YarpOpenraveControlboard --robotIndex 0 --allManipulators" --viewer qtcoin --collision ode
```

```bash
yarpdev --device RealToSimControlboard --context RealToSimControlboard --from leftDextra.ini
```

Example invocation with a `leftDextra` in a `teoSim`:
## Example with Left Dextra in a teoSim
```bash
teoSim dextra
```

```bash
yarpdev --device RealToSimControlboard --context RealToSimControlboard --from leftDextra.ini --prefix teoSim
yarpdev --device RealToSimControlboard --context RealToSimControlboard --from leftDextra.ini --name /teoSim/leftDextra
```

## Example with Lacquey Fetch
Expand All @@ -23,3 +30,12 @@ openrave --module OpenraveYarpPluginLoader "env openrave/lacqueyFetch/lacqueyFet
```bash
yarpdev --device RealToSimControlboard --context RealToSimControlboard --from lacqueyFetch.ini
```

## Example with Lacquey Fetch (left) in a teoSim
```bash
teoSim
```

```bash
yarpdev --device RealToSimControlboard --context RealToSimControlboard --from lacqueyFetch.ini --name /teoSim/leftLacqueyFetch
```
12 changes: 6 additions & 6 deletions share/contexts/RealToSimControlboard/lacqueyFetch.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ remotes (externalFinger internalFinger thumb)

[externalFinger]
device remote_controlboard
local /realToSimControlboard/lacqueyFetch/externalFinger
remote /lacqueyFetch/externalFinger
local /realToSimControlboard/externalFinger
remote /externalFinger

[internalFinger]
device remote_controlboard
local /realToSimControlboard/lacqueyFetch/internalFinger
remote /lacqueyFetch/internalFinger
local /realToSimControlboard/internalFinger
remote /internalFinger

[thumb]
device remote_controlboard
local /realToSimControlboard/lacqueyFetch/thumb
remote /lacqueyFetch/thumb
local /realToSimControlboard/thumb
remote /thumb

[exposed_joint_0]
externalFinger (joint 0 transformation linear m 1 b 0)
Expand Down
20 changes: 10 additions & 10 deletions share/contexts/RealToSimControlboard/leftDextra.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ remotes (thumb index middle ring pinky)

[thumb]
device remote_controlboard
local /realToSimControlboard/leftDextra/thumb
remote /leftDextra/thumb
local /realToSimControlboard/thumb
remote /thumb

[index]
device remote_controlboard
local /realToSimControlboard/leftDextra/index
remote /leftDextra/index
local /realToSimControlboard/index
remote /index

[middle]
device remote_controlboard
local /realToSimControlboard/leftDextra/middle
remote /leftDextra/middle
local /realToSimControlboard/middle
remote /middle

[ring]
device remote_controlboard
local /realToSimControlboard/leftDextra/ring
remote /leftDextra/ring
local /realToSimControlboard/ring
remote /ring

[pinky]
device remote_controlboard
local /realToSimControlboard/leftDextra/pinky
remote /leftDextra/pinky
local /realToSimControlboard/pinky
remote /pinky

[exposed_joint_0]
thumb (joint 0 transformation linear m 1 b 0)
Expand Down

0 comments on commit 9fc1e41

Please sign in to comment.