Building: Program: Building Instructions. Are provided for the NXT Segway with Rider, Segway. Program on the remote control NXT and the SegwayBT program on the.
Sensor config
You can leave the HT Sensor in nxt-analog mode. That will give you the full resolution. The code is already set up to do the appropriate conversions. We just need to change a scaling constant, as explained below.
Here is the part you'll want to change. Keep in mind that the sensor is automatically correctly set up, but the ev3dev Python library is used to easily find the location of the 'value0' file that contains the sensor value.
If there is nothing like 'analog' in the Python library, keep only the last line, and provide the path yourself (/sys/class/lego-sensor/path/to/value/0/file)
Converting the units
The code was designed with support for other sensors in mind. The angular rate is calculated like this:
The offset and the scaling vary between the sensors. The offset is automatically calculated by the program in the calibration step, so you won't have to change that.
The scaling is configured by this constant:
For the HiTechnic sensor, use 0.2084 for this constant.
I think the positive rotation rate was the same for the HT Sensor as for the LEGO Gyro. But if it isn't, you can mount the sensor on the other side of the Brick (swap it with the Touch Sensor.)
1
How To Program An Nxt Segway Building Department
OR |
You can use the NXT with either AA batteries or the NXT Rechargeable Battery Pack. |
How To Program An Nxt Segway Buildings
2
3
4
5
Connect and wrap wires from ports B and C to the two motors as shown above, then connect and attach the light sensor to port 3 as shown below. |
6
7
8
9
10
11
Now To Program An Nxt Sound Sensor
12
Connect the body motor for the rider to port A. The ultrasonic sensor is not attached in this design. |
NXT Segway with Rider Programming
Important Usage Information Note: Unlike balancing robots that use a gyroscopic sensor or other special sensors, this design uses only the light sensor, which does not know which way is 'up' in an absolute sense, so it can only guess on its relative tilt based on the amount of reflected light received from the ground. As a result, getting a good balance is a bit of a challenge when you are using it. Please read the following important tips. Getting the NXT Segway with Rider robot to balance requires good lighting and surface conditions for the light sensor, and also requires that you start the robot exactly balanced to begin with, so be prepared to experiment with different surfaces and lighting, and also some practice at getting the robot started out balanced to begin with. Here are some tips:
The Programs Two programs are provided for the NXT Segway with Rider, Segway (or SegwayLS for LEGO Education 2.0) and SegwayBT (SegwayLS-BT for LEGO Education 2.0). Both of these programs balance the robot using a form of 'PID Controller'. See this Wikipedia article on PID Control for technical information on how a PID controller works. The Segway program will make the robot automatically balance itself, based on its initial position, without any leaning movement by the rider. When using this program, you can lock the rider in place to keep him upright as explained below. The SegwayBT program adds Bluetooth remote control to allow you to control the forward and backward lean of the rider from another NXT brick via Bluetooth. First, establish a Bluetooth connection from the second NXT (the remote control) to the Segway NXT on Connection 1, then run the SegwayRemoteprogram on the remote control NXT and the SegwayBT program on the Segway NXT, starting with the Segway balanced. Now pressing the gray Left and Right arrow buttons on the remote control NXT will cause the rider to lean slightly in that direction. Use only slight movements (e.g. one or two presses in each direction), so that the Segway can keep up with the motion. |
Locking the Rider in PlaceWhen using the Segway program, which does not do any rider leaning, you can lock in the rider in place as shown below to make the robot easier to work with. Remember to remove the lock when using theSegwayBT program. You can use either of these axles to hold the rider in place. The size 5 axle will look better, but the size 8 axle is easier to insert and remove. |