To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 1680
1679  |  1681
Subject: 
Straight moving with only one rotation sensor
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Thu, 10 Jun 2004 00:11:40 GMT
Viewed: 
4768 times
  
Hi

I saw in the LEGO Mindstorms Web Page that many people made their robots with 2
motors go straight using one rotation sensor on each wheel and stopping the
correct motor until both sensors were equal.

I got Ultimate Accessory Set as a present some months ago and I wanted to make
robots go straight using only one rotation sensor. I made it using a
differential.

Here is the unfinished NQC program for it:

#pragma init myinit

void myinit()
{
  SetPower(OUT_A+OUT_B+OUT_C, 7);
  SetDirection(OUT_A+OUT_B+OUT_C, OUT_REV);
}

task main()
{
  SetSensorType(SENSOR_3, SENSOR_TYPE_ROTATION);
  SetSensorMode(SENSOR_3, SENSOR_MODE_ROTATION);
  int sensorval;
  while(true)
  {
    sensorval=SensorValue(2)/2;
    if(sensorval > 0)
    {
      On(OUT_A);
      Off(OUT_C);
    }
    else if(sensorval < 0)
    {
      Off(OUT_A);
      On(OUT_C);
    }
    else
    {
      On(OUT_A + OUT_C);
      Wait(10);
    }
  }
}

LMKWYT

--
- Nicolas Alvarez
nicoalvar0.no.spam@hotmail.com



Message has 3 Replies:
  Re: Straight moving with only one rotation sensor
 
(...) Sounds good. I use a CyberMaster for the movement part of the robot because it has tachos on each internal motor. I modify the power settings for the motors to keep the robot (reasonably) straight, rather than stop and start them. If you tried (...) (20 years ago, 10-Jun-04, to lugnet.robotics.rcx.nqc)
  Re: Straight moving with only one rotation sensor
 
I did this in the past (since disassembled the bot) and found it to be quite reliable; except on slippery surfaces and carpet. :) The trick that I employed was to gear-up the rotation sensor. This causes the rotation sensor to detect even a slight (...) (20 years ago, 11-Jun-04, to lugnet.robotics.rcx.nqc)
  Re: Straight moving with only one rotation sensor
 
I tried to include the LDraw file but I had problems posting. (URL) (20 years ago, 12-Jun-04, to lugnet.robotics.rcx.nqc)

6 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR