How to program a nxt robot
Ideally events generated by external sources are detected by the interrupt service routines ISRs. The way to learn programming with these drivers is to check the driver specifications in their respective. Don't "spam" the event system with redundant information.
Make sure you define and use all events properly. The NXT brick can be used to control actuators, like an integrated sound generator, lights, and motors, and read input from various sensors, like light sensors, pressure sensors, rotation sensors, and how to program a nxt robot sensors. The group with firstest lap challenge 2 will get some bonus points 2 points in the final exam. You may use any of the techniques you learned above to define and schedule tasks, read sensors and send commands to the motors.
Basic Periodic Schedule Before we implement the actual tasks, we need a way for them to communicate. Again, note that hand-ins without meaningful comments will be directly discarded. Cygwin is a shell program which emulates Unix environment inside windows. Further, the following hints may help:
Note that there is no task sensing the distance yet. See also the lab introduction slides. Make sure your code compiles without error and executes as desired on the NXT brick.
Define a task "MotorcontrolTask" that "executes" the "driving command". Now create a new task "MotorcontrolTask" that does the following in an infinite loop: Working in Groups Solve this assignment in your groups. The line tracking should be done with the light sensor.
Same holds for the other sensors: You can find some packages of drivers and example code as part of getting started session below. Report Hand-in The report must consist of the following:
The car should only start moving again when the car is back on the table and the touch sensor is pressed again. The task displaying useful information should be extended to display even more useful information. Using this, we will now define the tasks in our system: Using how to program a nxt robot sensor reading, it should try to set the driving command to a value that would make the car drive towards a target distance of around 20cm between the cars front and the object. Our workaround for this is to create a small, second task that and checks the sensors periodically about every 10ms.