Code covered by the BSD License  

Highlights from
NXT Ballbot (Self-Balancing Robot On A Ball) Controller Design

image thumbnail

NXT Ballbot (Self-Balancing Robot On A Ball) Controller Design

by

 

NXT Ballbot Model-Based Design based on Embedded Coder Robot NXT.

param_sim.m
% Simulation and Virtual Reality Parameters

% Initial Values
PSI0 = 4;							% initial value of body pitch angle [deg]
XIV = [								% initial state
	0
	PSI0
	0
	0
	];

% Sample Rates
TS = 0.001;							% base sample rate [sec]
% cut sonar and wall hit simulation steps for accelerating simulation.
TS_SONAR = ts2 / 1000;				% sonar calculation sample rate [sec]
TS_WALL = ts1 * 5 / 1000;			% wall hit calculation sample rate [sec]

% Start Time of Balancing
TIME_START = time_start;			% start time of stabilizing [msec] (= gyro calibration time)

% Environments
GP_MAX = 100;						% maximum game pad input
GYRO0 = 600;						% initial value of gyro sensor
BATTERY = 8000;						% initial value of battery [mV]

% MAP
WALL_COLOR = 128;													% gray
MAP_WALL = ~(imread('vr_nxt_ballbot_track.bmp') - WALL_COLOR);		% wall = 1, field = 0
MAP_WALL = MAP_WALL(:, :, 1);
START_POS = [100, 100];				% initial position ([z, x]) [cm]

% Conditions for Stopping Simulation
BODY_ANGLE_MAX = 15;				% maximum body angle
BODY_ANGLE_MIN = -15;				% minimum body angle

% Virtual Reality Parameters
TS_VR = 0.1;						% VRML refresh rate [sec]
DEPTH = 0.135;						% body depth [m]
WIDTH = 0.135;						% body width [m]
HEIGHT = 6.65;						% body height [cm]				
CAMERA_HEIGHT = 13;					% camera height [cm]
CAMERA1_OFFSET = [-50, CAMERA_HEIGHT - HEIGHT, -10];	% camera1 offset position [cm]
CAMERA2_OFFSET = [-10, CAMERA_HEIGHT - HEIGHT, 50];		% camera2 offset position [cm]
ROTATION_X = [1, 0, 0];				% rotation vector about x axis
ROTATION_Z = [0, 0, 1];				% rotation vector about z axis

clear WALL_COLOR

Contact us