1. Homepage
  2. Programming
  3. CS 460 INTRO TO COMPUTATIONAL ROBOTICS FALL 2023 Assignment 1: 2D Collision Checking, Navigation and Movement

CS 460 INTRO TO COMPUTATIONAL ROBOTICS FALL 2023 Assignment 1: 2D Collision Checking, Navigation and Movement

Engage in a Conversation
RutgersCS 460CS460INTRO TO COMPUTATIONAL ROBOTICS2D Collision CheckingCollision-free NavigationCollision-free MovementPython

CS 460: INTRO TO COMPUTATIONAL ROBOTICS FALL 2023 CourseNana.COM

Assignment 1
(100 pts is the perfect score - 10% of the course credit) CourseNana.COM

Deadline: Sunday, October 8, 23:59 PM CourseNana.COM

Submission Process: You are asked to upload a zip file on Canvas containing all necessary files of your submission. Only 1 student per team needs to upload a submission. CourseNana.COM

You should create a top-level folder named with your NETID, (e.g., xyz007-abc001 for teams of 2 students or just xyz007 for students working independently). Include at least the following files by following this folder structure: CourseNana.COM

xyz007-abc001/create_scene.py (p1)
xyz007-abc001/collision_checking.py (p2)
xyz007-abc001/2d_rigid_body.py (p3)
xyz007-abc001/2d_rigid_body_animation.gif/mp4 (p3) xyz007-abc001/planar_arm.py (p4)
xyz007-abc001/planar_arm_animation.gif/mp4 (p4)
xyz007-abc001/report.pdf CourseNana.COM

Please zip this xyz007-abc001 folder and submit the xyz007-abc001.zip on Canvas. You can also create a utils.py file that contains helper functions under the xyz007-abc001 folder. CourseNana.COM

On the first page of the report’s PDF indicate the name and Net ID of the students in the team (up to 2 students).
Extra Credit for LATEX: You will receive 6% extra credit points if you submit your answers as a typeset PDF, i.e., one generated using LaTeX. For typeset reports in LaTeX, please also submit your .tex source file together with the report, e.g., by adding a report.tex file under the xyz007-abc001 folder. There will be a 3% bonus for electronically prepared answers (e.g., using MS Word, etc.) that are not typeset. Remember that these bonuses are computed as a percentage of your original grade, i.e., if you were to receive 50 points and you have typeset your report using LaTeX, then you get a 3-point bonus. If you want to submit a handwritten report, scan it or take photos of it and submit the corresponding PDF as part of the zip file on Canvas. You will not receive any bonus in this case. For your reports, do not submit Word documents, raw ASCII text files, or hardcopies etc. If you choose to submit scanned handwritten answers and we cannot read them, you will not be awarded any points for the unreadable part of the solution. CourseNana.COM

Failure to follow the above rules may result in a lower grade on the assignment. CourseNana.COM

Requirements: Standard Python libraries are allowed. Additionally, Numpy, Scipy and Matplotlib can be used. Please use the following script to build your Python environment under conda. CourseNana.COM

Setup python environment CourseNana.COM

#!/bin/bash CourseNana.COM

conda create -n cs460 python=3.10.12 numpy=1.25.2 matplotlib=3.7.2 scipy=1.11.2 -y conda activate cs460
# run your code from here CourseNana.COM

This python environment will be used for all assignments. We expect to run your code on ilab. If we cannot run your code in the python environment as described above, then 0 credits will be awarded for the programming tasks. CourseNana.COM

Note that the following two assignments will build on top of the infrastructure of the first one. So take some care with the code you develop. It should be clean, modular and reusable. For all of your assignments, consider that the units are meters and radians. CourseNana.COM

1 Generate, visualize & store 2D polygonal scenes (20 pts) CourseNana.COM

Your software should be able to generate scenes with sets of convex polygons for testing. It should also be possible to visualize them as well as load/store them via files. CourseNana.COM

Build a script that can generate files that are similar to the example provided to you (e.g., "collision_checking_polygons.npy"). Make sure that your script has the ability to receive as input: i) the total number of polygons in the scene P, ii) the minimum number of vertices Nmn, iii) the maximum number of vertices Nm, iv) the minimum "radius" rmn, and v) the maximum "radius" of the polygon rm. CourseNana.COM

