HAPTIX C API - modulabs/gazebo-tutorial GitHub Wiki

Overview

C-API ๋ฌธ์„œ๋ฅผ ์ฐพ๋Š”๋‹ค๋ฉด? http://gazebosim.org/haptix/api์— ๋“ค์–ด๊ฐ€ ๋ณด์•„๋ผ

์ด ํŠœํ† ๋ฆฌ์–ผ์€ ์†์˜ ์„ค๋ช…์„ ์š”์ฒญํ•˜๊ฑฐ๋‚˜ ์กฐ์ธํŠธ ๋ช…๋ น์„ ๋ณด๋‚ด๊ณ  ์ƒํƒœ๋ฅผ ์—…๋ฐ์ดํŠธ ๋ฐ›๊ธฐ ์œ„ํ•œ C HAPTIX ํด๋ผ์ด์–ธํŠธ ๋ผ์ด๋ธŒ๋ธŒ๋ฆฌ `haptix-comm' ์‚ฌ์šฉ๋ฒ•์— ๋Œ€ํ•˜์—ฌ ์„ค๋ช…ํ•œ๋‹ค. ์„ค์น˜ ์ˆœ์„œ์— ๋”ฐ๋ผ ์ด๋ฏธ ์™„๋ฃŒํ•˜์˜€๋‹ค๊ณ  ๊ฐ€์ •ํ•œ๋‹ค.

Compile your controller

์ด ํŠœํ† ๋ฆฌ์–ผ์—์„œ๋Š” ๋ชจ๋“  ์† ๊ด€์ ˆ์— sin ํ•จ์ˆ˜๋ฅผ ์ ์šฉํ•˜๋Š” ์•„์ฃผ ๊ธฐ๋ณธ์ ์ธ ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค. ๋จผ์ €, ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์ปดํŒŒ์ผํ•˜๊ณ  haptix-comm ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์— ๋งํฌํ•ด์•ผํ•œ๋‹ค.

Windows

Visual Studio 2013์„ ์—ด๊ณ  ํ•ธ๋“œ ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์œ„ํ•œ ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ•œ๋‹ค. File->New Project->Visual C++๋ฅผ ์„ ํƒํ•˜๊ณ , ์˜ค๋ฅธ์ชฝ ์ฐฝ์—์„œ Win32 Console Application๋ฅผ ์„ ํƒํ•œ๋‹ค. ํ”„๋กœ์ ํŠธ ์ด๋ฆ„์„ ์ž…๋ ฅํ•œ๋‹ค, ์˜ˆ๋ฅผ ๋“ค๋ฉด MyBasicController. OK์„ ๋ˆ„๋ฅด๊ณ , Finish๋ฅผ ๋ˆ„๋ฅธ๋‹ค. ํ˜„์žฌ ํ”„๋กœ์ ํŠธ์˜ ์†Œ์Šค์ฝ”๋“œ๋ฅผ ๊ธฐ๋ณธ ์ปจํŠธ๋กค๋Ÿฌ ์ฝ”๋“œ๋กœ ๋ฐ”๊พผ๋‹ค. ์†Œ์Šค ์ฝ”๋“œ๋Š” ์—ฌ๊ธฐ์—์„œ ๋ณต์‚ฌํ•˜์—ฌ ํ˜„์žฌ ํ”„๋กœ์ ํŠธ์— ๋ณต์‚ฌํ•œ๋‹ค. ์†Œ์Šค์ฝ”๋“œ ์‹œ์ž‘ ์œ„์น˜์— ์•„๋ž˜ ์ค„์„ ์ถ”๊ฐ€ํ•œ๋‹ค:

#include "stdafx.h"

Configuration for 64-bit SDK

** Note: 32-bit SDK๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด ์ด๋ฒˆ ์žฅ์€ ์ƒ๋žตํ•œ๋‹ค ** ํˆด๋ฐ”์— ์žˆ๋Š” Win32๋ผ๊ณ  ๋˜์–ด์žˆ๋Š” ๋“œ๋กญ๋‹ค์šด ๋ฉ”๋‰ด์—์„œ(dropdown menu) Configuration Manager๋ฅผ ์„ ํƒํ•œ๋‹ค. ๊ทธ๋ฆฌ๊ณ  Active solution platform ๋“œ๋กญ๋‹ค์šด ๋ฉ”๋‰ด์—์„œ <New...>๋ฅผ ์„ ํƒํ•œ๋‹ค. Type or select the new platform์„ ๋ˆ„๋ฅด๊ณ  ARM์„ x64๋กœ ๋ณ€๊ฒฝํ•˜๊ณ  Close๋ฅผ ๋ˆ„๋ฅธ๋‹ค.

Compile your code

View->Other Windows->Property Manager๋ฅผ ๋ˆŒ๋Ÿฌ Property Manager๋ฅผ ์—ฐ๋‹ค. ๊ทธ๋Ÿฌ๋ฉด HAPTIX ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ SDK์—์„œ ์ œ๊ณตํ•˜๋Š” ์†์„ฑ ์‹œํŠธ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค. Property Managerํƒฌ์œผ๋กœ ์ด๋™ํ•˜์—ฌ ํ”„๋กœ์ ํŠธ์—์„œ ์šฐํด๋ฆญ์„ ํ•œ๋‹ค. ๊ทธ๋ฆฌ๊ณ  Add Existing Property Sheet...๋ฅผ ์„ ํƒํ•œ๋‹ค. ์ƒˆ๋กœ์šด ํŒ์—… ์ฐฝ์ด ๋‚˜ํƒ€๋‚˜๋ฉด HAPTIX ํด๋ผ์ด์–ธํŠธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ SDK๋ฅผ ๋‹ค์šด๋กœ๋“œ ํ•œ ํด๋”๋กœ ์ด๋™ํ•˜์—ฌ haptix-comm์ด๋ผ๋Š” ๋“ฑ๋ก ์ •๋ณด ์‹œํŠธ๋ฅผ ์„ ํƒํ•œ๋‹ค. ์ด ์ž‘์—…์€ ํ”„๋กœ์ ํŠธ์˜ ๋ชจ๋“  dependencies์„ ์ฒ˜๋ฆฌํ•ด์ค€๋‹ค. ์ƒ๋‹จ์˜ ํˆด๋ฐ”์—์„œ target build๋ฅผ Debug๋ฅผ Release๋กœ ๋ฐ”๊พธ๊ณ  BUILD->Build Solution์„ ๋ˆŒ๋Ÿฌ ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ๋นŒ๋“œํ•œ๋‹ค.

Linux

  1. ๋‹ค์šด๋กœ๋“œ์™€ ์˜ˆ์ œ ์ปดํŒŒ์ผ์„ ์œ„ํ•˜์—ฌ ์•„๋ž˜ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•œ๋‹ค.
sudo apt-get install wget cmake build-essential
  1. ์‹ค์Šต์„ ์œ„ํ•˜์—ฌ haptix_controller๋ผ๋Š” ์ด๋ฆ„์˜ ์ƒˆ๋กœ์šด ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ๊ทธ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™ํ•œ๋‹ค.
mkdir ~/haptix_controller
cd ~/haptix_controller
  1. ์ปจํŠธ๋กค๋Ÿฌ ์†Œ์ŠคํŒŒ์ผ๊ณผ cmake ํŒŒ์ผ์„ ๋‹ค์šด๋กœ๋“œ ํ•œ๋‹ค.
wget http://bitbucket.org/osrf/haptix-comm/raw/default/example/hx_controller.c
wget http://bitbucket.org/osrf/gazebo_tutorials/raw/default/haptix_comm/files/CMakeLists.txt
  1. ๋นŒ๋“œ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์†Œ์ŠคํŒŒ์ผ์„ ์ปดํŒŒ์ผํ•œ๋‹ค.
mkdir build
cd build
cmake ..
make

Running the simulation with your controller

๋ฆฌ๋ˆ…์Šค ์ปดํ“จํ„ฐ์—์„œ๋Š” haptixStart ๋ฐ์Šคํฌํƒ‘ ์•„์ด์ฝ˜์„ ๋”๋ธ”ํด๋ฆญํ•˜์—ฌ ์‹œ๋ฎฌ๋ ˆ์ด์…˜์„ ์‹œ์ž‘ํ•œ๋‹ค.

Windows

Visual Studio๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์†Œ์Šค์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•  ์ค€๋น„๊ฐ€ ๋˜์—ˆ๋‹ค๋ฉด DEBUG-> Start Without Debugging... ํด๋ฆญํ•œ๋‹ค. (๋˜๋Š” Ctrl+F5๋ฅผ ๋ˆ„๋ฅธ๋‹ค) Note: ๋งŒ์•ฝ์— ์œˆ๋„์šฐ ๋ฐฉํ™”๋ฒฝ์ด ํ™œ์„ฑํ™”๋˜์–ด ์žˆ์œผ๋ฉด ์ตœ๊ทผ์— ์ปดํŒŒ์ผ ๋œ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์„ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋Š” ๊ถŒํ•œ์„ ๋ฌป๋Š” "Windows ๋ณด์•ˆ ๊ฒฝ๊ณ , Windows ๋ฐฉํ™”๋ฒฝ์—์„œ์ด ํ”„๋กœ๊ทธ๋žจ์˜ ์ผ๋ถ€ ๊ธฐ๋Šฅ์„ ์ฐจ๋‹จํ–ˆ์Šต๋‹ˆ๋‹ค."๋ผ๋Š” ์ฐฝ์ด ๋œฐ๊ฒƒ์ด๋‹ค. ์ด๋•Œ ๊ธฐ๋ณธ ์˜ต์…˜("์ง‘ ๋˜๋Š” ์ง์žฅ ๋„คํŠธ์›Œํฌ์™€ ๊ฐ™์€ ์‚ฌ์„ค๋ง")์„ ๊ทธ๋Œ€๋กœ ๋‘๊ณ  "์•ก์„ธ์Šค ํ—ˆ์šฉ"์„ ํด๋ฆญ ํ•œ๋‹ค.

Linux

  1. ์ปจํŠธ๋กค๋Ÿฌ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•  ๋ฆฌ๋ˆ…์Šค ์ปดํ“จํ„ฐ์—์„œ ํ„ฐ๋ฏธ๋„์ฐฝ์„ ์—ด๊ณ  ์‹คํ–‰ํ•  ์ปจ๋А๋กค๋Ÿฌ์˜ ์œ„์น˜์— ์žˆ๋Š” /build๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™ํ•œ๋‹ค.
cd ~/haptix_controller/build
  1. ์ปจํŠธ๋กค๋Ÿฌ๋ฅผ ์‹คํ–‰ํ•œ๋‹ค.
./hx_controller

Controller visualization

์ปจํŠธ๋กค๋Ÿฌ๊ฐ€ ์‹คํ–‰๋˜๋Š” ๋™์•ˆ ๊ฐ€์ œ๋ณด์—์„œ ์†์ด ๋ถ€๋“œ๋Ÿฌ์šด ๊ฒฝ๋กœ(smooth trajectory)๋ฅผ ๋”ฐ๋ผ๊ฐ€๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

IMAGE ALT TEXT HERE

The code explained

int main(int argc, char **argv)
{
  int i;
  int counter = 0;
  hxRobotInfo robotInfo;
  hxCommand cmd;
  hxSensor sensor;

  // Capture SIGINT signal.
  if (signal(SIGINT, sigHandler) == SIG_ERR)
    printf("Error catching SIGINT\n");

  // Capture SIGTERM signal.
  if (signal(SIGTERM, sigHandler) == SIG_ERR)
    printf("Error catching SIGTERM\n");

  // Connect to the simulator / hardware
  if (hx_connect(NULL, 0) != hxOK)
  {
    printf("hx_connect(): Request error.\n");
    return -1;
  }

  // Requesting robot information.
  if (hx_robot_info(&robotInfo) != hxOK)
  {
    printf("hx_getrobotinfo(): Request error.\n");
    return -1;
  }

  // Print the robot information.
  printRobotInfo(&robotInfo);

  // Uncomment this block to start logging.
  // if (hxs_start_logging("/tmp/log/") != hxOK)
  //   printf("hxs_start_logging(): error.\n");

  int steps = 0;

  // Send commands at ~100Hz.
  while (steps < 3000)
  {
    // Create a new command based on a sinusoidal wave.
    for (i = 0; i < robotInfo.motor_count; ++i)
    {
      // Set the desired position of this motor
      cmd.ref_pos[i] = (float)(350 * 0.5 *
        sin(0.05 * 2.0 * M_PI * counter * 0.01));
      // We could set a desired maximum velocity
      // cmd.ref_vel[i] = 1.0;
      // cmd.ref_vel_max[i] = 1.0;
      // We could set a desired controller position gain
      // cmd.gain_pos[i] = 1.0;
      // We could set a desired controller velocity gain
      // cmd.gain_vel[i] = 1.0;
    }
    // Indicate that the positions we set should be used.
    cmd.ref_pos_enabled = 1;
    // We're not setting it, so indicate that ref_vel should be ignored.
    cmd.ref_vel_enabled = 0;
    // We're not setting it, so indicate that ref_vel_max should be ignored.
    cmd.ref_vel_max_enabled = 0;
    // We're not setting it, so indicate that gain_pos should be ignored.
    cmd.gain_pos_enabled = 0;
    // We're not setting it, so indicate that gain_vel should be ignored.
    cmd.gain_vel_enabled = 0;

    // Send the new joint command and receive the state update.
    if (hx_update(&cmd, &sensor) != hxOK)
    {
      printf("hx_update(): Request error.\n");
      continue;
    }

    // Debug output: Print the state.
    if (!(counter % 100))
      printState(&robotInfo, &sensor);

    if (++counter == 10000)
      counter = 0;

    ++steps;

    // Here is where you would do your other work, such as reading from EMG
    // sensors, decoding that data, computing your next control command,
    // etc.  In this example, we're just sleeping for 10ms.
    //
    // You might also want to sleep in your code, because there's a maximum
    // rate at which the limb can process new commands and produce new
    // sensor readings.  Depending on how long your computation takes, you
    // might want to wait here until it's time to send a new command.  Or
    // you might want to run as fast as possible, computing and sending new
    // commands constantly (but knowing that not all of them will be
    // executed by the limb).
    unsigned int sleeptime_us = 10000;
#ifdef _WIN32
    Sleep((DWORD)(sleeptime_us / 1e3));
#else
    usleep(sleeptime_us);
#endif
  }

  // Uncomment this block to stop logging.
  // if (hxs_stop_logging() != hxOK)
  //   printf("hxs_stop_logging(): error.\n");

  // Disconnect from the simulator / hardware
  if (hx_close() != hxOK)
  {
    printf("hx_close(): Request error.\n");
    return -1;
  }

  return 0;
}

HAPTIX C API๋Š” 5 ๊ฐœ์˜ C ํ•จ์ˆ˜ ํ˜ธ์ถœ๋กœ ๊ตฌ์„ฑ๋œ๋‹ค: hx_connect(), hx_robot_info(), hx_update(), hx_read_sensors() hx_close(). hx_connect()์™€ hx_close()๋Š” Gazebo ์‹œ๋ฎฌ๋ ˆ์ดํ„ฐ์—์„œ๋Š” ์„ ํƒ ์‚ฌํ•ญ์ด์ง€๋งŒ MuJoCo์™€์˜ ํ˜ธํ™˜์„ฑ์„ ์œ„ํ•ด ํฌํ•จ ์žˆ์Šต๋‹ˆ๋‹ค.

hx_robot_info()๋Š” ์ฃผ์–ด์ง„ ์žฅ์น˜(Gazebo์—์„œ ์‹œ๋ฎฌ๋ ˆ์ด์…˜ ๋œ ์†)๋กœ๋ถ€ํ„ฐ ์ •๋ณด๋ฅผ ์š”์ฒญํ•œ๋‹ค. ์ด ํ˜ธ์ถœ์€ ์‘๋‹ต์ด ์ˆ˜์‹  ๋  ๋•Œ๊นŒ์ง€ ์ฐจ๋‹จ(block)๋œ๋‹ค.

hx_robot_info()์— ๋Œ€ํ•œ ๋งค๊ฐœ ๋ณ€์ˆ˜๋Š” ์š”์ฒญ ๋œ ์žฅ์น˜์— ๋Œ€ํ•œ ๋ชจํ„ฐ, ์กฐ์ธํŠธ, ์ ‘์ด‰ ์„ผ์„œ, IMU ๋ฐ ์กฐ์ธํŠธ ์ œํ•œ ์ˆ˜๋ฅผ ํฌํ•จํ•˜๋Š” hxRobotInfo ๊ตฌ์กฐ์ฒด์ด๋‹ค. ๋˜ํ•œ ์žฅ์น˜ ์—…๋ฐ์ดํŠธ ์ฃผ๊ธฐ์ธ ์—…๋ฐ์ดํŠธ ์†๋„๋„ ํฌํ•จ๋ฉ๋‹ˆ๋‹ค. ์‘๋‹ต์ด ์œ ํšจํ•œ๋‹ค๋ฉด ๋ฐ˜ํ™˜ ๊ฐ’์€ hxOK์ด๋‹ค.

์ด ์˜ˆ์ œ์—๋Š” ๋””๋ฒ„๊น… ๋ชฉ์ ์œผ๋กœ ์ˆ˜์‹  ๋œ ๋ชจ๋“  ํ•„๋“œ๋ฅผ ์ธ์‡„ํ•˜๋Š” ๋„์›€ ํ•จ์ˆ˜ printRobotInfo()๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

์ผ๋‹จ ๋กœ๋ด‡ ์ •๋ณด๋ฅผ ํ™•์ธํ•˜๋ฉด ์†์„ ์ œ์–ดํ•˜๊ธฐ์œ„ํ•œ ๋ช…๋ น์„ ๋ณด๋‚ผ ์ˆ˜ ์žˆ๋‹ค. hx_update() ํ•จ์ˆ˜๋Š” ์ƒˆ๋กœ์šด ๋ช…๋ น์„ ๋ณด๋‚ด๊ณ  ํ˜„์žฌ ์†์˜ ์ƒํƒœ๋ฅผ ๋ฐ›๋Š” ์—ญํ• ์„ ํ•œ๋‹ค.

๋จผ์ €, ๊ฐ ๊ด€์ ˆ์˜ ์œ„์น˜, ์†๋„ ๋ฐ ์ด๋“์„ ํฌํ•จํ•˜๋Š” hxCommand ๊ตฌ์กฐ์ฒด๋ฅผ ์ฑ„์šธ ํ•„์š”๊ฐ€ ์žˆ๋‹ค. hxCommand ๊ตฌ์กฐ์ฒด์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ haptix-comm API์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค. ์ด ์˜ˆ์ œ์˜ ๊ฒฝ์šฐ, sin ํ•จ์ˆ˜์— ๋”ฐ๋ผ ๋ชจ๋“  ๊ด€์ ˆ์˜ ์œ„์น˜๋ฅผ ๋ฐ”๊พธ๊ณ  ์žˆ๋‹ค.

hx_update()์˜ ์ฒซ ๋ฒˆ์งธ ๋งค๊ฐœ ๋ณ€์ˆ˜์ธ cmd๋Š” ์ด๋ฏธ ์ž…๋ ฅ๋˜์–ด์žˆ๋Š” ์žฅ์น˜๋กœ ๋ณด๋‚ด๋ ค๋Š” ๋ช…๋ น์ด๋‹ค. ๋‘ ๋ฒˆ์งธ ์ถœ๋ ฅ ๋ช…๋ น sensor๋Š” ํ•จ์ˆ˜์— ์ „๋‹ฌ๋œ๋‹ค; ์ด๊ฒƒ์€ ๋ช…๋ น์ด ์ ์šฉ๋œ ํ›„ ์†์˜ ์ƒํƒœ๋ฅผ ํฌํ•จํ•˜๊ณ  ์žˆ๋‹ค.

๋””๋ฒ„๊น… ๋ชฉ์ ์œผ๋กœ ๋ชจ๋“  ์ƒํƒœ ์ •๋ณด๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” ๋„์›€ ํ•จ์ˆ˜ printState()๊ฐ€ ์žˆ๋‹ค. hx_robot_info()์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ, hx_update() ํ•จ์ˆ˜๋Š” ๋ช…๋ น์ด ์„ฑ๊ณต์ ์œผ๋กœ ๋ณด๋‚ด์ง€๊ณ  ์ƒํƒœ๊ฐ€ ์ˆ˜์‹ ๋˜๋ฉด hxOK๋ฅผ ๋ฐ˜ํ™˜ํ•œ๋‹ค.

Troubleshooting

์œˆ๋„์šฐ ํด๋ผ์ด์–ธํŠธ์—์„œ ๋ฆฌ๋ˆ…์Šค ๊ฐ€์ œ๋ณด ์„œ๋ฒ„๋กœ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์„๋•Œ

์ผ๋ฐ˜์ ์œผ๋กœ Visual Studio์—์„œ ์‹œ์ž‘ํ•œ ๋ช…๋ น ์ค„์—์„œ ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€ hx_robot_info() Service call timed out๊ฐ€ ์ถœ๋ ฅ๋œ๋‹ค. ์ด๊ฒƒ์€ Gazebo Linux ์„œ๋ฒ„์™€์˜ ํ†ต์‹ ์ด ์‹คํŒจํ–ˆ์Œ์„ ์˜๋ฏธํ•œ๋‹ค.

์ฒซ ๋ฒˆ์งธ ํ™•์ธ์‚ฌํ•ญ: ๋‘ ์‹œ์Šคํ…œ์ด ๋™์ผํ•œ ๋„คํŠธ์›Œํฌ์— ์žˆ๊ณ  ์„œ๋กœ ๋„๋‹ฌ ํ•  ์ˆ˜ ์žˆ๋Š”๊ฐ€? ๋‹จ์ˆœํžˆ ์–‘์ชฝ(windows command๊ณผ Linux shell)์—์„œ ping ๋ช…๋ น์„ ์‚ฌ์šฉํ•˜๋ฉด, ์—ฐ๊ฒฐ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค. ์ž‘๋™ํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ ๋„คํŠธ์›Œํฌ ๊ตฌ์„ฑ์— ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š” ๊ฒƒ์ด๋‹ค. ๋‘˜ ๋‹ค ๋™์ผํ•œ ๋„คํŠธ์›Œํฌ์— ์—ฐ๊ฒฐ๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์—ฌ๋ผ.

๋‘ ๋ฒˆ์งธ ํ™•์ธ์‚ฌํ•ญ: ํ†ต์‹  ๋ ˆ์ด์–ด๊ฐ€ ์˜ฌ๋ฐ”๋ฅธ ๋„คํŠธ์›Œํฌ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š”๊ฐ€? Gazebo Linux ์„œ๋ฒ„์™€ Windows์—์„œ IGN_IP๋ฅผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์„ค์ •ํ–ˆ๋Š”์ง€ ๋‹ค์‹œ ํ™•์ธํ•˜์—ฌ๋ผ. windows command์—์„œ echo % IGN_IP %์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์™„์ „ํžˆ ํ™•์‹คํ•˜๊ฒŒ ํ•˜๋ ค๋ฉด, ์‚ฌ์šฉ์ž ์„ธ์…˜์—์„œ ๋กœ๊ทธ ์•„์›ƒ ํ•œ ๋‹ค์Œ ๋‹ค์‹œ ๋กœ๊ทธ์ธํ•˜๊ณ  Visual Studio๋ฅผ ์—ฐ๋‹ค.

์„ธ ๋ฒˆ์งธ ํ™•์ธ์‚ฌํ•ญ: Windows ๋ฐฉํ™”๋ฒฝ์ด ํ†ต์‹ ์— ์˜ํ–ฅ์„ ์ฃผ๋Š”๊ฐ€? Windows ์ œ์–ดํŒ์—์„œ์ด ๊ธฐ๋Šฅ์„ ๋น„ํ™œ์„ฑํ™” ํ•  ์ˆ˜ ์žˆ๋‹ค (Windows ๋ฐฉํ™”๋ฒฝ์— ๋‹ค๋ฅธ ํ”„๋กœํ•„์ด ์žˆ์Œ์„ ๊ธฐ์–ตํ•˜๊ณ , ๋ชจ๋‘ ๋น„ํ™œ์„ฑํ™”ํ•ด์•ผ ํ•จ). Visual Studio๋ฅผ ๋‹ค์‹œ ์‹œ์ž‘ํ•œ๋‹ค.

๋„ค ๋ฒˆ์งธ ํ™•์ธ์‚ฌํ•ญ: ๋ผ์šฐํ„ฐ๊ฐ€ ํ†ต์‹ ์„ ๋Š๊ณ  ์žˆ๋Š”๊ฐ€? ๋ช‡ ๊ฐ€์ง€ ํ•ด๊ฒฐ์ฑ…: ๋ผ์šฐํ„ฐ์— ๋กœ๊ทธ์ธํ•˜๊ณ  ๋ชจ๋“  ์ข…๋ฅ˜์˜ ๋ฐฉํ™”๋ฒฝ์„ ๋น„ํ™œ์„ฑํ™”ํ•œ๋‹ค. ๊ทธ๋ ‡๊ฒŒ ํ•  ์ˆ˜ ์—†๋‹ค๋ฉด ์ด๋”๋„ท ์ผ€์ด๋ธ”์„ ์‚ฌ์šฉํ•˜์—ฌ ๋‘ ์‹œ์Šคํ…œ์„ ์ง์ ‘ ์—ฐ๊ฒฐํ•˜์‹ญ์‹œ์˜ค. ๋™์ผํ•œ ์„œ๋ธŒ๋„ท(192.168.X.Y/255.255.255.0 ๋ฐ 192.168.X.Y+1/255.255.255.0)์„ ์ˆ˜๋™์œผ๋กœ ์…‹ํŒ…ํ•ด์•ผ ํ•œ๋‹ค.

'Error setting socket option'

์•„๋งˆ๋„ IGN_IP ๋ณ€์ˆ˜์—์„œ IP ์ฃผ์†Œ๋ฅผ ์ž˜๋ชป ์ž…๋ ฅํ–ˆ์„ ๊ฒƒ์ด๋‹ค.

The handsim simulator displays: 'NodeShared: no route to host'

์ด ์—๋Ÿฌ๋Š” ๋ฆฌ๋ˆ…์Šค ์‹œ๋ฎฌ๋ ˆ์ดํ„ฐ์—์„œ ์œˆ๋„์šฐ ์‹œ์Šคํ…œ์œผ๋กœ ๋‹ค์‹œ ์—ฐ๊ฒฐ๋˜์ง€ ์•Š๋Š”๋‹ค๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•œ๋‹ค. ์ด๊ฒƒ์€ ์œˆ๋„์šฐ ๋ฐฉํ™”๋ฒฝ์ด ์›์ธ์ผ ์ˆ˜ ์žˆ๋‹ค.

์†์ด ์‹œ๋ฎฌ๋ ˆ์ดํ„ฐ์—์„œ ์›€์ง์ด์ง€๋งŒ, ์ด์ƒํ•˜๊ณ  ๋ถ€๋“œ๋Ÿฝ์ง€ ์•Š๋‹ค

๋ฌด์„ ์—ฐ๊ฒฐ์„ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด, ์ง€์—ฐ์œผ๋กœ ์ธํ•œ ์—ฐ๊ฒฐ ์‹คํŒจ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋‹ค. ์œ ์„  ์—ฐ๊ฒฐ์„ ์‹œ๋„ํ•ด ๋ณด์•„๋ผ.

์œˆ๋„์šฐ ๋ฐฉํ™”๋ฒฝ ์งˆ๋ฌธ์—์„œ ์ž˜๋ชป๋œ ์˜ต์…˜(์ทจ์†Œ)์„ ์„ ํƒํ–ˆ๋‹ค

์˜ค๋ฅ˜๋กœ ์ธํ•ด ์ž˜๋ชป๋œ ๋‹จ์ถ”๋ฅผ ๋ˆ„๋ฅด๋ฉด ์œˆ๋„์šฐ ์ œ์–ดํŒ์—์„œ Windows ๋ฐฉํ™”๋ฒฝ ๊ณ ๊ธ‰ ๋ณด์•ˆ์œผ๋กœ ๋“ค์–ด๊ฐ€์„œ ์ธ๋ฐ”์šด๋“œ ๊ทœ์น™์œผ๋กœ ์ด๋™ํ•˜์—ฌ ConsoleApplication (๋˜๋Š” ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์— ์ค€ ์ด๋ฆ„) ์ด๋ฆ„์œผ๋กœ ๋ณด์•ˆ์„ ์ œ๊ฑฐ ํ•  ์ˆ˜ ์žˆ๋‹ค. ๋˜๋‹ค๋ฅธ ์˜ต์…˜์€ Solution Explorer window์— ๋‚˜ํƒ€๋‚˜๋Š” ํ”„๋กœ์ ํŠธ ์†์„ฑ ์ด๋ฆ„(์†”๋ฃจ์…˜ ์ด๋ฆ„์ด ์•„๋‹˜)์—์„œ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ ์ด๋ฆ„์„ ์ˆ˜์ •ํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ํ”„๋กœ์ ํŠธ๋ฅผ cleanํ•˜๊ณ  ๋‹ค์‹œ ๋นŒ๋“œํ•˜๊ณ  ๋‹ค์‹œ ์‹คํ–‰ํ•œ๋‹ค.

โš ๏ธ **GitHub.com Fallback** โš ๏ธ