Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscriber 블럭의 함수 sleep 사용시 죽는 문제 #34

Open
dwlee opened this issue Jun 12, 2015 · 0 comments
Open

Subscriber 블럭의 함수 sleep 사용시 죽는 문제 #34

dwlee opened this issue Jun 12, 2015 · 0 comments

Comments

@dwlee
Copy link
Collaborator

dwlee commented Jun 12, 2015

다음과 같은 블럭 구조에서 sleep 사용시

engine-21394 Error: Can't wait without a fiber

가 발생한다.
이 현상은 subscriber 블럭에서 callback function을 등록하는 함수가 수행될때는 전체 엔진을 감싼 Fiber 와는 별개로 동작하는것 같습니다.
만약 subscriber 블럭에 sleep 블럭이 들어가야 한다면 function(){Fiber(){ ... }).run()과 같은 형식으로 묶어야 할것 같습니다.

  • subscriber 블럭 코드
  $engine.subscribe('/beacons', 'std_msgs/String', function(item) {
            $engine.print("Rocon Authoring :" + JSON.stringify(String드드('[Welcome] Subscribe Beacons: ') + String(item['data'])));
            if (item['data'] == 'D0:39:72:A3:DE:75') {
                if (isworking_robosem == false) {
                    isworking_robosem = true;
                    $engine.socketBroadcast('/prezi', 'prezi:office_prezi:move', {
                        step: 5
                    });
                    welcome(g_robosem_res, g_room_checker_res, g_door_opener_res);
                }
            }
        });
  • welcome 함수 블럭
function welcome(robosem, room_checker, door_opener) {
            UDF_set_light([3, 1, 2], 'WHITE', null, null, 'WHITE');
}          
  • UDF_set_light 함수 블럭
 function UDF_set_light(light_ids, color) {
            if (g_hue_res != null) {
                for (var count = 0; count < 2; count++) {
                    for (var light_id_index in light_ids) {
                        light_id = light_ids[light_id_index];
                        set_hue_color(g_hue_res, light_id, color);
                        $engine.sleep(400);
                    }
                }
            } else {
                $engine.print("Rocon Authoring :" + JSON.stringify('[Common Func] Resource Allocation Failure'));
            }
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant