ROS
This post is some ROS command from ROS tutorial.
This post is some ROS command from ROS tutorial.
Regular Expression, short as Regex, is an expression method for string.
Start() function.GetComponentTransformFind(string name)Find(string name) for a transform can only find the direct children of a transformWheel collider is a collider rather than the mesh of the wheel. You can add force or torque to the collider to make the collider rotate like a wheel.
Rigidbody has a element named velocity, which can set the speed(Vector3) of the gameobject.
OnCollisionEnter or OnTriggerEnterPhysics.OverlapSphere(point) to detect whether the point collides with other colliders.Collider.Raycast to get the accurate collision position. It will ignore other colliders but this collider.transform.root.gameObject can find the root objectgameObject.GetComponentInChild() can find the script attached to the child objects.transform.Find() can find the children objects, but this is only used to find the direct children objects.
Attributes of C# can add metadata (information about the types defined in a program) to the program. In Unity, it can be used to show information in Unity editor’s inspector.
The attributes work by placing the name of the attribute enclosed in square brackets ([]) above the declaration of the entity to which it applies. There are several different attributes in Unity
| Name | Function |
|---|---|
| HideInInspector | Hide public parameter in Unity Inspector |
| SerializeField | Show the private parameter in Unity Inspector |
| Space | Show a space line in Unity Inspector |
| Header(“XX”) | Show a comment for the parameter in Unity Inspector |
| Range(min, max) | Show the value range in Unity Inspector |
Unity can use async/await keywords of C# to achieve asynchronous methods, which can be found here.
However, some Unity library functions cannot be executed correctly in the asynchronous thread. Instead, Unity has its own asynchronous keyword, which is IEnumerator/yield return.
yield return keyword has many kinds of return type, which shows following
| Type | Function |
|---|---|
yield return new WaitForEndofFrame() |
Wait until the end of current frame |
yield return new WaitForFixedFrame() |
Wait until next frame |
yield return new WaitForSeconds(xx) |
Wait for xx seconds |
yield return new WaitForWhile(func) |
Wait until func return false |
yield return new WaitForUntil(func) |
Wait until func return true |
In Unity scripts, sometimes we need to do some actions after changing the properties of the GameObject, e.g. position, rotation. Unity will finish the changing action in the end of current frame. So we need to wait for a while before doing other actions.
Note. the event of delegate trigger is also finished in the current frame.
Also in Unity, we need to use yield return null or allow the code return to the main thread to do some changes in the scene.
Note. don’t use yield return 0 because it is the same with yield return null but it will lead to boxing action.
Unity has many targeted platforms, so the codes can be conditional complied according to this link
UnityEngine.dll and mscorlib.dllMono or IL2CPP to build the IL scripts to naive codeKnowledge about system design.
Git is a powerful version management system. This posts captures the common used commands.
Noise exists in the world, ans also exists in the robot motion and observations, so robots never know exactaly of the environment and themselves. However, probality theory could represent the uncertainty and give a better guess or estimation of the world. Therefore, the state estimation is very important in Robotics.
Importing the .ipynb file we wrote as a module to a new .ipynb file is different from importing them in a .py file. The easiest way is to convert those .ipynb file to a .py file and you can import those in a new .ipynb file. However, this method doesn’t allow you to modify the code and reload it easily.
For example, the lib’s name is test.ipynb. There is a function called hello() within it. In a new .ipynb file, you need to type the following.
1 | # !pip install import-ipynb |
The import_ipynb lib is allowing you to import a .ipynb file. The importlib file is allowing you to reload the module thus the new change to the lib file can be reloaded into your file.
For example, the lib file in the folder of lib. The lib’s name is test.ipynb. There is a function called hello() within it. In a new .ipynb file, you need to type the following.
Powershell is a more powerfull shell than CMD in Windows. However, the layout of powershell in Windows is very ugle, especially the default font. In order to change the font of powershell, we need to do several works.
Actually the font can be change in the powershell if we click the top left corner of the powreshell interface. While if the CodePage is 936(Chinese), you can only change the font of powershell among several Chineses fonts, which are not well performed in the powershell.
So we need to find some way to change the CodePage of powershell to 437(English), then we can change the font to some English font like Consolas.
In order to change the default page to another, there are two steps need to finish that. One is for the powershell launched by Win+R, and another is the powershell launched by the start menu. It is because the software launched by shortcut follows other disciplines which I don’t know much.
\HKEY_CURRENT_USER\Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exeCodePage of type DWORD to decimal 437-NoExit -Command "chcp 437; cls"
The command above means the powershell will run the two commands automatically. The chcp 437 means to swtich the Codepage to 437; and the cls means to clear the powershell.
This post talks about the grammar of Java.
For environment, you can use virtualenv to create a virtual python environment to seperate this to the original environment.
1 | virtualenv XX |
Note. the virtual env folder will be located to your current folder of the bash locates. When you change the path of the env folder, it will cause problem for some direct running module. Like pip, jupyter
For packages, you can use the following command to export installed packages in env1 and install those packages in env2
1 | (env1) $ pip freeze > requirement.txt |