Here is a possible strategy for generating a convex polygon but you can also follow your own strategy: CourseNana.COM

  • Sample uniformly at random coordinates (center , ycenter ), which will correspond to the center of the polygon. CourseNana.COM

  • Sample the number N of vertices of the polygon by uniformly sampling in the range [Nmn, Nm]. CourseNana.COM

  • For each vertex n of the N vertices, sample uniformly at random an angle αn in the range of [ 0, . . . , 360] degrees. Then, generate the coordinates of the N vertices by placing them on a circle centered at (center , ycenter ) with radius rmn and at the angle αn. CourseNana.COM

  • For each vertex, also uniformly sample a number r in the range [0, rm rmn]. Extrude each vertex outward from the center (center , ycenter ) by moving it away by the value r. CourseNana.COM

  • For each vertex, use the sign of the cross product between each pair of adjacent vertices and the origin to determine convexity. If a vertex makes your polygon non-convex, then remove it. Iterate over all of your vertices until the polygon is convex or you are down to 3 vertices, where convexity is guaranteed. CourseNana.COM

  • Alternatively for the last step you could also compute the convex hull of the N sampled vertices by using the "convexHull" function from scipy (scipy.spatial.ConvexHull). CourseNana.COM

    Consider that your polygonal map is defined in a continuous space of dimensions 2m × 2m, i.e., the coordinates of the vertices should be represented in this continuous space. You should be able to visualize the corresponding map. For this you will have to pick a resolution and select the size of your visualization, e.g., 800pixels x 800pixels that will represent the 2m × 2m polygonal map. CourseNana.COM

    Polygons can be represented using numpy arrays, which will allow you to store the vertices of the polygons. You should then be able to store the corresponding files as well as load them. CourseNana.COM

    In your report provide the following: CourseNana.COM

    • 4 examples of maps that you have generated and the corresponding parameters you used for the generation of these maps. Use different parameters for the 4 different maps and discuss the choice of your parameters in the resulting environments you generated, i.e., try to generate some maps that are dense with obstacles and some that are sparse. CourseNana.COM

    • A visualization of one additional map, which you have manually constructed, where you use convex polygons to form two letters inside the space. These two letters should correspond to the first letter of the first name of each team member (or the first letters of the first and last name for students working individually). You do not have to spend much time here to make CourseNana.COM

the letters accurately represented and the convex polygons perfectly aligned. As long as the letters are recognizable when visualized, this is sufficient. See example Fig. 1 for letter “E”. CourseNana.COM

Describe the exact approach you followed in order to generate the convex polygons. If you followed the above mentioned strategy describe the operations you performed so as to i) rotate each polygon, ii) extrude vertices and iii) how you determine/enforce the convexity of each polygon. If you deviated from the above strategy indicate so and explain your choices. CourseNana.COM

Figure 1: Letter example. CourseNana.COM

2 2D collision checking for convex polygons (20 pts + 10 points for efficient implementation) CourseNana.COM

You should implement an approach in your software for detecting whether two polygons collide with each other. For this component of this assignment attach a figure like the one shown in Fig. 2 in your report for all the maps generated as part of component 1 of the assignment. Fig. 2 gives you an example of how your polygonal scenes can look like in general. Plot polygons to be filled if there is a collision with other polygons or boundary unfilled otherwise. Save the figure and put it in the report. When you plot figures, please use CourseNana.COM

    fig, ax = plt.subplots(dpi=100)
    ax.set_aspect(’equal’)

Save all your code in collision_checking.py. You have two functions. CourseNana.COM

collides(poly1: np.ndarray, poly2: np.ndarray) plot(polys: np.ndarray) CourseNana.COM

Your report should also describe how you implemented your collision checking approach. It is ok to execute an exhaustive approach where you: a) check all pairs of line segments between the two polygons for collisions and b) check whether any of the vertices of one polygon are inside the other. Discuss any attempts you made in order to speed up the polygonal collision checking code relative to the exhaustive approach (the 10 points for efficient implementation). Report how much faster is the code due to your changes by evaluating the code on the 5 scenes from part 1. CourseNana.COM

