9 Aralık 2020 Çarşamba

Udacity- Artifical Intelligence for Robotic Education-Problems Solutions

 

Generalized Uniform Distribution



#  Modify your code to create probability vectors, p, of arbitrary 
#  size, n. Use n=5 to verify that your new solution matches 
#  the previous one.

p=[]
n=5

for i in range (n):
    p.append(1./n)

print p



pHit and pMiss


#Write code that outputs p after multiplying each entry 
#by pHit or pMiss at the appropriate places. Remember that
#the red cells 1 and 2 are hits and the other green cells
#are misses.


p=[0.2,0.2,0.2,0.2,0.2]
pHit = 0.6
pMiss = 0.2
   
p[0] = p[0]*pMiss
p[1] = p[1]*pHit
p[2] = p[2]*pHit
p[3] = p[3]*pMiss
p[4] = p[4]*pMiss   

print p



Sum of Probabilities



#Modify the program to find and print the sum of all 
#the entries in the list p.

p=[0.2, 0.2, 0.2, 0.2, 0.2]
pHit = 0.6
pMiss = 0.2

p[0]=p[0]*pMiss
p[1]=p[1]*pHit
p[2]=p[2]*pHit
p[3]=p[3]*pMiss
p[4]=p[4]*pMiss

# Enter your code below
print sum(p)



Sense Function



#Modify the code below so that the function sense, which 
#takes p and Z as inputs, will output the NON-normalized 
#probability distribution, q, after multiplying the entries 
#in p by pHit or pMiss according to the color in the 
#corresponding cell in world.


p=[0.2, 0.2, 0.2, 0.2, 0.2]
world=['green', 'red', 'red', 'green', 'green']
Z = 'red'
pHit = 0.6
pMiss = 0.2

def sense(p, Z):
   
    q = [ ]
    for i in range(len(p)):
        hit = (Z == world[i])
        q.append(p[i] * (hit * pHit + (1-hit) * pMiss))


    return q

print sense(p,Z)



Normalized Sense Function










13 Eylül 2020 Pazar

Unity Nedir? (Üzerinde çalışılıyor....)

 Unity (game engine) - Wikipedia



Neden Unity?


Araştırmalarıma göre büyük bir grubun içinde değilseniz sağlamda bir yazılım geçmişiniz yoksa Unreal Engine sizi biraz kasar deniyor. O nedenle Unity kullanmak ilk etapta kaynağında daha fazla olması nedeniyle daha kritik.


CS kodlarını görüntülemek için Notepad++ veya Sublime kullanabilirsiniz.



Roll a Ball


Tutorildaki ilk eğitim bu. Ben bir türlü topumu hareket ettirememiştim buraya topun ayarlarını atacağım. Dikkatli şekilde incelerseniz. Top kesin hareket eder.






using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.InputSystem;


public class PlayerController : MonoBehaviour

{

    public float speed = 0;

    private Rigidbody rb;

    private float movementX;

    private float movementY;


    // Start is called before the first frame update

    void Start()

    {

        rb = GetComponent<Rigidbody>();

    }


    private void OnMove(InputValue movementValue)

    {

        Vector2 movementVector = movementValue.Get<Vector2>();

        movementX = movementVector.x;

        movementY = movementVector.y;

    }


    private void FixedUpdate()

    {

        Vector3 movement = new Vector3(movementX, 0.0f, movementY);

        rb.AddForce(movement * speed);

    }

}




------------------------------------------------------------------------------------


Camera Script


using System.Collections;

using System.Collections.Generic;

using UnityEngine;


public class Camerascript : MonoBehaviour

{

    public GameObject player;


    private Vector3 offset;


    // Start is called before the first frame update

    void Start()

    {

        offset = transform.position - player.transform.position;

    }


    // Update is called once per frame

    void LateUpdate()

    {

        transform.position = player.transform.position + offset;

    }

}



Player Controller Script



using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.InputSystem;


public class PlayerController : MonoBehaviour

{

    public float speed = 0;


    private Rigidbody rb;


    private float movementX;

    private float movementY;


    // Start is called before the first frame update

    void Start()

    {

        rb = GetComponent<Rigidbody>();

    }


    private void OnMove(InputValue movementValue)

    {

        Vector2 movementVector = movementValue.Get<Vector2>();


        movementX = movementVector.x;

        movementY = movementVector.y;

    }


    private void FixedUpdate()

    {

        Vector3 movement = new Vector3(movementX, 0.0f, movementY);


        rb.AddForce(movement * speed);

    }


}



















Kaynak:  


https://learn.unity.com/tutorial

https://learn.unity.com/courses

https://docs.unity3d.com/ScriptReference/30_search.html?q=Input

https://forum.unity.com/


Ros2 çalışmaları

 1) Her saniye yazı yazdırma. Eklediğim kod öncelikle Hello Cpp Node yazdıracak ardınca Hello ekleyecek. benim .cpp dosyamın adı my_first_no...