X2

From Robin

(Difference between revisions)
Jump to: navigation, search
m
m
 
Line 11: Line 11:
see the matlab script testRobot.m, below, for usage example
see the matlab script testRobot.m, below, for usage example
-
* openRobot.m - opens the com-port connections to the robot.
 
-
* closeRobot.m - closes the com-ports.
 
-
* setRobotAngles.m (in derees)
 
-
* ...
 
-
 
-
testRobot.m :
 
  robot = openRobot('COM6','COM4','COM5'); %creates a robot struct, with matlab objects for each joint
  robot = openRobot('COM6','COM4','COM5'); %creates a robot struct, with matlab objects for each joint
  getStatus(robot); %get the status of the robot
  getStatus(robot); %get the status of the robot
-
  motorToggle(robot); %toggle motor on  
+
  motorToggle(robot); %toggle motor on  
  setRobotAngles(robot,0,0,15); %set the angles of joint 1, 2, and 3 in degrees
  setRobotAngles(robot,0,0,15); %set the angles of joint 1, 2, and 3 in degrees
-
  pause(10); %pause the script, waiting for the robot to perform the task
+
  pause(10); %pause the script, waiting for the robot to perform the task
-
  motorToggle(robot); %toggle motor off
+
  motorToggle(robot); %toggle motor off
  pause(1); %small pause
  pause(1); %small pause
  closeRobot(robot); %close the connection to the com ports
  closeRobot(robot); %close the connection to the com ports

Current revision as of 00:20, 2 February 2012

The X2 robot has been developed from parts printed with our 3D printer Connex500.

Usage

In the ROBIN robotics lab, the desktop computer next to the X2 robot is set up to communicate with the robot.

Matlab

Matlab functions to communicate with the robot have been developed. These are included with the compulsory exercises which the robot will be used for.

see the matlab script testRobot.m, below, for usage example

robot = openRobot('COM6','COM4','COM5'); 	%creates a robot struct, with matlab objects for each joint
getStatus(robot);				%get the status of the robot
motorToggle(robot);				%toggle motor on 
setRobotAngles(robot,0,0,15);			%set the angles of joint 1, 2, and 3 in degrees
pause(10);					%pause the script, waiting for the robot to perform the task
motorToggle(robot); 				%toggle motor off
pause(1);					%small pause
closeRobot(robot);				%close the connection to the com ports

The robot will need some time to move to a new position, so remember to include pauses in your matlab code.

IMPORTANT: The robot must be in the (0 0 0) joint configuration before starting

Arduino controller

The arduino software is located at C:\sonen\arduino Open the file C:\arduino_sketch\x2.pde to control the robot. Set baud rate to 115200

The commented lines in the top of the x2.pde file show the available commands. E.g. "?" will give the status of the robot.

joint angle 1440 is 0 degrees, joint angle 0 is -180 degrees, joint angle 2880 is 180 degrees,

The joints are located at Com4-Com6

Default pid-parameters, that seem to be working fine: p = 14, i=10, s=2


The "Controller" folder in the "libraries" folder, contains the controller project. More info on the arduino part can be found here.

Personal tools
Front page