স্থানাঙ্ক ও ঘূর্ণন
এই পাতা সম্পর্কেশেখার পথ · সূচিপত্র
রোবটকে কোথাও পাঠাতে দুটো জিনিস বলতে হয়: কোথায় যাবে (অবস্থান), আর সেখানে কোন দিকে মুখ করে থাকবে (দিক)। এই পাতায় একদম গোড়া থেকে শিখব, ধাপে ধাপে। আগে কিছু না জানলেও চলবে; যোগ-বিয়োগ পারলেই যথেষ্ট।
১. সংখ্যা দিয়ে জায়গা বোঝানো
বন্ধুকে যদি বলো “বলটা ওখানে”, সে বুঝবে না কোথায়। কিন্তু যদি বলো “দরজা থেকে ২ পা সামনে”, সে ঠিক খুঁজে পাবে। রোবটের বেলাতেও তাই: জায়গা বোঝাতে লাগে একটা শুরুর বিন্দু, আর সেখান থেকে কত দূর, সেই সংখ্যা।
- শুরুর বিন্দুতে সংখ্যা ০। এর নাম মূলবিন্দু।
- সামনের দিকে গেলে সংখ্যা + (যোগ)।
- উল্টো দিকে গেলে সংখ্যা − (বিয়োগ)। −২ মানে উল্টো দিকে ২।
রোবটের দূরত্ব মাপা হয় মিটারে (মি)। হিসাবে প্রায়ই দশমিক আসে: ০.৫ মি মানে আধা মিটার (৫০ সেমি), আর ০.১ মি মানে ১০ সেমি, মোটামুটি তোমার হাতের তালু যতটা চওড়া, ততটা।
- মূলবিন্দু
- যেখান থেকে মাপা শুরু হয়; সেখানে সব সংখ্যা ০।
- মিটার (মি)
- দৈর্ঘ্যের একক। ১ মিটার = ১০০ সেন্টিমিটার (সেমি), মোটামুটি বড় করে এক পা ফেলার মতো।
রোবট ০ থেকে +১.৫ মি গেল, তারপর −২ মি। শেষে কোথায়?
১.৫ − ২ = −০.৫। মানে শুরুর বিন্দু থেকে উল্টো দিকে আধা মিটার।
০.৩ মি কত সেন্টিমিটার?
৩০ সেমি। (১ মি = ১০০ সেমি, তাই ০.৩ মি = ৩০ সেমি।)
২. তিন দিক: x, y আর z
একটা সোজা রাস্তায় জায়গা বোঝাতে একটা সংখ্যাই যথেষ্ট। কিন্তু খেলার মাঠে লাগে দুটো: কতটা সামনে, আর কতটা পাশে। আর একটা ঘরের ভেতরে (বা মহাকাশ স্টেশনে, যেখানে রোবট ভেসে বেড়ায়) লাগে তিনটা: সামনে-পেছনে, পাশে, আর ওপরে-নিচে।
এই তিনটা দিকের নাম x, y আর z। প্রতিটা দিক বরাবর একটা সোজা রেখা কল্পনা করো; এই রেখাগুলোকে বলে অক্ষ। তিনটা সংখ্যা একসঙ্গে বন্ধনীর ভেতরে লেখা হয়: (x, y, z)। এগুলোই জায়গাটার স্থানাঙ্ক।
উদাহরণ: (৩, ২, ১) মানে মূলবিন্দু থেকে:
- x বরাবর ৩ মিটার,
- তারপর y বরাবর ২ মিটার,
- তারপর z বরাবর ১ মিটার।
জায়গার বেলায় কোন দিকে আগে যাচ্ছ, তাতে কিছু আসে-যায় না: যেকোনো ক্রমে গেলেও শেষে একই বিন্দুতে পৌঁছাবে। (মনে রেখো, ঘোরার বেলায় কিন্তু এটা খাটে না! ৭ নম্বর পাঠে দেখবে।)
- অক্ষ
- যে সোজা রেখা বরাবর মাপা হয়: x অক্ষ, y অক্ষ, z অক্ষ।
- স্থানাঙ্ক
- জায়গা বোঝানোর সংখ্যাগুলো, যেমন (৩, ২, ১)।
(০, ০, ০) কোথায়?
ঠিক মূলবিন্দুতে, যেখান থেকে মাপা শুরু।
(২, −১, ০)-তে যেতে y বরাবর কোন দিকে যাবে?
উল্টো দিকে ১ মিটার, কারণ y-এর সংখ্যাটা মাইনাস। আর z = ০, তাই ওপর-নিচে যেতে হবে না।
৩. Kibo-র ভেতরের দিকগুলো
Kibo হলো আন্তর্জাতিক মহাকাশ স্টেশনে জাপানের মডিউল: লম্বা নলের মতো একটা ঘর, ভেতরটা মোটামুটি একটা বাসের সমান। এর এক মাথায় রোবটের ডকিং স্টেশন, অন্য মাথায় এয়ারলক (বাইরে জিনিস পাঠানোর দরজা)।
Kibo-RPC-তে সব জায়গা মাপা হয় মিটারে, ডকিং স্টেশনের প্রায় গা ঘেঁষে থাকা একটা মূলবিন্দু থেকে। দিকগুলো এরকম:
- +x: লম্বালম্বি, এয়ারলকের দিকে (−x হলো ডকের দিক)।
- +y: EPS2 দেয়ালের দিকে (−y হলো উল্টো দিকের SAIBO দেয়াল)।
- +z: মেঝের দিকে (−z হলো ছাদ)।
খেয়াল করো: এখানে +z নিচের দিকে, মেঝের দিকে! অঙ্ক বইয়ের ছবিতে z সাধারণত ওপরে আঁকা থাকে, কিন্তু Kibo-RPC-তে এভাবেই ঠিক করা হয়েছে। এটা ভুলে গেলে রোবট উল্টো দিকে চলে যাবে।
উদাহরণ: AR মার্কার ৪ আছে (4.18, −1.00, 0.52)-এ। মানে মূলবিন্দু থেকে এয়ারলকের দিকে ৪.১৮ মি, SAIBO দেয়ালের দিকে ১ মি (কারণ y মাইনাস), আর মেঝের দিকে ০.৫২ মি।
মহাকাশে আসলে ওপর-নিচ বলে কিছু নেই; সবকিছু ভেসে থাকে। Kibo-র “মেঝে” আর “ছাদ” শুধু ভেতরের যন্ত্রপাতি সাজানোর সুবিধার জন্য দেওয়া নাম। মূলবিন্দু আর এই তিনটা দিক মিলিয়ে মাপার ব্যবস্থাটাকে বলে ফ্রেম; Kibo-RPC এর নাম দিয়েছে iss_body।
- ফ্রেম
- মাপার একটা ব্যবস্থা: একটা মূলবিন্দু আর তিনটা দিক। যেমন “ক্লাসরুমের ফ্রেম”: দরজা থেকে মাপা, সামনে বোর্ডের দিকে x।
iss_body- Kibo-RPC-তে Kibo-র ফ্রেমের নাম; এটা কখনো নড়ে না।
আরও গভীরে: ডান হাতের নিয়ম
অক্ষ তিনটা ডানহাতি: ডান হাতের বুড়ো আঙুল x বরাবর আর তর্জনী y বরাবর রাখো; মধ্যমা (আঙুলটা বাঁকিয়ে) দেখাবে z-এর দিক। JAXA-র ছবিগুলো দেখে স্যান্ডবক্স আর এই পাতা +z-কে মেঝে ধরেছে: প্রতিটা মার্কারের “ওপর” দিক −z বরাবর।
(১, ০, ০) বিন্দুটা মূলবিন্দু থেকে কোন দিকে?
এয়ারলকের দিকে ১ মিটার (+x)।
একটা জিনিসের z = −০.৫। সেটা মেঝের কাছে, না ছাদের কাছে?
ছাদের দিকে, কারণ −z হলো ছাদ।
৪. কোণ আর ডিগ্রি
রোবট কতটা ঘুরল, তা মাপা হয় ডিগ্রিতে (°)।
- পুরো এক পাক ঘুরলে ৩৬০°: আবার আগের দিকে মুখ।
- অর্ধেক পাক ১৮০°: একদম পেছন ফিরে।
- এক-চতুর্থাংশ পাক ৯০°: সোজা থেকে ডানে বা বাঁয়ে মুখ ফেরানো।
ঘড়ির বড় কাঁটা ১২ থেকে ৩-এ যেতে ঘোরে ৯০°, আর ১২ থেকে ৬-এ যেতে ১৮০°।
কোন দিকে ঘুরছে, তা বোঝাতে + আর − চিহ্ন দেওয়া হয়: + মানে এক দিকে, − মানে উল্টো দিকে। তাই −৯০° আর +২৭০° ঘুরলে শেষে একই দিকে মুখ থাকে: এক দিকে চার ভাগের এক পাক, বা উল্টো দিকে চার ভাগের তিন পাক।
৪৫° কত পাক?
আট ভাগের এক পাক (৩৬০ ÷ ৮ = ৪৫)।
৭২০° ঘুরলে রোবট কোন দিকে মুখ করে থাকবে?
যেদিকে ছিল, সেদিকেই। ৭২০° = দুই পাক।
৫. রোবটের নিজের সামনে, বাঁ আর ওপর
Kibo-র দিকগুলো কখনো বদলায় না। কিন্তু রোবট ঘোরে, আর তার সঙ্গে ঘোরে তার নিজের “সামনে”, “বাঁ” আর “ওপর”। ঠিক তোমার মতো: তুমি যেদিকেই ঘোরো, তোমার নাক সবসময় তোমার “সামনে”।
তাই কেউ যদি বলে “বাঁয়ে যাও”, আগে জানতে হবে কার বাঁ: ঘরের, না রোবটের নিজের? মুখোমুখি দাঁড়ানো দুজনের বাঁ দিক একদম উল্টো (ছবিটা দেখো)।
রোবটেরও নিজের তিনটা অক্ষ আছে, যেগুলো রোবটের সঙ্গে সঙ্গে ঘোরে। এদের লেখা হয় বড় হাতের অক্ষরে:
- X: রোবটের সামনে, যেদিকে ক্যামেরা তাকায়।
- Y: রোবটের বাঁ দিক।
- Z: রোবটের ওপরের দিক।
রোবটের এই ফ্রেমের নাম body (বডি, মানে শরীর)। রোবট যখন একদম না ঘুরে থাকে, তখন দুই ফ্রেম মিলে যায়: ক্যামেরা তাকায় এয়ারলকের দিকে (+x), আর রোবটের ওপরের দিক থাকে মেঝের দিকে (+z)। হ্যাঁ, তখন রোবট উল্টো হয়ে থাকে! মহাকাশে এতে কোনো সমস্যা নেই।
আরও গভীরে: /ctl/command কোন ফ্রেমে লক্ষ্য নেয়?
দুই ফ্রেমেই: MOVE_TO_ABSOLUTE_TARGET নেয় iss_body-তে (Kibo-র ফ্রেম), আর MOVE_TO_RELATIVE_TARGET নেয় body-তে (রোবটের ফ্রেম)। তাই রিলেটিভ চলায় “১ মি সামনে” মানে “রোবটের X বরাবর ১ মি”, রোবট যেদিকেই মুখ করে থাকুক।
রোবট এয়ারলকের দিকে মুখ করে আছে। সে “সামনে ১ মি” গেল। Kibo-র কোন দিকে গেল?
+x দিকে: এয়ারলকের দিকে ১ মিটার।
এবার রোবট EPS2 দেয়ালের দিকে মুখ ফেরাল। এখন “সামনে ১ মি” গেলে?
+y দিকে: EPS2 দেয়ালের দিকে ১ মিটার। আদেশ একই, কিন্তু রোবট ঘুরে আছে বলে অন্য দিকে গেল।
৬. তিন রকম ঘোরা: রোল, পিচ, ইয়
তোমার মাথা তিনভাবে ঘোরাতে পারো। এখনই করে দেখো:
- ইয় (yaw): “না” বলার মতো ডানে-বাঁয়ে মাথা নাড়ানো। রোবট ঘোরে তার Z অক্ষ (ওপর-নিচের রেখা) বরাবর, ক্যামেরা ডানে-বাঁয়ে সরে।
- পিচ (pitch): “হ্যাঁ” বলার মতো ওপর-নিচে মাথা নাড়ানো। রোবট ঘোরে তার Y অক্ষ (বাঁ-ডানের রেখা) বরাবর, ক্যামেরা ওপরে-নিচে তাকায়।
- রোল (roll): কাঁধের দিকে মাথা কাত করা। রোবট ঘোরে তার X অক্ষ (সামনে-পেছনের রেখা) বরাবর। তুমি একই দিকে তাকিয়ে থাকো, শুধু দেখা ছবিটা কাত হয়ে যায়।
নামগুলো এসেছে উড়োজাহাজ থেকে: রোল মানে এক ডানা নামিয়ে কাত হওয়া, পিচ মানে নাক ওপরে-নিচে, ইয় মানে নাক বাঁয়ে-ডানে।
Kibo-RPC-তে রোল খুব জরুরি। চেকপয়েন্টে ক্যামেরার ছবিতে মার্কারটা কতটা কাত হয়ে আছে, বিচারক সেটা মাপে। রোবট ঠিক জায়গায় থাকলেও রোল না মিললে লেভেল কমে যায়।
কোন ঘোরায় ক্যামেরা যেদিকে তাকিয়ে আছে, সেই দিক বদলায় না?
রোল। রোল করলে ক্যামেরা একই দিকে তাকিয়ে থাকে, শুধু ছবিটা কাত হয়।
ক্যামেরা দিয়ে ছাদের দিকে তাকাতে কোন ঘোরা লাগবে?
পিচ: “হ্যাঁ” বলার মতো মাথা নাড়ানো। কোন দিকে নাড়াতে হবে, তা নির্ভর করে রোবটের ওপরের দিক তখন কোথায় আছে তার ওপর (শুরুতে সেটা মেঝের দিকে!)।
এবার নিজে ঘুরিয়ে দেখো
নিচের সিমুলেটরে রোল, পিচ আর ইয়-এর স্লাইডার টেনে দেখো রোবট কীভাবে ঘোরে। X, Y, Z-এর − / + বোতাম চাপলে রোবট নিজের অক্ষ বরাবর ১৫° করে ঘোরে। তিনটা রঙিন তীর রোবটের নিজের অক্ষ: লাল X (ক্যামেরা), সবুজ Y, নীল Z। কোয়াটারনিয়নের সংখ্যাগুলো এখনই বুঝতে হবে না; সেগুলো ৮ নম্বর পাঠে আসছে।
Coordinates and rotations
About this pageLearning path · contents
To send the robot somewhere you have to say two things: where it should go (its position) and which way it should face there (its orientation). This page starts from the very beginning and goes one step at a time. You don't need to know anything first; adding and subtracting is enough.
1. Saying where with numbers
If you tell a friend "the ball is over there", they won't know where. But if you say "2 steps forward from the door", they'll find it. It's the same for a robot: to say where something is, you need a starting point and a number for how far from it.
- At the starting point the number is 0. It's called the origin.
- Going forward, the numbers are + (plus).
- Going the other way, they are − (minus). −2 means 2 the other way.
The robot's distances are in metres (m). You'll often see decimals: 0.5 m is half a metre (50 cm), and 0.1 m is 10 cm, about as wide as the palm of your hand.
- origin
- Where measuring starts; every number there is 0.
- metre (m)
- A unit of length. 1 metre = 100 centimetres (cm), about one big step.
The robot goes +1.5 m from 0, then −2 m. Where does it end up?
1.5 − 2 = −0.5. That's half a metre the other way from the start.
How many centimetres is 0.3 m?
30 cm. (1 m = 100 cm, so 0.3 m = 30 cm.)
2. Three directions: x, y and z
On a straight road, one number is enough to say where you are. On a playing field you need two: how far forward, and how far to the side. Inside a room (or a space station, where the robot floats around) you need three: forward and back, side to side, and up and down.
These three directions are called x, y and z. Imagine a straight line along each one; these lines are the axes. The three numbers are written together in brackets: (x, y, z). They are the place's coordinates.
Example: (3, 2, 1) means, starting from the origin:
- 3 metres along x,
- then 2 metres along y,
- then 1 metre along z.
For places, the order doesn't matter: go in any order and you end up at the same point. (Remember that, because for turns it isn't true! You'll see in lesson 7.)
- axis (axes)
- A straight line you measure along: the x axis, the y axis, the z axis.
- coordinates
- The numbers that say where something is, such as (3, 2, 1).
Where is (0, 0, 0)?
Right at the origin, where measuring starts.
To get to (2, −1, 0), which way do you go along y?
1 metre the other way, because the y number is minus. And z = 0, so no going up or down.
3. The directions inside Kibo
Kibo is Japan's module on the International Space Station: a long room shaped like a tube, with about as much space inside as a bus. The robot's docking station is at one end, and the airlock (a door for sending things outside) is at the other.
Kibo-RPC measures every place in metres from an origin right next to the docking station. The directions are:
- +x: along the module, toward the airlock (−x is toward the dock).
- +y: toward the EPS2 wall (−y is the SAIBO wall opposite).
- +z: toward the deck, the floor (−z is the overhead, the ceiling).
Careful: here +z points down, to the deck! Maths books usually draw z going up, but Kibo-RPC takes it this way. Forget it and your robot will fly the wrong way.
Example: AR marker 4 is at (4.18, −1.00, 0.52). From the origin that's 4.18 m toward the airlock, 1 m toward the SAIBO wall (because y is minus) and 0.52 m toward the deck.
In space there is no real up or down; everything floats. Kibo's "deck" and "overhead" are just names that make it easier to arrange the equipment inside. An origin together with three directions is called a frame; Kibo-RPC calls this one iss_body.
- frame
- A way of measuring: one origin and three directions. For example "the classroom frame": measured from the door, with x toward the board.
iss_body- The name of Kibo's frame in Kibo-RPC. It never moves.
Go deeper: the right-hand rule
The axes are right-handed: point your right thumb along x and your index finger along y; your middle finger (bent) shows z. The sandbox and this page take +z as the deck, reading JAXA's figures: every marker's "up" points along −z.
Which way from the origin is the point (1, 0, 0)?
1 metre toward the airlock (+x).
Something has z = −0.5. Is it near the deck or the overhead?
Toward the overhead, because −z is the overhead.
4. Angles and degrees
How far the robot turns is measured in degrees (°).
- A whole turn is 360°: you face the same way again.
- Half a turn is 180°: you face backwards.
- A quarter turn is 90°: from straight ahead to facing right or left.
The minute hand of a clock turns 90° from 12 to 3, and 180° from 12 to 6.
A + or − sign says which way: + is one way, − is the other. So −90° and +270° end up facing the same way: a quarter turn one way, or three quarters the other way.
What part of a turn is 45°?
One eighth (360 ÷ 8 = 45).
After turning 720°, which way does the robot face?
The same way as before. 720° is two whole turns.
5. The robot's own front, left and top
Kibo's directions never change. But the robot turns, and its own "front", "left" and "top" turn with it. Just like you: whichever way you turn, your nose is always at your "front".
So if someone says "go left", you first need to know whose left: the room's, or the robot's own? Two people facing each other have opposite lefts (see the picture).
The robot has three axes of its own, which turn with it. They're written with capital letters:
- X: the robot's front, where the camera looks.
- Y: the robot's left.
- Z: the robot's top.
The robot's frame is called body. When the robot hasn't turned at all, the two frames line up: the camera looks toward the airlock (+x) and the robot's top points to the deck (+z). Yes, the robot is upside down then! In space that's no problem.
Go deeper: which frame does /ctl/command use?
Both: MOVE_TO_ABSOLUTE_TARGET takes targets in iss_body (Kibo's frame), and MOVE_TO_RELATIVE_TARGET in body (the robot's frame). So in a relative move, "1 m forward" means "1 m along the robot's X", whichever way the robot faces.
The robot faces the airlock and goes "1 m forward". Which way does it move in Kibo?
Along +x: 1 metre toward the airlock.
Now the robot turns to face the EPS2 wall. Where does "1 m forward" take it?
Along +y: 1 metre toward the EPS2 wall. Same command, but the robot has turned, so it goes a different way.
6. Three kinds of turn: roll, pitch, yaw
You can turn your head in three ways. Try it now:
- Yaw: shaking your head side to side, like saying "no". The robot turns about its Z axis (the top-to-bottom line), and the camera swings left or right.
- Pitch: nodding up and down, like saying "yes". The robot turns about its Y axis (the left-to-right line), and the camera looks up or down.
- Roll: tilting your head toward a shoulder. The robot turns about its X axis (the front-to-back line). You keep looking the same way; only the picture you see tilts.
The names come from aeroplanes: roll is dipping one wing, pitch is the nose going up or down, yaw is the nose swinging left or right.
Roll really matters in Kibo-RPC. At a checkpoint, the judge measures how far the marker is tilted in the camera picture. Even in exactly the right place, the wrong roll lowers your level.
Which turn leaves the camera looking the same way?
Roll. When you roll, the camera keeps looking the same way; only the picture tilts.
Which turn do you need to look at the overhead with the camera?
Pitch, the "yes" nod. Which way to nod depends on where the robot's top points at the time (at the start it points to the deck!).
Now turn it yourself
In the simulator below, drag the Roll, Pitch and Yaw sliders and watch the robot turn. The X, Y and Z − / + buttons turn the robot 15° at a time about its own axes. The three coloured arrows are the robot's own axes: red X (the camera), green Y and blue Z. You don't need to understand the quaternion numbers yet; they come in lesson 8.
অয়লার কোণ ডিগ্রিতে, ROS-এর ক্রমেEuler angles degrees, ROS order
কোয়াটারনিয়ন ROS-এর ক্রম x, y, z, w · লিখে Enter চাপোQuaternion ROS order x, y, z, w · type and press Enter
রোবটের নিজের অক্ষ বরাবর ঘোরাও প্রতি চাপে ১৫°; অক্ষের ডগা থেকে তাকালে + মানে ঘড়ির কাঁটার উল্টো দিকেTurn about the robot's own axes 15° a press; + is anticlockwise looking down the axis
একটা পোজ চেষ্টা করোTry a pose
চ্যালেঞ্জ
ওপরের যেকোনো কন্ট্রোল ব্যবহার করো। পেরে গেলেই প্রতিটায় নিজে থেকে টিক পড়বে। আটকে গেলে ছোট লেখার ইঙ্গিতটা দেখো।
- ✓ক্যামেরা মেঝের দিকে তাক করো।ক্যামেরা হলো রোবটের X; মেঝে হলো +z (৩ নম্বর পাঠ)। পিচ স্লাইডারটা টেনে দেখো।
- ✓ক্যামেরা SAIBO দেয়ালের দিকে তাক করো।SAIBO দেয়াল হলো −y। ইয় স্লাইডারটা টেনে দেখো।
- ✓ক্যামেরা এয়ারলকের দিকে, আর রোবটের ওপরের দিক ছাদের দিকে।শুরুতে রোবটের ওপরের দিক থাকে মেঝের দিকে। কোন ঘোরায় ক্যামেরার দিক না বদলে ছবিটা উল্টে যায়? (৬ নম্বর পাঠ)
- ✓z বরাবর ৯০° ঘোরার কোয়াটারনিয়নটা নিজে লেখো।কোয়াটারনিয়নের ঘরগুলোতে চারটা সংখ্যা লিখে Enter চাপো। হিসাবের নিয়ম ৮ নম্বর পাঠে।
- ✓রোবট না নড়িয়ে w-কে মাইনাস করো।প্রতিটা দিক দুটো কোয়াটারনিয়ন দিয়ে লেখা যায় (৮ নম্বর পাঠ)।
৭. অয়লার কোণ: তিনটা ঘোরার সংখ্যা
“অয়লার” একজন মানুষের নাম: লিওনার্ড অয়লার, আঠারো শতকের সুইজারল্যান্ডের এক বিখ্যাত গণিতবিদ। অয়লার কোণ মানে সহজ কথায়: রোল, পিচ আর ইয়, এই তিনটা সংখ্যা দিয়ে রোবটের দিক বোঝানো।
উদাহরণ:
- (রোল ০°, পিচ ০°, ইয় ০°): কোনো ঘোরা নেই। ক্যামেরা এয়ারলকের দিকে।
- (রোল ০°, পিচ ০°, ইয় ৯০°): শুধু ৯০° ইয়। ক্যামেরা ঘুরে EPS2 দেয়ালের দিকে।
- (রোল ১৮০°, পিচ ০°, ইয় ০°): শুধু অর্ধেক পাক রোল। ক্যামেরা এখনো এয়ারলকের দিকে, কিন্তু রোবট উল্টে গেছে।
সিমুলেটরের তিনটা স্লাইডারই অয়লার কোণ। ROS (রোবটের সফটওয়্যার) আর এই পাতা এগুলো একটা নির্দিষ্ট ক্রমে প্রয়োগ করে: আগে রোল, তারপর পিচ, তারপর ইয়।
ক্রমটা গুরুত্বপূর্ণ
জায়গার বেলায় ক্রম বদলালে কিছু হয় না (২ নম্বর পাঠ), কিন্তু ঘোরার বেলায় হয়! একই দুটো ঘোরা অন্য ক্রমে করলে শেষ অবস্থা আলাদা হয়ে যায়।
একটা গোলমাল: গিম্বল লক
পিচ যদি ঠিক ৯০° হয় (ক্যামেরা সোজা ছাদের দিকে), তাহলে রোল আর ইয় একই কাজ করে ফেলে: দুটোই রোবটকে একই রেখা বরাবর ঘোরায়। তখন তিনটা সংখ্যার একটা কোনো কাজে আসে না। এর নাম গিম্বল লক। নিচের বোতাম চেপে দেখো।
অয়লার কোণ পড়তে সহজ, কিন্তু এই দুই ঝামেলার (ক্রম আর গিম্বল লক) জন্য রোবটের প্রোগ্রাম অন্য একটা উপায়ে দিক লেখে: কোয়াটারনিয়ন। সেটাই পরের পাঠ।
আরও গভীরে: কোন অক্ষ বরাবর ঘোরে?
ROS-এর নিয়মে রোল, পিচ আর ইয় প্রয়োগ হয় Kibo-র স্থির অক্ষ বরাবর (x, তারপর y, তারপর z)। একই ফল পাওয়া যায় উল্টো ক্রমে রোবটের নিজের অক্ষ বরাবর ঘোরালে: আগে ইয় (Z), তারপর নতুন Y বরাবর পিচ, তারপর নতুন X বরাবর রোল।
অয়লার কোণে কয়টা সংখ্যা থাকে?
তিনটা: রোল, পিচ আর ইয়।
দুটো ঘোরার ক্রম বদলালে কি শেষ অবস্থা একই থাকে?
সাধারণত না। এজন্যই ক্রমটা আগে থেকে ঠিক করে রাখা হয়।
৮. কোয়াটারনিয়ন: একটা ঘোরা, চারটা সংখ্যা
ধাপ ১: একটা ঘোরাই যথেষ্ট
একটা দরজার কথা ভাবো। দরজা ঘোরে কবজার রেখা বরাবর; কবজাটাই তার অক্ষ।
মজার কথা হলো, রোবট যত জটিলভাবেই ঘুরে থাকুক, শুরুর অবস্থা থেকে একটামাত্র ঘোরায় সেখানে পৌঁছানো যায়: কোনো একটা কাল্পনিক “কবজা” বরাবর, কিছু ডিগ্রি। তাই যেকোনো দিক বোঝাতে দুটো জিনিস বললেই চলে:
- কোন রেখা বরাবর ঘুরবে (অক্ষ),
- কতটা ঘুরবে (কোণ, এর নাম θ, পড়ো “থিটা”)।
সিমুলেটরের হলুদ রেখাটা সেই অক্ষ। ▶ ঘোরাটা চালাও চাপলে শুরু থেকে এখনকার অবস্থায় একটামাত্র ঘোরা দেখা যায়।
ধাপ ২: অক্ষ আর কোণকে চারটা সংখ্যায় ভরা
কোয়াটারনিয়ন এই অক্ষ আর কোণকে চারটা সংখ্যায় রাখে, নাম (x, y, z, w)। এর জন্য লাগে sin আর cos। এরা হলো ক্যালকুলেটরের দুটো বোতাম; এখন এদের পুরো মানে না জানলেও চলবে, নিচের টেবিল থেকে মান পড়ে নিলেই হবে।
| কোণ | sin | cos |
|---|---|---|
| ০° | 0 | 1 |
| ৩০° | 0.5 | 0.866 |
| ৪৫° | 0.7071 | 0.7071 |
| ৬০° | 0.866 | 0.5 |
| ৯০° | 1 | 0 |
রেসিপি (কোনো একটা অক্ষ বরাবর θ ঘোরার কোয়াটারনিয়ন):
- অক্ষটা ঠিক করো: x অক্ষ হলে (1, 0, 0), y অক্ষ হলে (0, 1, 0), z অক্ষ হলে (0, 0, 1)।
- কোণটাকে অর্ধেক করো: θ ÷ ২।
- অর্ধেক কোণের sin দিয়ে অক্ষের তিনটা সংখ্যা গুণ করো: এই তিনটাই x, y আর z।
- অর্ধেক কোণের cos হলো w।
উদাহরণ ১: z বরাবর ৯০°। অক্ষ (0, 0, 1)। অর্ধেক কোণ ৪৫°। sin ৪৫° = 0.7071, তাই অক্ষ × 0.7071 = (0, 0, 0.7071)। cos ৪৫° = 0.7071, তাই w = 0.7071। উত্তর: (0, 0, 0.7071, 0.7071)।
উদাহরণ ২: x বরাবর ১৮০°। অক্ষ (1, 0, 0)। অর্ধেক কোণ ৯০°। sin ৯০° = 1, তাই (1, 0, 0)। cos ৯০° = 0, তাই w = 0। উত্তর: (1, 0, 0, 0)।
উদাহরণ ৩: কোনো ঘোরা নেই। θ = ০°, অর্ধেকও ০°। sin ০° = 0, তাই (0, 0, 0)। cos ০° = 1, তাই w = 1। উত্তর: (0, 0, 0, 1)। মনে রেখো: “কোনো ঘোরা নেই” মানে চারটা শূন্য নয়, শেষেরটা ১!
ধাপ ৩: দুটো নিয়ম
- দৈর্ঘ্য সবসময় ১: চারটা সংখ্যার প্রতিটার বর্গ যোগ করলে ১ হয়: x² + y² + z² + w² = 1। পরীক্ষা করো: 0.7071² + 0.7071² = 0.5 + 0.5 = 1 ✓। সিমুলেটরে ভুল সংখ্যা লিখলে সে নিজেই মাপমতো ঠিক করে নেয়।
- q আর −q একই দিক: চারটা সংখ্যারই চিহ্ন উল্টে দিলে রোবট একটুও নড়ে না। কারণ এক দিকে θ ঘুরলে আর উল্টো দিকে ৩৬০° − θ ঘুরলে শেষে একই দিকে মুখ থাকে (৪ নম্বর পাঠ মনে করো)।
চারটা সংখ্যার ক্রম খেয়াল করো। ROS লেখে (x, y, z, w), w সবশেষে; রুলবুক, /mission/get_checkpoints আর স্যান্ডবক্সও তাই। কিছু লাইব্রেরি w আগে লেখে: যেমন Eigen-এর Quaterniond(w, x, y, z)। ক্রম গুলিয়ে ফেললে রোবট উল্টো দিকে ঘুরে যায়!
কোয়াটারনিয়নে গিম্বল লক হয় না, আর দুটো দিকের মাঝে মসৃণভাবে ঘোরানো যায় (এর নাম slerp)। এ কারণেই রোবট, ভিডিও গেম আর ROS কোয়াটারনিয়ন ব্যবহার করে।
আরও গভীরে: দুটো ঘোরা জোড়া দেওয়া
একটা দিক q-কে রোবটের নিজের অক্ষ বরাবর r পরিমাণ ঘোরাতে গুণ করো: q · r। Kibo-র অক্ষ বরাবর ঘোরাতে গুণ করো অন্য পাশ থেকে: r · q। কোয়াটারনিয়ন কখনো যোগ কোরো না। সিমুলেটরের X, Y, Z বোতামগুলো ১৫°-এর একটা ঘোরা দিয়ে q · r করে। অর্ধেক কোণ কেন লাগে, তার পেছনের গণিত একটু কঠিন; আপাতত নিয়মটা মনে রাখলেই চলবে।
(0, 0, 0, 1) মানে কী?
কোনো ঘোরা নেই: রোবটের অক্ষগুলো Kibo-র অক্ষের সঙ্গে মিলে আছে।
y বরাবর ৯০° ঘোরার কোয়াটারনিয়ন কী?
অক্ষ (0, 1, 0), অর্ধেক কোণ ৪৫°: (0, 0.7071, 0, 0.7071)।
z বরাবর ১৮০°?
অর্ধেক কোণ ৯০°, sin ৯০° = 1, cos ৯০° = 0: (0, 0, 1, 0)।
(0, 0, −0.7071, −0.7071) আর (0, 0, 0.7071, 0.7071) কি একই দিক?
হ্যাঁ। চারটারই চিহ্ন উল্টানো (−q), তাই রোবট একই দিকে মুখ করে থাকে।
৯. Kibo-RPC-তে কোথায় লাগে
- রোবটকে কোথাও পাঠানো:
/ctl/command-কে দিতে হয় একটা অবস্থান (x, y, z) আর একটা কোয়াটারনিয়ন (x, y, z, w), দুটোইiss_bodyফ্রেমে। এই দুটো মিলিয়ে বলে পোজ। - চেকপয়েন্ট:
/mission/get_checkpointsপ্রতিটা চেকপয়েন্টের অবস্থান আর দিক দেয়; দিকটা কোয়াটারনিয়ন হিসেবে। সিমুলেটরের CP 1 (ম্যানুয়াল) বোতাম চেপে দেখো: ওই পোজে ক্যামেরা SAIBO দেয়ালের মার্কার ১-এর দিকে তাকায়। - রোল মেলানো: চেকপয়েন্টে বিচারক দেখে ক্যামেরার ছবিতে মার্কার কতটা কাত, মানে ক্যামেরার অক্ষ (রোবটের X) বরাবর রোল। এখানে X − / + বোতাম, আর স্যান্ডবক্সে ⟲ / ⟳ বোতাম ঠিক এটাই করে।
- ক্যামেরার নিজের অক্ষ: ক্যামেরার ছবির হিসাবে (OpenCV) x ডানে, y নিচে, আর z লেন্স থেকে সোজা বাইরে। এর কথা আছে নিয়মের গাইডে।
ওড়ার জন্য তৈরি? এবার খেলার নিয়ম পড়ো (শেখার পথের ৩ নম্বর ধাপ), বা সরাসরি স্যান্ডবক্সে গিয়ে কোনো ওয়েপয়েন্টের দিক “নিজের কোয়াটারনিয়ন” করে নিজে সংখ্যা লিখে দেখো।
শব্দকোষ
- মূলবিন্দু
- যেখান থেকে মাপা শুরু; সেখানে সব সংখ্যা ০। (পাঠ ১)
- অক্ষ
- যে সোজা রেখা বরাবর মাপা হয়, বা যে রেখা বরাবর কিছু ঘোরে। (পাঠ ২)
- স্থানাঙ্ক
- জায়গা বোঝানোর তিনটা সংখ্যা (x, y, z)। (পাঠ ২)
- ফ্রেম
- মূলবিন্দু আর তিনটা দিক মিলিয়ে মাপার ব্যবস্থা।
iss_bodyহলো Kibo-র,bodyহলো রোবটের। (পাঠ ৩, ৫) - ডিগ্রি (°)
- ঘোরার মাপ; এক পাক = ৩৬০°। (পাঠ ৪)
- রোল, পিচ, ইয়
- তিন রকম ঘোরা: কাত হওয়া, ওপর-নিচে তাকানো, ডানে-বাঁয়ে ঘোরা। (পাঠ ৬)
- অয়লার কোণ
- রোল, পিচ আর ইয় দিয়ে দিক লেখা। (পাঠ ৭)
- গিম্বল লক
- পিচ ৯০° হলে রোল আর ইয় একই কাজ করে ফেলে। (পাঠ ৭)
- কোয়াটারনিয়ন
- চারটা সংখ্যায় (x, y, z, w) লেখা একটা ঘোরা: অক্ষ আর কোণ। (পাঠ ৮)
- পোজ
- অবস্থান আর দিক একসঙ্গে: রোবট কোথায়, আর কোন দিকে মুখ করে। (পাঠ ৯)
Challenges
Use any control above. Each one ticks itself when you get it. If you're stuck, read the small hint.
- ✓Point the camera at the deck.The camera is the robot's X; the deck is +z (lesson 3). Try the Pitch slider.
- ✓Point the camera at the SAIBO wall.The SAIBO wall is −y. Try the Yaw slider.
- ✓Camera toward the airlock, and the robot's top toward the overhead.At the start the robot's top points to the deck. Which turn flips the picture without changing where the camera looks? (lesson 6)
- ✓Type the quaternion for a 90° turn about z yourself.Type four numbers in the quaternion boxes and press Enter. How to work them out is in lesson 8.
- ✓Make w negative without moving the robot.Every orientation can be written with two quaternions (lesson 8).
7. Euler angles: three numbers for three turns
"Euler" (say "OY-ler") is a person's name: Leonhard Euler, a famous Swiss mathematician from the 1700s. “Euler angles” simply means saying which way the robot faces with three numbers: roll, pitch and yaw.
Examples:
- (roll 0°, pitch 0°, yaw 0°): no turn. The camera looks toward the airlock.
- (roll 0°, pitch 0°, yaw 90°): only a 90° yaw. The camera turns to the EPS2 wall.
- (roll 180°, pitch 0°, yaw 0°): only a half-turn roll. The camera still looks toward the airlock, but the robot is flipped over.
The simulator's three sliders are Euler angles. ROS (the robot's software) and this page always use them in the same order: roll first, then pitch, then yaw.
The order matters
For places the order makes no difference (lesson 2), but for turns it does! The same two turns in a different order end in a different pose.
A problem: gimbal lock
If the pitch is exactly 90° (the camera looks straight at the overhead), roll and yaw do the same job: both spin the robot about the same line. Then one of the three numbers is wasted. This is called gimbal lock. Press the button to see it.
Euler angles are easy to read, but because of these two problems (order and gimbal lock), robot programs write orientations another way: as a quaternion. That's the next lesson.
Go deeper: which axes do they turn about?
In ROS, roll, pitch and yaw are applied about Kibo's fixed axes (x, then y, then z). You get the same result turning about the robot's own axes in the opposite order: yaw about Z first, then pitch about the new Y, then roll about the new X.
How many numbers are in Euler angles?
Three: roll, pitch and yaw.
If you swap the order of two turns, do you end up the same?
Usually not. That's why the order is fixed in advance.
8. Quaternions: one turn, four numbers
Step 1: one turn is enough
Think of a door. A door turns about the line of its hinges; the hinge line is its axis.
Here's the surprising part: however complicated the robot's turning has been, it can get from its start to where it is now with a single turn, about one imaginary "hinge", by some number of degrees. So to describe any orientation you only need to say two things:
- which line it turns about (the axis),
- how far it turns (the angle, called θ, said "theta").
The yellow line in the simulator is that axis. ▶ Play the turn shows the single turn from the start to the robot's pose now.
Step 2: packing the axis and angle into four numbers
A quaternion stores the axis and the angle in four numbers, called (x, y, z, w). For this you need sin and cos. They are two buttons on a calculator; you don't need to know exactly what they mean yet, just read the values from this table.
| Angle | sin | cos |
|---|---|---|
| 0° | 0 | 1 |
| 30° | 0.5 | 0.866 |
| 45° | 0.7071 | 0.7071 |
| 60° | 0.866 | 0.5 |
| 90° | 1 | 0 |
The recipe (the quaternion for a turn of θ about one axis):
- Pick the axis: (1, 0, 0) for the x axis, (0, 1, 0) for y, (0, 0, 1) for z.
- Halve the angle: θ ÷ 2.
- Multiply the axis's three numbers by the sin of the half angle: these are x, y and z.
- The cos of the half angle is w.
Example 1: 90° about z. Axis (0, 0, 1). Half the angle is 45°. sin 45° = 0.7071, so axis × 0.7071 = (0, 0, 0.7071). cos 45° = 0.7071, so w = 0.7071. Answer: (0, 0, 0.7071, 0.7071).
Example 2: 180° about x. Axis (1, 0, 0). Half the angle is 90°. sin 90° = 1, giving (1, 0, 0). cos 90° = 0, so w = 0. Answer: (1, 0, 0, 0).
Example 3: no turn. θ = 0°, and half of it is 0° too. sin 0° = 0, giving (0, 0, 0). cos 0° = 1, so w = 1. Answer: (0, 0, 0, 1). Remember: "no turn" isn't four zeros; the last number is 1!
Step 3: two rules
- The length is always 1: square each of the four numbers and add them up, and you get 1: x² + y² + z² + w² = 1. Check: 0.7071² + 0.7071² = 0.5 + 0.5 = 1 ✓. If you type numbers that break this rule, the simulator scales them to fit.
- q and −q are the same orientation: flip the signs of all four numbers and the robot doesn't move at all. That's because turning θ one way ends up where turning 360° − θ the other way does (remember lesson 4).
Watch the order of the four numbers. ROS writes (x, y, z, w), with w last, and so do the Rulebook, /mission/get_checkpoints and the sandbox. Some libraries put w first, such as Eigen's Quaterniond(w, x, y, z). Mix up the order and your robot turns the wrong way!
Quaternions never get gimbal lock, and you can turn smoothly between two of them (this is called slerp). That's why robots, video games and ROS use them.
Go deeper: combining two turns
To turn an orientation q by a turn r about the robot's own axes, multiply: q · r. To turn it about Kibo's axes, multiply on the other side: r · q. Never add quaternions. The simulator's X, Y and Z buttons do q · r with a 15° turn. Why the half angle? The maths behind it is harder; for now, just remember the rule.
What does (0, 0, 0, 1) mean?
No turn: the robot's axes line up with Kibo's.
What's the quaternion for 90° about y?
Axis (0, 1, 0), half angle 45°: (0, 0.7071, 0, 0.7071).
And 180° about z?
Half angle 90°, sin 90° = 1, cos 90° = 0: (0, 0, 1, 0).
Are (0, 0, −0.7071, −0.7071) and (0, 0, 0.7071, 0.7071) the same orientation?
Yes. All four signs are flipped (−q), so the robot faces the same way.
9. Where Kibo-RPC uses them
- Sending the robot somewhere:
/ctl/commandneeds a position (x, y, z) and a quaternion (x, y, z, w), both in theiss_bodyframe. The two together are called a pose. - Checkpoints:
/mission/get_checkpointsgives each checkpoint's position and orientation, with the orientation as a quaternion. Press CP 1 (manual) in the simulator: in that pose the camera looks at marker 1 on the SAIBO wall. - Matching the roll: at a checkpoint the judge checks how tilted the marker is in the camera picture: the roll about the camera's axis (the robot's X). The X − / + buttons here, and the ⟲ / ⟳ buttons in the sandbox, do exactly that.
- The camera's own axes: for the camera picture (OpenCV), x is right, y is down and z points straight out of the lens. The rules guide has more.
Ready to fly? Read the game's rules next (step 3 on the learning path), or go straight to the sandbox, set a waypoint's orientation to "Custom quaternion" and type the numbers yourself.
Word list
- origin
- Where measuring starts; every number there is 0. (lesson 1)
- axis
- A straight line you measure along, or that something turns around. (lesson 2)
- coordinates
- The three numbers (x, y, z) that say where something is. (lesson 2)
- frame
- An origin and three directions to measure with.
iss_bodyis Kibo's,bodyis the robot's. (lessons 3 and 5) - degree (°)
- How far something turns; one whole turn is 360°. (lesson 4)
- roll, pitch, yaw
- Three kinds of turn: tilting, looking up or down, swinging left or right. (lesson 6)
- Euler angles
- Writing an orientation as roll, pitch and yaw. (lesson 7)
- gimbal lock
- At 90° of pitch, roll and yaw do the same job. (lesson 7)
- quaternion
- A turn written as four numbers (x, y, z, w): an axis and an angle. (lesson 8)
- pose
- A position and an orientation together: where the robot is and which way it faces. (lesson 9)