| Contact | |
|---|---|
| Dr. Ordonez | - |
| Jonathan Boylan | jboylan@fsu.edu |
- Install latest version of MATLAB.
- Install ROS Toolbox. (Home > Add-Ons > ROS Toolbox)
- Install Navigation Toolbox. (Home > Add-Ons > Navigation Toolbox)
- Download this library. (Code > Download ZIP)
- Extract in a convenient directory.
-
Grab a RC car from the shelf and a pair of batteries. Note the RC number on the side of the car (not the large 1 on the front). Make sure everything is intact and there are no loose connections.
-
Plug in the two batteries. First, the one with the red connector, then the white connector. If you see, hear, or smell anything strange, disconnect the batteries immediately.
-
Wait for the Lidar to start spinning. Should take about a minute. If it doesn't, unplug the batteries and let the TA know.
-
Go into your WiFi settings. Look for a WiFi connection by the name of
MobileRoboticsLabRC#. Make sure the#matches your RC car number. Connect to the WiFi using 'a security key instead' with the passkeymobileroboticslab.
-
Open MATLAB and go to where you downloaded the library.
-
Right click on the folder
rc-matlab-lib-mainand select 'Add to Path > Selected Folders'. You will need to do this every time you open MATLAB. -
Run
ConnectToROS.mto connect to the RC car's ROS network. -
Test the RC connection by running
StartRCKeyboard.m, which will allow you to send commands to the RC car using your WASD keys. Make sure the car is elevated and no wheels are touching the stand before running this on the table. -
You should now be able to run your lab scripts from any directory.
-
Before disconnecting the batteries. Make sure to run
DisconnectFromROS.m. Failing to do this might cause your MATLAB to freeze.
% Initialize RC connection
RC = RCCar();
% Set the speed (in m/s)
RC.setSpeed(v)
% Set the steering angle
RC.setSteeringAngle(gamma)
% Reset the localization position to (0,0,0)
% and clear the occupancy grid
RC.resetMap()
% Save the occupancy grid to your workspace
% Use getOccupancy(saved_map, [x y]) to extract
% occupancy information at a given x,y location
RC.saveMap()
% Current state
x = RC.X;
y = RC.Y;
phi = RC.Phi;
% Current velocity
vx = RC.Vx;
vy = RC.Vy;
v = RC.V; % (= sqrt(vx^2 + vy^2))
omega = RC.Omega;
% Check occupancy at a location. Returns a
% probability of occupancy between 0.0 and 1.0
occ = RC.getOccupancy(x_, y_);
% Get the latest Lidar Scan
scan = RC.getScan();
% The RC object also includes 5 data logs
% that can hold data between functions
RC.DataLog1 = [RC.DataLog1; x];
RC.DataLog2 = y;
% ...
%% RC Car Example Control Loop
clc
clear
close all
%%
% Initialize RC connection
RC = RCCar();
% Set total duration and frequency of the control
duration = 5.0; % seconds
frequency = 10; % hertz
tic % Start timer
while (toc < duration)
% TODO: Control
% Maintain fixed frequency
pause(1/frequency);
end