Robotics Club Tabletop Challenge 3

Here’s the code from our last meeting, a currently incomplete tabletop robot that currently only locates the tissue box.

————————————————-

void goForward (){
startMotor (wheelr, 90);
startMotor (wheell, 70);
}

void stopMotors(){
stopMotor (wheelr);
stopMotor (wheell);
}

void goBackwards(){
startMotor (wheell, -70);
startMotor (wheelr, -70);
}

void turnCCW(){
int motorRTurn = SensorValue(encoderr);
int motorLTurn = SensorValue(encoderl);

startMotor (wheelr, 75);
startMotor (wheell, -50);

while (SensorValue(encoderr) – motorRTurn < 365 && SensorValue(encoderl) – motorLTurn < 301)
{
}

stopMotor(wheell);
stopMotor(wheelr);
}

void turnCW(){
int motorRTurn = SensorValue(encoderr);
int motorLTurn = SensorValue(encoderl);

startMotor (wheelr, -75);
startMotor (wheell, 60);

while (SensorValue(encoderr) – motorRTurn < 395 && SensorValue(encoderl) – motorLTurn < 395)
{
}

stopMotor(wheell);
stopMotor(wheelr);
}

task main()
{
while(SensorValue(sonar)>= 20){
goForward ();
}
wait (.5);
turnCW ();
goForward ();
wait (4.9);

}

Advertisements

Moveit breakthrough with PR2Lite

Update from Alan.

We’re taking a break from formal meetings in December.  Alex and his son will continue experimenting with ROS on the Neato.  Alan is continuing his work on PR2Lite arm navigation and has made a nice breakthrough.

We’re updating arm navigation in the following ways:

  • New right arm configuration with MX-64s, MX-106s, and the velo gripper
  • using Moveit on Hydro on the latest Ubuntu release
  • using a new laptop

The newest Ubuntu release required some minor code changes to get hydro to compile.

The tutorials were not quite accurate.  Using the configuration in pr2_moveit_config as a starting point helped.

Moveit on Hydro doesn’t officially support mimic links when launching demo.launch.  Some hacks allowed progress to be made, but Alan was encountering bugs, especially in kdl_kinematics_plugin.  After fixing some problems, Alan found the following commit by Ioan Sucan andSachin Chitta in the Hydro development branch:

Pulling in a subset of the changes to the laptop fixed many of the bugs Alan was encountering.  The arm navigation in demo.launch seems to hit problems in some edge conditions, but the new arm navigation may now be usable.  A major breakthrough.

Next, we need to change some of the hardware configuration on the physical robot to allow the laptop to replace the existing computer.

Robotics Club Tabletop Challenge #2

On Wednesday, Nov. 11, Robotics Club had an after-school meeting to work on part 2 of the HBRC Tabletop Challenge.  The rules for that were to cross from one side of the table to the other, and come back to the original side without falling off the table.  Three groups programmed code, and all groups got their code working well within the hour.  This was good for their first autonomous programming.

Here are the three programs they wrote to all achieve the same goal:

//PROGRAM #1
void motorForward() {
startMotor (MotorR, 125);
startMotor (MotorL, 125);
}

void motorBackward () {
startMotor (MotorR, -100);
startMotor (MotorL, -78);
}

void StopMotor () {
stopMotor (MotorR);
stopMotor (MotorL);
}

void detectEdge1() {
while(SensorValue(LimitL1) == 1 && SensorValue(LimitR1) == 1) {
wait(0.01);
}
motorBackward();
}

void detectEdge2 () {
while(SensorValue(LimitL2) == 1 && SensorValue (LimitR2) == 1) {
wait(0.01);
}
motorForward();
}

task main () {
motorForward ();
detectEdge1 ();
detectEdge2 ();
motorForward ();
wait (2);
StopMotor ();
}

//PROGRAM #2
void goforward(){
startMotor(motorR, 100);
startMotor(motorL, 100);
}

void edgeDetect()
{
int x = 1;
while (x == 1){
if (SensorValue(a)==0){
stopMotor(motorL);
stopMotor(motorR);
x = 0;
}

if (SensorValue(b)==0){

stopMotor(motorL);
stopMotor(motorR);
x = 0;
}
}
}

void gobackward(){
startMotor(motorR, -100);
startMotor(motorL, -78);
}

void edgeDetect2(){
int x = 1;
while (x == 1){
if (SensorValue(c)==0){
stopMotor(motorL);
stopMotor(motorR);
x = 0;
}
if (SensorValue(d)==0){
stopMotor(motorL);
stopMotor(motorR);
x = 0;
}
}
}

void forward2(){
startMotor(motorR,75);
startMotor(motorL,75);
wait(2);
stopMotor(motorL);
stopMotor(motorR);
}

task main(){
goforward();
edgeDetect();
gobackward();
edgeDetect2();
forward2();
}
//PROGRAM #3
void goForward()
{
startMotor (motorL, 100);
startMotor (motorR, 100);
}

void goBackward ()
{
startMotor (motorL, -100);
startMotor (motorR, -100);
}

task main()
{
while(SensorValue(frontR)==1 && SensorValue(frontL)==1)
{
goForward();
}

while(SensorValue(backR)==1 && SensorValue(backL)==1)
{
goBackward();
}

}