🐒B.1 Lifecycle Nodes and Bound
ROS 1 မှာတုန်းက node တွေတော့ရေးခဲ့တာပဲ။ ဒါပေမဲ့ node တွေဆိုတာက သူ့ဟာသူ publish/ subscribe လုပ်နေတာဖြစ်ပြီး runtime မှာ ကျတော်တို့ အပြည့်အဝ ထိန်းချုပ်လို့မရပါဘူး။

ဒါကြောင့် node တွေကို ထိန်းချုပ်လိုတဲ့အခါ managed nodes အဖြစ် lifecycle Node တွေကို အသုံးပြုတာဖြစ်ပါတယ်။

ဒီမှာဆိုရင် ကျတော်တို့က talker node ကို runtime မှာ ထိန်းချုပ်လို့ရတယ်ဗျ။
talker node သည် lifecycle node ကနေ inheriting ဖြစ်လာတာဖြစ်ပါတယ်။ သူ့ကို service တချို့နဲ့ control လုပ်လို့ရတယ်။ အဲ့တာကို state လို့ခေါ်ပါတယ်။ အဲ့ဒီ state တစ်ခုဆီမှာ အလုပ်လုပ်နိုင်တဲ့ service callback တစ်ခုဆီရှိပါတယ်။ ဆိုပါစို့ node က run နေတယ်။ သူ့ကို configure လုပ်ချင်ရင် node ကို configuration state ကို အလုပ်လုပ်ခိုင်းဖို့လိုတယ်။ on_configure() ဆိုတဲ့ callback method ကို execute လုပ်ခိုင်းတာပါပဲ။ အဲ့လိုခိုင်းဖို့ ကျတော်တို့က service client တော့ လုပ်ပေးရမှာပေါ့။
linstener node ကတော့ပုံမှန် node ပါပဲ။ rclcpp::Node ကနေပဲ inherit ဖြစ်တာ။ သို့ပေမဲ့သူ့မှာ subscription တစ်ခု ရှိနေသေးတယ်။ သူက lifecycle talker node ရဲ့ internal state ကို ရယူနိုင်တယ်။
service clien node သူကတော့ service clients နှစ်ခုပါတယ်။ တခုက lifecycle talker ရဲ့ state ကို ပြောင်းလဲဖို့ ဖြစ်ပြီး တစ်ခုကတော့ lifecycle talker ရဲ့ current state ကိုသိဖို့ပါပဲ။ lifecycle talker မှာက service server ပါရှိပြီးသားဖြစ်ပါတယ်။
အောက်က callee_script ကတော့ သာမာန် C++ function တစ်ခုပါ။ service client node ကို run ပြီး publisher node ကို ထိန်းချုပ်ဖို့အတွက်သုံးပါတယ်။
လက်တွေ့စမ်းကြည့်ကြမလား။ အဲ့ဒါကဆို နောက်တမျက်နှာကိုကြွ။
Last updated