To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 1636
1635  |  1637
Subject: 
c++ changes
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Thu, 18 Jan 2001 05:43:07 GMT
Viewed: 
1571 times
  
After some prompting, I have made the method names in the c++ classes uniform
in case.  Unfortunately, the changes are not backward compatible.  Please let
me know of any problems you discover.  If I don't hear of any problems, I'll
check in the changes next week.

Pat

Index: demo/c++/Makefile
===================================================================
RCS file: /cvsroot/legOS/legOS/demo/c++/Makefile,v
retrieving revision 1.1
diff -r1.1 Makefile
16c16
<       raceTrack.lx lineTrack.lx
---
      raceTrack.lx
Index: demo/c++/motor.C
===================================================================
RCS file: /cvsroot/legOS/legOS/demo/c++/motor.C,v
retrieving revision 1.1
diff -r1.1 motor.C
31c31
<   m.Forward();
---
  m.forward();
37c37
<   m.Reverse();
---
  m.reverse();
Index: demo/c++/raceTrack.C
===================================================================
RCS file: /cvsroot/legOS/legOS/demo/c++/raceTrack.C,v
retrieving revision 1.1
diff -r1.1 raceTrack.C
33c33
<   m.Off();
---
  m.off();
42c42
<     m.Forward(speed);
---
    m.forward(speed);
49,50c49,50
<     m.Brake(100);
<     m.Left(m.max);
---
    m.brake(100);
    m.left(m.max);
57c57
<     m.Brake(100);
---
    m.brake(100);
Index: demo/c++/rover.C
===================================================================
RCS file: /cvsroot/legOS/legOS/demo/c++/rover.C,v
retrieving revision 1.1
diff -r1.1 rover.C
35c35
<       m.Forward();
---
      m.forward();
39c39
<       m.Reverse();
---
      m.reverse();
45c45
<   m.Off();
---
  m.off();
Index: include/c++/Motor.H
===================================================================
RCS file: /cvsroot/legOS/legOS/include/c++/Motor.H,v
retrieving revision 1.1
diff -r1.1 Motor.H
27,30c27,30
< // void Forward() which sets the direction to fwd
< // void Reverse() which sets the direction to rev
< // void Brake() which sets the direction to brake
< // void Off() which sets the direction to off
---
// void forward() which sets the direction to fwd
// void reverse() which sets the direction to rev
// void brake() which sets the direction to brake
// void off() which sets the direction to off
32c32
< // Forward(const unsigned char s) which sets the direction to fwd, and
---
// forward(const unsigned char s) which sets the direction to fwd, and
34c34
< // Reverse(const unsigned char s) which sets the direction to rev, and
---
// reverse(const unsigned char s) which sets the direction to rev, and
66c66
<   ~Motor() {Off();}
---
  ~Motor() {off();}
69,75c69,75
<   const void Forward() const { direction(fwd); }
<   const void Forward(const unsigned char s) const { Forward(); speed(s); }
<   const void Reverse() const { direction(rev); }
<   const void Reverse(const unsigned char s) const { Reverse(); speed(s); }
<   const void Brake() const { direction(brake); }
<   const void Brake(int duration) const { Brake(); delay(duration); }
<   const void Off() const { direction(off); }
---
  const void forward() const { direction(fwd); }
  const void forward(const unsigned char s) const { forward(); speed(s); }
  const void reverse() const { direction(rev); }
  const void reverse(const unsigned char s) const { reverse(); speed(s); }
  const void brake() const { direction(std::brake); }
  const void brake(int duration) const { brake(); delay(duration); }
  const void off() const { direction(std::off); }
Index: include/c++/MotorPair.H
===================================================================
RCS file: /cvsroot/legOS/legOS/include/c++/MotorPair.H,v
retrieving revision 1.1
diff -r1.1 MotorPair.H
26c26
< // See Motor for methods speed, direction, Forward, Reverse, Brake, and Off.
---
// See Motor for methods speed, direction, forward, reverse, brake, and off.
29c29
< //  Left()     Turns left by running both motors in reverse, so it should
spin
---
//  left()     Turns left by running both motors in reverse, so it should
spin
32c32
< //  PivotLeft() Turns left by locking up the left motor, and running the
right
---
//  pivotLeft() Turns left by locking up the left motor, and running the
right
35c35
< //  Right()    Turns right by running both motors in forward, so it should
spin
---
//  right()    Turns right by running both motors in forward, so it should
spin
38c38
< //  PivotRight() Turns right by locking up the right motor, and running the
---
//  pivotRight() Turns right by locking up the right motor, and running the
42c42
< // Left(int speed), which runs the motors at the specified speed.
---
// left(int speed), which runs the motors at the specified speed.
48c48
<     : left(lport), right(rport) {}
---
    : mLeft(lport), mRight(rport) {}
50c50
<   void speed(const int s) const { left.speed(s); right.speed(s); }
---
  void speed(const int s) const { mLeft.speed(s); mRight.speed(s); }
52,57c52,57
<     if (dir == fwd) {
<       left.direction(fwd);
<       right.direction(rev);
<     } else if (dir == rev) {
<       left.direction(rev);
<       right.direction(fwd);
---
    if (dir == std::fwd) {
      mLeft.direction(std::fwd);
      mRight.direction(std::rev);
    } else if (dir == std::rev) {
      mLeft.direction(std::rev);
      mRight.direction(std::fwd);
59,60c59,60
<       left.direction(dir);
<       right.direction(dir);
---
      mLeft.direction(dir);
      mRight.direction(dir);
63,77c63,95
<   void Forward() const { direction(fwd); }
<   void Reverse() const { direction(rev); }
<   void Brake() const { left.direction(brake); right.direction(brake); }
<   void Off() const { left.direction(off); right.direction(off); }
<   void Left() const { left.direction(fwd); right.direction(fwd); }
<   void PivotLeft() const { left.Brake(); right.direction(rev); }
<   void Right() const { left.direction(rev); right.direction(rev); }
<   void PivotRight() const { left.direction(fwd); right.Brake(); }
<
<   void Forward(const int s) const { Forward(); speed(s); }
<   void Reverse(const int s) const { Reverse(); speed(s); }
<   void Left(const int s) const { Left(); speed(s); }
<   void PivotLeft(const int s) const { PivotLeft(); speed(s); }
<   void Right(const int s) const { Right(); speed(s); }
<   void PivotRight(const int s) const { PivotRight(); speed(s); }
---
  void forward() const { direction(std::fwd); }
  void reverse() const { direction(std::rev); }
  void brake() const {
    mLeft.direction(std::brake);
    mRight.direction(std::brake);
  }
  void off() const {
    mLeft.direction(std::off);
    mRight.direction(std::off);
  }
  void left() const {
    mLeft.direction(std::fwd);
    mRight.direction(std::fwd);
  }
  void pivotLeft() const {
    mLeft.brake();
    mRight.direction(std::rev);
  }
  void right() const {
    mLeft.direction(std::rev);
    mRight.direction(std::rev);
  }
  void pivotRight() const {
    mLeft.direction(std::fwd);
    mRight.brake();
  }

  void forward(const int s) const { forward(); speed(s); }
  void reverse(const int s) const { reverse(); speed(s); }
  void left(const int s) const { left(); speed(s); }
  void pivotLeft(const int s) const { pivotLeft(); speed(s); }
  void right(const int s) const { right(); speed(s); }
  void pivotRight(const int s) const { pivotRight(); speed(s); }
79c97
<   void Brake(const int d) const { Brake(); delay(d); }
---
  void brake(const int d) const { brake(); delay(d); }
84,85c102,103
<   const Motor left;
<   const Motor right;
---
  const Motor mLeft;
  const Motor mRight;



1 Message 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