It should be possible for the TAs to check whether your software returns a correct result for a polygonal scene of their choice. For this reason, make sure that your software uses the following code in order to load an input file for collision checking: CourseNana.COM

polygons = np.load(’collision_checking_polygons.npy’, allow_pickle=True) CourseNana.COM

The TAs will store a different set of polygons during grading inside the "collision_checking_polygons.npy" file than the one shown in Fig. 2 to evaluate the correctness of the software. CourseNana.COM

Figure 2: Collision checking example. CourseNana.COM

3 Collision-free Navigation for a 2D rigid body (30 pts) CourseNana.COM

Implement an environment in where you can move a rectangular object among a set of convex polygons without collisions. This rectangle will be controlled as a car in assignment 2, so make sure that your code is clean and reusable. CourseNana.COM

  • Load a map (2 × 2m2) using the following code inside your software: polygons = np.load(’2d_rigid_body.npy’, allow_pickle=True) CourseNana.COM

    You can test different scenes by renaming them as "2d_rigid_body.npy" (the TAs will use a different scene other than the one shown in Fig. 3). Create a rectangular polygon (with dimensions: 0.2×0.1m2) as a 2D rigid body and initialize it in a random collision-free position and orientation. Treat the boundary of the 2m × 2m region as obstacles. CourseNana.COM

  • Use the keyboard to control the rectangle: (i) forward/backward motion along the long axis of the rectangle, and (ii) clockwise and counterclockwise rotation about the center. Include in the report which 4 keys you have assigned to the corresponding control (e.g., up/down, left/right arrows). CourseNana.COM

  • Make use of your collision checking code from the previous step so as to avoid the rectan- gular object penetrating the convex polygonal obstacles. In particular, every time that the keyboard command would result in a motion that leads to a collision, the rectangle should be returned to its previous collision-free position and orientation. The example video didn’t have the “avoid penetrating” function but gives a general example of when collision will be detected. CourseNana.COM

  • Generate animations on your maps that show that you can move the rectangle from a random collision-free configuration to another collision-free part of the scene using keyboard control in a collision-free manner. Save your animations in .gif or .mp4 format (you can use an external recording tool, keep file size less than 1MB, for example, ScreenToGif). CourseNana.COM

  • Compute and visualize the collision-free configuration space of the rectangular object for the 5 different scenes you generated in part 1 of this assignment. Fig. 3 (right) provides an CourseNana.COM

example of this computation for the scene shown in Fig. 3 (left). Do so for three different orientations of the rectangle, 0o as shown in Fig. 3, 45o and 90o. Use for computation the Minkowski sum operation. Include the corresponding visualizations in your report. CourseNana.COM

Figure 3: Rectangular object collision-free example. You don’t need to draw the rectangle object in the right figure; this is just to illustrate that obstacles have been “expanded” based on the rectangle. CourseNana.COM

4 Collision-free Movement of a Planar Arm (30 pts) CourseNana.COM

Implement an environment in where you can move a planar 2-link arm among a set of convex polygons without collisions. CourseNana.COM

  • You should be able to load your polygonal scenes and create an arm with two rectangular polygons and two joints inside them. The length between joint 1 and joint 2 should be 0.4m, and the length between joint 1 and joint 2 should be 0.25m. The width of the rectangles should be 0.1m. The joints correspond to circles of radius 0.05m. The first joint is fixed at coordinates [1,1]. Initialize your arm so that both joint angles are at 0 degrees, i.e., the arm points to the right. At this configuration detect all of the polygons that the arm is colliding with and remove them from the scene. Plot the rest of the convex polygons and the arm using matplotlib. The links should touch the joints, see Figure 4 for an example. Provide visualizations of the corresponding scenes in your report. CourseNana.COM

  • Use the keyboard to control the two joints individually (you can achieve unlimited rotation with each joint). Indicate in your report what keys you used in order to control the arm. CourseNana.COM

  • Make use of your collision checking code from step 2 of the assignment so as to avoid the robotic arm penetrating the convex polygonal obstacles remaining in the scene. In particular, every time that the keyboard command would result in a motion that leads to a collision, the arm should be returned to its previous collision-free position and orientation. The example video didn’t have the “avoid penetrating” function but gives a general example of when a collision will be detected, and the workspace in this example is different from this assignment. CourseNana.COM

  • Generate animations on your maps that show that you can move the planar arm from the initial collision-free configuration to other collision-free configuration using keyboard control CourseNana.COM

in a collision-free manner. Save your animations in .gif or .mp4 format (you can use an external recording tool, keep file size less than 1MB, for example, ScreenToGif). CourseNana.COM

Compute and visualize the collision-free configuration space for the planar arm by discretizing each joint angle with a resolution of 2π/100 in the range of [π,π]. See Fig. 4 (right) for an example. A 100x100 occupancy grid is generated where each cell corresponds to values for the two joint angles. The x-axis is the first joint angle and the y-axis is the second one. The yellow color corresponds to collisions with polygonal obstacles in the scene. You do not need to consider self-collision of arm for this part of the assignment. For this plot, please use provided map: CourseNana.COM

polygons = np.load(’arm_polygons.npy’, allow_pickle=True) CourseNana.COM

Figure 4: Arm collision-free example. CourseNana.COM

CourseNana.COM

Collusion, Plagiarism, etc.: Each team must prepare their solutions independently from others, i.e., without using common code, notes or worksheets with other students. You can discuss material about the class that relates to the assignment but you should not be provided the answers by other students and you must code your own solutions as well as prepare your own reports separately. CourseNana.COM

Furthermore, you must indicate at the end of your report any external sources you have used in the preparation of your solution. This includes both discussions with other students and online sources. Unless explicitly allowed by the assignment, do not plagiarize online sources and in general make sure you do not violate any of the academic standards of the course, the department or the university. CourseNana.COM

Online sources include the use of ChatGPT or other Large Language Models and Generative AI tools. While the use of such tools is allowed as supportive instruments for programming, the teams need to report the level of their use and the part of the code that was generated by them. Students have to be careful that blindly copying significant pieces of code from such tools - which falls under the definition of plagiarism - may result on submissions that do not accurately answer the assignment. CourseNana.COM

Failure to follow these rules may result in failure in the course.  CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
Rutgers代写,CS 460代写,CS460代写,INTRO TO COMPUTATIONAL ROBOTICS代写,2D Collision Checking代写,Collision-free Navigation代写,Collision-free Movement代写,Python代写,Rutgers代编,CS 460代编,CS460代编,INTRO TO COMPUTATIONAL ROBOTICS代编,2D Collision Checking代编,Collision-free Navigation代编,Collision-free Movement代编,Python代编,Rutgers代考,CS 460代考,CS460代考,INTRO TO COMPUTATIONAL ROBOTICS代考,2D Collision Checking代考,Collision-free Navigation代考,Collision-free Movement代考,Python代考,Rutgershelp,CS 460help,CS460help,INTRO TO COMPUTATIONAL ROBOTICShelp,2D Collision Checkinghelp,Collision-free Navigationhelp,Collision-free Movementhelp,Pythonhelp,Rutgers作业代写,CS 460作业代写,CS460作业代写,INTRO TO COMPUTATIONAL ROBOTICS作业代写,2D Collision Checking作业代写,Collision-free Navigation作业代写,Collision-free Movement作业代写,Python作业代写,Rutgers编程代写,CS 460编程代写,CS460编程代写,INTRO TO COMPUTATIONAL ROBOTICS编程代写,2D Collision Checking编程代写,Collision-free Navigation编程代写,Collision-free Movement编程代写,Python编程代写,Rutgersprogramming help,CS 460programming help,CS460programming help,INTRO TO COMPUTATIONAL ROBOTICSprogramming help,2D Collision Checkingprogramming help,Collision-free Navigationprogramming help,Collision-free Movementprogramming help,Pythonprogramming help,Rutgersassignment help,CS 460assignment help,CS460assignment help,INTRO TO COMPUTATIONAL ROBOTICSassignment help,2D Collision Checkingassignment help,Collision-free Navigationassignment help,Collision-free Movementassignment help,Pythonassignment help,Rutgerssolution,CS 460solution,CS460solution,INTRO TO COMPUTATIONAL ROBOTICSsolution,2D Collision Checkingsolution,Collision-free Navigationsolution,Collision-free Movementsolution,Pythonsolution,