RoboCo
评价数不足
Pug Utils Code Library
   
奖励
收藏
已收藏
取消收藏
特性: 包含脚本
文件大小
发表于
36.863 KB
2022 年 11 月 5 日 下午 12:21
1 项改动说明 ( 查看 )

订阅以下载
Pug Utils Code Library

描述
A code library.

The controller doesn't do anything, but the script in it can be used from other creations.

Usage/Instalation:

Subscribing to the creation on the workshop automatically installs the script.

To use the library in your own scripts, put this code at the top of your script:
import os, sys path = str(os.path.expanduser('~'))+'\\Documents\\My Games\\Roboco' for file_path in os.listdir(path): for folder in os.listdir(os.path.join(path, file_path)): f_path = os.path.join(path, file_path, folder) if(os.path.isdir(f_path) and folder == 'Scripts'): if not (f_path in sys.path): sys.path.append(f_path) import pug_utils

Contents:

ControlInputs: class to get smoothed axis controls or raw inputs with ease

PID: class for stability control.

globalToLocalRotation(axis): Converts the rotation values from the IMU (relative to the global space) to local rotation values (pitch, roll, yaw)

clamp(x, mi, ma): confines x between a minimum mi and maximum ma

lerp(x, y, fac): linearly interpolates between values x and y based on the factor fac (factor of 0 returns x, factor of 1 returns y)

remap(value, min1, max1, min2, max2): Maps a value between min1 and max1 to a value between min2 and max2

sign(x): returns 1 if x is positive or 0, -1 otherwise
热门讨论 查看全部(1)
0
2023 年 11 月 25 日 上午 2:48
When I run it, the following error occurs: How should I fix it?
Ronniekim486