Skip to content
Snippets Groups Projects
Commit 3762efa0 authored by holzheim's avatar holzheim
Browse files

Updated task

parent 4b68901f
Branches
No related tags found
No related merge requests found
%% Cell type:markdown id:1a932130-baf8-499d-b2a2-16ec25b2b6b2 tags: %% Cell type:markdown id:1a932130-baf8-499d-b2a2-16ec25b2b6b2 tags:
# Tutorial 1: Introduction to Python # Tutorial 1: Introduction to Python
In the first [exercise](https://git.rwth-aachen.de/introduction-to-robotics-course/introduction-to-robotics-2023/-/tree/main/01_IntroductionToPython) you got introduced to the fundamentals of `Python` (variables, data types, operators, decision structures, loops, functions and modules). In order to consolidate and extend the knowledge aquired, the following tutorial tasks should be solved / implemented. In the first [exercise](https://git.rwth-aachen.de/introduction-to-robotics-course/introduction-to-robotics-2023/-/tree/main/01_IntroductionToPython) you got introduced to the fundamentals of `Python` (variables, data types, operators, decision structures, loops, functions and modules). In order to consolidate and extend the knowledge aquired, the following tutorial tasks should be solved / implemented.
## Task 1.1 ## Task 1.1
The **forward_kinematics** function from the [forward_kinematics module](https://git.rwth-aachen.de/introduction-to-robotics-course/introduction-to-robotics-2023/-/blob/main/01_IntroductionToPython/forward_kinematics.py) is implemented for an manipulator of **n links** and **n+1 revolute joints** that starts from an **initial position** with all joint rotations $\theta=0$. The **forward_kinematics** function from the [forward_kinematics module](https://git.rwth-aachen.de/introduction-to-robotics-course/introduction-to-robotics-2023/-/blob/main/01_IntroductionToPython/forward_kinematics.py) is implemented for an manipulator of **n links** and **n+1 revolute joints** that starts from an **initial position** with all joint rotations $\theta_i=0$.
Implement a function named **fk_task_1** inside the [forward_kinematics module](https://git.rwth-aachen.de/introduction-to-robotics-course/introduction-to-robotics-2023/-/blob/main/01_IntroductionToPython/forward_kinematics.py) that ***returns*** a list which contains for each time step all joint coordinates $x_i$ and $y_i$ for a manipulator (**n links** and **n+1 revolute joints**) with an initial joint rotation that is described by the current rotations $\theta_{i,0}$ and the desired incremental joint rotations at time t $\Delta\theta_{i,t}$ for joint i. The base link is rotating around the given point $[x_0 = 0, y_0 = 1]$. Implement a function named **fk_task_1** inside the [forward_kinematics module](https://git.rwth-aachen.de/introduction-to-robotics-course/introduction-to-robotics-2023/-/blob/main/01_IntroductionToPython/forward_kinematics.py) that ***returns*** a list which contains for each time step all joint coordinates $x_i$ and $y_i$ for a manipulator (**n links** and **n+1 revolute joints**) with an initial joint rotation that is described by the current rotations $\theta_{i,t}$ for joint i at time t and the desired incremental joint rotations $\Delta\theta_{i,t+1}$ for joint i at time t + 1. The base link is rotating around the given point $[x_0 = 0, y_0 = 1]$.
Test the implemented function inside this jupyter notebook in the following cells. Use the given structure to Test the implemented function inside this jupyter notebook in the following cells. Use the given structure to
1. **Import** necessary modules. 1. **Import** necessary modules.
2. **Define** the **parameters** needed to test the 'fk_task_1' function. 2. **Define** the **parameters** needed to test the 'fk_task_1' function.
- base link coordinates $x_0$ and $y_0$ - base link coordinates $x_0$ and $y_0$
- link lengths $a_i=[1,1,1,1,1]$ - link lengths $a_i=[1,1,1,1,1]$
- initial joint roations $\theta_{i,t=0}=[90,0,0,0,0]$ in degree - initial joint roations $\theta_{i,t=0}=[90,0,0,0,0]$ in degree
- incremental change of joint rotation $\Delta\theta_{i,t=1} = [0,0,90,-30,45]$ - incremental change of joint rotation $\Delta\theta_{i,t=1} = [0,0,90,-30,45]$
3. **Call** the 'fk_task_1' **function** and save the return values under appropriate named variables. 3. **Call** the 'fk_task_1' **function** and save the return values under appropriate named variables.
4. **Create** a **plot** containing the initial manipulator position (red) and the position after incremental rotation (green). 4. **Create** a **plot** containing the initial manipulator position and the position after incremental rotation. Choose for each time step a different color.
**Hint:** Use the the data type [array](https://numpy.org/doc/stable/reference/arrays.ndarray.html) from the [numpy package](https://numpy.org/doc/stable/) to define define the variables which contains sequence of values. That allows you to use arithmetic operators directly on the variables. **Hints:**
- Use the the data type [array](https://numpy.org/doc/stable/reference/arrays.ndarray.html) from the [numpy package](https://numpy.org/doc/stable/) to define the variables which contain a sequence of values. That allows you to use arithmetic operators directly on the variables.
- To implement **fk_task_1** you can make use of already existing functions inside of the [forward_kinematics module](https://git.rwth-aachen.de/introduction-to-robotics-course/introduction-to-robotics-2023/-/blob/main/01_IntroductionToPython/forward_kinematics.py).
%% Cell type:code id:59a9ad77-e04e-40ac-83d6-2e379901020f tags: %% Cell type:code id:59a9ad77-e04e-40ac-83d6-2e379901020f tags:
``` python ``` python
# Use this cell to import the necessary modules # Use this cell to import the necessary modules
``` ```
%% Cell type:code id:2e47f84e-0363-4a6c-a148-41a4ef2614ea tags: %% Cell type:code id:2e47f84e-0363-4a6c-a148-41a4ef2614ea tags:
``` python ``` python
# Use this cell to define the gemoetry and rotation parameters # Use this cell to define the gemoetry and rotation parameters
``` ```
%% Cell type:code id:22db17d3-491b-480d-87ac-eff27acb3712 tags: %% Cell type:code id:22db17d3-491b-480d-87ac-eff27acb3712 tags:
``` python ``` python
# Use this cell to call the function 'fk_task_1' # Use this cell to call the function 'fk_task_1'
``` ```
%% Cell type:code id:c12897f2-b5d4-4f8c-9d22-0f9511780a23 tags: %% Cell type:code id:c12897f2-b5d4-4f8c-9d22-0f9511780a23 tags:
``` python ``` python
# Use this cell to plot the initial maniplator position and the position after incremental rotation # Use this cell to plot the initial maniplator position and the position after incremental rotation
``` ```
%% Output %% Output
%% Cell type:markdown id:6b0921a2-a094-429c-84f6-405e62f53c6b tags: %% Cell type:markdown id:6b0921a2-a094-429c-84f6-405e62f53c6b tags:
## Task 1.2 ## Task 1.2
After implementing the **fk_task_1** function and teststing it for one time step, respectively one increment, test the function now for several time steps. The goal is now to reach the rotation position $\theta_{i,1}$ from **Task 1.1** in 5 evenly spaced steps and generate one plot which contains the resulting configuration of the arm manipulator for all time steps. After implementing the **fk_task_1** function and teststing it for one time step, respectively one increment, test the function now for several time steps. The goal is now to reach the rotation position $\theta_{i,1}$ from **Task 1.1** in 5 evenly spaced steps and generate one plot which contains the resulting configuration of the arm manipulator for all time steps.
%% Cell type:code id:9dfed8f7 tags: %% Cell type:code id:9dfed8f7 tags:
``` python ``` python
# Calculation of the incremental rotation steps to reach the final rotation position # Calculation of the incremental rotation steps to reach the final rotation position
``` ```
%% Cell type:code id:1716ad7e tags: %% Cell type:code id:1716ad7e tags:
``` python ``` python
# Use this cell to call the function 'fk_task_1' # Use this cell to call the function 'fk_task_1'
``` ```
%% Cell type:code id:c698d670-1f83-4d34-9b96-4b1662878030 tags: %% Cell type:code id:c698d670-1f83-4d34-9b96-4b1662878030 tags:
``` python ``` python
# Plot here one plot which contains for each time step the corresponding arm manipulator position # Plot here one plot which contains for each time step the corresponding arm manipulator position
``` ```
%% Output %% Output
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment