Skip to content

HAPTIX Simulation World API with Custom World Example

hmhan1236 edited this page Mar 29, 2018 · 4 revisions

Overview

이 튜토리얼은 SDF를 사용하여 사용자 지정 world를 구축하는 방법을 보여준다. 또한 시뮬레이션 world API를 사용하여 객체 상호 작용을 감지하고 객체 색상을 조작하는 방법에 대한 간단한 예제를 제공한다. 설치 단계 및 [world API 튜토리얼]을(https://github.com/modulabs/gdyn-gazebo-tutorial/wiki/HAPTIX-Simulation-World-API) 이미 완료했다고 가정합니다.

Documentation

API문서 전문은 여기를 참고하라. SDF 포맷를 사용하여 가제보 world를 구축하는 문서는 여기를 참고하라.

Matlab Example

Intoduction

먼저 SDF를 사용하여 world를 구축한다.

이 world 파일은 기본 arat.world와 매우 유사하며, 주요 차이점은 sphere_visual_model이 추가 된 것이다:

``
다음은, 시각 구형 모델에 접촉 상태를 감지하는 간단한 Octave/Matlab을 작성하고, 다른 물체와 접촉 할 때 구체의 색상을 녹색에서 빨간색으로 바꾼다.
```matlab

``

## Get the code:
튜토리얼 파일을 다운로든 한다.
* [custom_haptix.world](https://bitbucket.org/osrf/gazebo_tutorials/src/haptix_world_sim_api/haptix_world_sim_api/files/custom_haptix.world)
* [custom_world.m](https://bitbucket.org/osrf/gazebo_tutorials/src/haptix_world_sim_api/haptix_world_sim_api/files/custom_world.m)

# Haptix C-API Example
## Intoduction
위의 Matlab 예제와 같은 world를 사용하여, 시각적 구형 모델에서 접촉 상태를 감지하는 간단한 C 코드를 작성하고 다른 객체와 접촉 할 때 구의 색상을 녹색에서 빨간색으로 변경한다:
```matlab

``
[Haptix C API 튜토리얼](https://github.com/modulabs/gdyn-gazebo-tutorial/wiki/HAPTIX-C-API)의 컴파일 섹션에 나온 Haptix C API 코드와 마찬가지로 `custom_world.c`를 작성한다.

## Get the code:
파일을 다운로드 한다:
* [custom_haptix.world](https://bitbucket.org/osrf/gazebo_tutorials/src/haptix_world_sim_api/haptix_world_sim_api/files/custom_haptix.world)
* [custom_world.c](https://bitbucket.org/osrf/gazebo_tutorials/src/haptix_world_sim_api/haptix_world_sim_api/files/custom_world.c)

# Start Gazebo handsim simulation
예제 실행을 위해 터미널에서 가제보를 시작한다:

gazebo custom_haptix.world

## 코드 실행: MATLAB, Octave on Linux
먼저 Matlab 또는 Octave 스크립트를 실행하는 방법에 대하여 [world API 예제 섹션](https://github.com/modulabs/gdyn-gazebo-tutorial/wiki/HAPTIX-Simulation-World-API)을 참고한다.

다음으로 Matlab 또는 Octave 명령 프롬프트에서 `custom_world.m` 스크립트를 호출하면 손이 통과 할 때 구형이 녹색에서 빨간색으로 바뀌어야한다. 

Linux 사용자를 위한 힌트로, `custom_world.m` 실행 전에 옥타브 또는 matlab 프롬프트에서 haptix 스크립트에 대한 경로를 추가하여라:

path('[replace with your path to install]/lib/x86_64-linux-gnu/haptix-comm/octave', path) path('[replace with path to your custom_world.m]', path)

## 코드 실행: Using C-API on Linux
[Haptix C API 튜토리얼에서 시뮬레이션 섹션](https://github.com/modulabs/gdyn-gazebo-tutorial/wiki/HAPTIX-C-API)에 나와있는 Haptix C API 코드처럼 `custom_world.c`로부터 컴파일된 바이너리를 실행한다.

## Example Video
https://youtu.be/bWaWNZu-0n4
[![IMAGE ALT TEXT HERE](https://youtu.be/bWaWNZu-0n4)](https://youtu.be/bWaWNZu-0n4)

Table of Contents




Clone this wiki locally