X2

From Robin

(Difference between revisions)
Jump to: navigation, search
m
m
Line 7: Line 7:
=== Matlab ===
=== Matlab ===
-
Matlab functions to communicate with the robot have been developed.  
+
Matlab functions to communicate with the robot have been developed. These are included with the compulsory exercises which the robot will be used for.
-
(list of the functions will follow shortly)
+
see the matlab script testRobot.m, below, for usage example
-
 
+
-
see the matlab script testRobot.m for usage example
+
* openRobot.m - opens the com-port connections to the robot.
* openRobot.m - opens the com-port connections to the robot.
Line 17: Line 15:
* setRobotAngles.m (in derees)
* setRobotAngles.m (in derees)
* ...
* ...
 +
 +
testRobot.m :
 +
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.
The robot will need some time to move to a new position, so remember to include pauses in your matlab code.

Revision as of 00:19, 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

  • 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
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