Activités avec le robot Maqueen Plus - Replay webinaire enseignants
Webinar Overview of McQueen Plus Robot
Introduction to the Webinar
- The host welcomes attendees and thanks them for joining the webinar focused on the McQueen Plus robot. Resources will be available in the video description for later reference.
Features of McQueen Plus
- The McQueen Plus is part of the 2024-2025 kit, featuring a Usky Lens camera that can be mounted on its upper plate, providing approximately one hour of operational autonomy with an 1800-2000 mAh battery.
Exploring Programming Blocks
- The presenter shares their screen to navigate through various programming blocks available for the robot, emphasizing user-friendly pop-up indicators that display measured distances.
Sensor Capabilities
- The robot includes an ultrasonic sensor at its front, which measures distance in centimeters. Users can perform calculations based on echo delays from sound waves emitted by this sensor.
- There are two versions of the McQueen Plus: V1 and V2. Users should check the version number located on the main circuit board behind the pins.
Line Following Sensors
- The new McQueen Plus features five line-following sensors compared to two in previous models. This allows better navigation through intersections with three central sensors and two side sensors.
Sensor Functionality
- Each sensor returns binary values (0 or 1), indicating whether it detects a black line. This data can be used logically within programming to trigger movements based on sensor readings.
LED Indicators and Movement Control
- The robot has two red LEDs at its front that can function as indicators for movement direction (left or right). These LEDs must be managed properly within code to ensure they turn off when not needed.
Programming Movement Commands
- Various blocks allow users to control forward and backward movement speeds, enabling customization through variable settings in programming tasks.
Understanding Variables and Robot Control
Introduction to Variables
- The concept of a variable is introduced as a memory element that holds a value, exemplified by naming it "vitesse" (speed).
- Emphasis on the importance of assigning meaningful names to variables for clarity in programming.
Setting Speed Values
- Default speed values can range from 0 (slow) to 255 (fast), affecting how quickly the robot moves.
- The program allows for dynamic speed adjustments based on sensor input, such as ultrasonic sensors detecting obstacles.
Utilizing Microbit for Control
- A second microbit can be used as a remote control, utilizing its accelerometer to send directional signals.
- The inclination of one microbit can dictate the movement direction of the robot, enhancing interactivity.
Motor Control Mechanics
- Discussion on controlling motors directly with specific blocks for precise movements rather than using rapid pivoting.
- Directional control is highlighted: clockwise or counterclockwise rotation affects forward or backward movement.
Emergency Stop Functionality
- Importance of implementing an emergency stop feature to halt the robot quickly if necessary.
- A tactile button on the microbit serves as an effective emergency stop mechanism, halting both motors simultaneously when activated.
Robot LED and Remote Control Programming
Introduction to Robot Components
- The robot is delivered with a protective paper covering the plexiglass, which can be removed for aesthetic purposes.
- It features four RGB LEDs: two located near the motors and two positioned slightly higher.
LED Functionality in Programming
- The LEDs serve multiple functions; they are used for line tracking and obstacle detection during exploration mode.
- Color indicators are employed: green for no obstacles, yellow for nearby obstacles, and red for very close obstacles.
Programming with Variables
- A question arises about using variables instead of fixed colors for the LEDs; it is confirmed that this is possible.
- When selecting colors, users can input values between 0 and 255 to adjust the intensity of red, green, and blue components.
Sharing Programs
- The speaker shares a program link in the chat while explaining its functionality.
- Emphasis is placed on testing shared programs in real-time and providing feedback.
Radio Functionality Overview
- The radio feature allows one microcontroller to act as a remote control for another robot.
- A startup icon indicates successful program upload; Bluetooth technology provides approximately ten meters of range between devices.
Simulating Robot Control
- Users can tilt their device left or right to send directional commands via radio signals.
- Buttons A and B are programmed to increase or decrease speed respectively, with visual feedback displayed on an LED matrix.
Multi-interface Simulation Feature
- The simulator offers a multi-mode option allowing simultaneous programming of both transmitter (remote control card) and receiver (robot).
- Users must ensure both microcontrollers are easily identifiable when connected; modifications can be made on both sides during testing.
Robot Control Logic and Programming
Understanding Robot State Management
- The speaker discusses the creation of variables to manage robot speed, including a variable named "état" (state), which defaults to "avance" (move forward). This state can be changed to "stop" when needed.
- The logic implemented checks if the state is equal to "avance." If true, the robot moves forward; otherwise, it remains stopped. Transitioning back to moving requires sending a specific command.
- When receiving commands via radio, the default state is set to "avance," but if the command is "STOP," it changes the state accordingly, ensuring that the robot halts until a new movement command is received.
Speed Control Mechanisms
- The speaker explains how button inputs affect speed. Pressing "+" increases speed while "-" decreases it by 20 units, with safeguards against negative values and limits set at 20 and 255.
- A logical approach for turning is described: for left turns, the right motor must move forward; for right turns, it's the left motor. This ensures proper directional control of the robot.
Timing and Delays in Operations
- Emphasis is placed on incorporating delays in programming. These pauses are crucial for allowing sufficient time for actions like turning or following lines without erratic behavior.
- The importance of adjusting delay times based on operational needs is highlighted. Too short a delay may result in insufficient rotation or constant turning without direction change.
Fine-Tuning Line Following Capabilities
- Proper timing adjustments are essential for line-following capabilities. The effectiveness of these operations depends significantly on how well delays are programmed into the system.
- Suggestions are made regarding modifying programs as necessary based on different robots' configurations while maintaining core logic principles across various models.
Communication Protocol Insights
- Discussion shifts towards communication modes used within programming. Variables such as "string data" handle character strings sent via radio commands like "left," "right," or "stop."
- An explanation follows about using mixed-type data structures that include both names and values for more complex operations involving remote control inputs affecting speed adjustments directly.
- Attention is drawn to case sensitivity when comparing received string data with expected commands; exact matches are required for successful recognition and execution of commands by the robot's system.
This structured overview captures key insights from each segment of discussion related to programming robotic controls effectively while providing timestamps for easy reference back to specific parts of the transcript.
Exploring the Robot's Functionality
Overview of the Explorer Mode
- The presenter discusses the "explorer" mode of a robot, detailing how to access and test the program via chat.
- The robot adjusts its speed based on distance measurements and attempts to avoid obstacles, though effectiveness may vary.
Program Modification and Improvement
- Emphasis is placed on encouraging students to think critically rather than simply using functional code examples; partial programs are provided for modification.
- Students are encouraged to identify bugs or errors in given code snippets, fostering problem-solving skills.
Key Variables Explained
- The variable "distance" captures measurements from an ultrasonic sensor, while "obstacle" indicates proximity status (e.g., close or far).
- Speed is defined within a range (0-255), with initial settings at zero until distance measurement begins.
Emergency Stop Mechanism
- An emergency stop feature is implemented through a logo button that halts the robot's operation and turns off LEDs.
- If not stopped, the program continues processing obstacle detection unless halted by user input.
Handling Measurement Errors
- A block is used to manage potential measurement errors from the ultrasonic sensor; values equal to 0 or 1 are disregarded as unreliable.
- Conditions must be met for valid distance readings before determining obstacle presence; this includes ensuring no erroneous values affect decision-making.
Obstacle Detection Logic
- If conditions are satisfied, the program assesses whether an obstacle is within 10 cm—considered too close for safe navigation.
- Depending on detected distances (under 10 cm, between 10–30 cm, or over 30 cm), different actions are taken regarding speed adjustments and LED indicators.
This structured approach provides clarity on how each component of the robot's programming contributes to its functionality in navigating environments effectively.
Robot Navigation and Obstacle Avoidance
Robot Movement Logic
- The robot is programmed to advance unless an obstacle is detected within a distance of 10 cm, at which point it will attempt to avoid the obstacle.
- If an obstacle is close, the robot will reverse for a brief period (200 milliseconds) before entering a loop that checks its distance measurements continuously.
- The robot updates its distance variable in real-time while turning; the right motor runs faster than the left to facilitate this movement until it can safely proceed.
Handling Distance Measurements
- The program requires rounding non-integer values from ultrasonic sensors to prevent errors when executing speed instructions for the robot.
- It’s crucial to round these values correctly; failure to do so results in error messages during program execution.
Program Testing and Execution
- The presenter connects their micro:bit card and uploads the program, noting that initial conditions keep the robot stationary until activated by pressing button A.
- The setup allows for testing in a designated area where users can launch the robot on command.
Power Management
- There are two switches on the robot: one for battery power with an indicator light showing charge level, and another switch located on the side of the robot that must be turned on as well.
Obstacle Avoidance Strategy
- When encountering an obstacle, the robot first reverses slightly before turning away. This strategy combines backward movement with turning maneuvers effectively.
- Users are encouraged to modify this basic program according to their needs while understanding its foundational logic.
Sensor Data Display and Communication
Line Following Program Overview
- A separate display program was created for line-following tasks, focusing on measuring sensor values and displaying them on an LCD screen in real-time.
Radio Functionality Utilization
- The presenter uses radio functionality set to channel 11 for transmitting data about sensor readings. An aesthetic feature involves using LEDs that respond when data is received.
Data Handling Complexity
- The receiver's micro:bit displays incoming data; if string length exceeds 16 characters, it splits across two lines due to LCD limitations.
Value Transmission Process
- The main processing unit concatenates various measured values before sending them via radio communication.
This structured approach provides clarity regarding both programming strategies employed in robotic navigation and how sensor data is managed effectively.
Programming a Robot with Color Feedback
Implementing Color Feedback on Value Reception
- The program includes a color sweep feature that activates each time a radio value is received, enhancing visual feedback.
- A control key allows for the movement of individual blocks in the programming interface, simplifying adjustments without affecting multiple blocks.
Testing LED Responses
- Upon loading the program onto the Bitmaker shield, LEDs are tested to confirm they light up correctly as values change, providing immediate visual confirmation of data reception.
- The second program discussed involves an emitter within the McQueen robot, which will be elaborated upon later.
Line Following Program Overview
- The line-following program is introduced, emphasizing calibration and sensor variables related to ground tracking.
- Variables are created for different sensors (left, middle, right), indicating their positions relative to the robot's orientation.
Sensor State Logic
- Each sensor's state is simplified into boolean values (True/False), allowing for easier interpretation of whether the robot is over a black line.
- This logic applies uniformly across all sensors; if a sensor detects black (True), its corresponding variable reflects this status.
Displaying Sensor Data
- Text elements are used to display measured values from various sensors on an LCD screen.
- To avoid clutter on the LCD when distance values change rapidly, spaces are added instead of overwriting previous data directly.
Simulation and Calibration Testing
- Although there’s no physical LCD available during testing, simulation tools can represent sensor data and motor functions effectively.
- The focus remains on positioning rather than moving the robot during tests to ensure accurate calibration and functionality checks of all five sensors.
Addressing Anomalies in Sensor Readings
- During testing, unexpected readings such as -1 or 0 were noted; these anomalies could disrupt program performance and require troubleshooting.
Calibration Process Demonstration
- A transition to another camera view aims to demonstrate calibration procedures more clearly.
- The calibration button's location is highlighted as crucial for initiating setup processes on the robot.
This structured summary captures essential insights from the transcript while linking back to specific timestamps for further exploration.
Calibration and Functionality of the Robot McQueen
Initial Setup and Calibration Process
- The robot's battery is turned off, allowing for a clearer demonstration without the blue LED light. The calibration button (C LED) will blink during this process.
- A different approach to loading the program is introduced; the speaker plans to test it before detailing its functionality, inviting feedback on its complexity.
- The program named "l'effet de surprise" is uploaded despite the robot being partially powered off. The microbit card lacks sufficient power to operate the robot but allows for program loading.
Calibration Steps and Testing
- Calibration utilizes a paper card provided by DF Robot, which features an imprint of the McQueen robot. A long press on the calibration button indicates successful calibration with red blinking LEDs.
- After placing the robot on a black line, it successfully follows it as indicated by sensor readings displayed in numbers corresponding to various ground sensors.
Challenges Encountered During Testing
- When testing on a PVC track, issues arise as the robot fails to detect a black line due to differences in surface color and texture compared to previous calibrations.
- The importance of recalibrating is emphasized when switching from a matte black paper track to a shiny PVC one, leading to discrepancies in sensor readings.
Adjustments Made for Improved Performance
- Since lacking an updated calibration area on his card, partial calibration using only three middle sensors is performed. This adjustment proves sufficient for basic functionality.
- After re-calibrating while positioned over a black line, successful operation confirms that proper calibration significantly impacts performance.
Program Insights and Future Improvements
- As the robot approaches tight turns, it struggles to maintain its path due to sharp angles causing loss of line detection; modifications are made within the programming for better recovery attempts.
- A screen share reveals more complex programming than previous iterations. Key variables include state management (on/off), sensor readings from left, center, right positions, and turbo mode activation based on button presses.
This structured overview captures essential insights into calibrating and operating the McQueen robot while highlighting challenges faced during testing phases.
Robot Speed Control and Sensor Integration
Speed Variation and Turbo Mode
- The robot's speed can be adjusted with a minimum and maximum value, allowing for experimentation with inertia effects on the robot's ability to stay on track.
- When button B is pressed, the robot enters Turbo mode, increasing speed values. A skull icon appears when not in Turbo mode.
Sensor Functionality and Calculations
- The black line sensor measures whether the robot is on or off the line; it uses a mathematical calculation based on readings from three sensors: left, middle, and right.
- In programming terms, true corresponds to 1 and false to 0. The left sensor is multiplied by 4 in calculations while the middle sensor has a weight of 2.
Decision-Making Logic
- If all sensors return zero (no detection of the black line), the robot stops and emits a beep as it attempts to find the line again.
- Instead of using multiple conditional tests for each sensor, an arithmetic approach simplifies decision-making by combining their outputs into one calculation.
Understanding Sensor Outputs
- Specific output values indicate which sensors detect the line:
- A result of 2 means only the middle sensor detects it.
- A result of 7 indicates all three sensors see the line.
Robot Movement Based on Sensor Data
- If only one side detects the line (e.g., right), adjustments are made accordingly—turning towards that side using maximum speed if necessary.
- Different scenarios dictate varying degrees of turns based on which sensors are activated; slight turns may use lower speeds rather than maximum.
Conclusion and Future Discussions
- This programming approach offers an alternative method for managing sensor data compared to traditional conditional checks.
- The speaker concludes by inviting questions and mentions an upcoming webinar focused on cybersecurity applications.