/r/FLL
The subreddit for FIRST Lego League
Welcome to the sub-reddit for the international First Lego League (FLL) competition. This is a engineering competition focused toward kids in aged 9-14. The competitions consists of two main parts: Robot Building and Problem Solving. They'll have from September to January to build their robot and solution around the varying themes from year to year. They will also provide an answer to a large question and show it to judges at local competitions, leading up to the FIRST Championship's FLL World Festival, where they will compete against the best 100 of the over 15,000 teams competing worldwide.
/r/FLL
Lately I've been discussing the topic of coding a good "turn" algorithm for FLL. In other words, how can you make the robot turn toward a desired heading in an accurate and efficient manner. I decided to pose the problem to ChatGPT to see what it comes up with.
Prompt 1:
Given a robotic vehicle with two wheels, I need equations that can be used to accomplish turning the robot a certain number of degrees by rotating the wheels different amounts. I have a gyro sensor to measure the robot heading.
Reddit doesn't handle the equations well, so I'm editing the response from ChatGPT just a bit, but here's what it came up with:
----------------------------------
Using a gyro sensor simplifies turning the robot to a specific angle because you can continuously monitor the robot's actual orientation during the turn and adjust the wheel speeds accordingly. Here's how you can do it:
----------------------------------
Prompt 2:
There are several problems with that proposal.
- Attempting to stop the turn when the robot's heading is within a desired tolerance of the target could easily cause the robot to dither back and forth around the target, constantly overshooting the desired tolerance in both directions. Modify the algorithm to stop as soon as the robot has surpassed the target heading rather than trying to correct for overshoot.
- Using a proportional controller is a good idea to more accurately hit the target heading, but the initial error will be very large which will cause a large jerk as the robot starts turning. Modify the algorithm to ramp up the speed gradually to avoid commanding too much speed too quickly.
- Using proportional control will cause the robot to slow to zero speed as the robot approaches the target heading and the error approaches zero. However, due to real-world limitations, a robot will not actually move at very low commanded speeds. There is a minimum commanded speed that is required to induce any robot motion at all. Modify the algorithm to include a minimum speed to ensure the robot keeps moving, even when the proportional control equation produces an unrealistically low, commanded speed.
Write out the entire algorithm in pseudo code for turning a robot using proportional control and a gyro sensor. Parameters will include, minimum speed, maximum speed, desired heading, and turning radius.
----------------------------------
Here’s a robust pseudo-code algorithm incorporating your suggestions to handle the issues of overshooting, jerky starts, and realistic speed thresholds:
FUNCTION TurnRobot(desired_heading, min_speed, max_speed, turning_radius):
# Initialization
current_heading ← GyroSensor.get_heading() # Initialize current heading from gyro
heading_error ← desired_heading - current_heading
direction ← SIGN(heading_error) # Determine turn direction (+1 for clockwise, -1 for counterclockwise)
proportional_gain ← 0.1 # Tune this value to scale the response
# Speed Ramp-Up Initialization
ramp_up_rate ← 0.05 # Speed increment per iteration
current_speed ← min_speed # Start at minimum speed
# Start Turn
WHILE ABS(current_heading - desired_heading) > 0: # Loop until surpassing the target heading
# Update Current Heading
current_heading ← GyroSensor.get_heading()
heading_error ← ABS(desired_heading - current_heading)
# Check if Target Heading Surpassed
IF (direction > 0 AND current_heading >= desired_heading) OR
(direction < 0 AND current_heading <= desired_heading):
BREAK # Exit loop as heading is surpassed
# Compute Proportional Speed (Capped at Max Speed)
proportional_speed ← proportional_gain * heading_error
proportional_speed ← CLAMP(proportional_speed, min_speed, max_speed)
# Gradually Ramp Up Speed
current_speed ← MIN(current_speed + ramp_up_rate, proportional_speed)
# Set Wheel Speeds for Turning
inner_wheel_speed ← direction * current_speed * (1 - turning_radius / (turning_radius + wheel_base / 2))
outer_wheel_speed ← direction * current_speed * (1 + turning_radius / (turning_radius + wheel_base / 2))
MotorController.set_wheel_speeds(inner_wheel_speed, outer_wheel_speed)
# Stop the Robot After Surpassing the Target Heading
MotorController.stop()
END FUNCTION
min_speed
and max_speed
to avoid excessive speed or robot immobility.ramp_up_rate
ensures that the robot gradually accelerates from the min_speed
to the computed proportional speed, avoiding sudden jerks.turning_radius
and wheel_base
to achieve the desired turn geometry.desired_heading
: Target orientation in degrees.min_speed
: Minimum speed to ensure motion occurs (e.g., determined experimentally).max_speed
: Maximum speed to limit rapid turns.turning_radius
: Radius of the turning arc (use 0
for spin turns).ramp_up_rate
: Incremental speed increase per iteration for smooth acceleration.proportional_gain
: Tuning parameter to control responsiveness of the turn.TurnRobot(desired_heading=90, min_speed=0.1, max_speed=1.0, turning_radius=0)
This call would execute a smooth, spin turn to 90 degrees with controlled acceleration and deceleration, ensuring no dithering or unnecessary corrections.
Is it just me or sometimes the broadcast (for multitasking) cant work properly. Its like some programs are skipped. Is there solution for that?
In the submerged challenge, the field setup says that the top of the coral tree must touch the mat. Ours does not. We've tried assembling the whole model again. We tried to make the change suggested in the first update (Update 1: coal nursery setup) as well (although it's very confusing). Does the black ring at the top of the tree touch the mat for all of you? Any suggestions about what we could be doing wrong?
Andymark has a great sale going on "ROBODEAL24" on prior years mission model kits. Just FYI
My son (13) is in FLL and has been loving learning Python this year. He would love to continue learning at home so I would love to give him a way to do that. The problem is I don’t know where to start! Is there a small kit or set that I can get for him where he can work on these skills & learning at home? I know there are books and things I can get him but he loves interacting with something tactile and learning with his hands…
Hi all! I'm a new team supervisior, and I feel one of the limiting factors for my team is the way our lego is stored. Currently, there are thousands of pieces in 3 big tubs with no organization. If students had an easy system to find the parts they need I think they would be more motivated to innovate and make the necessary changes for their robot.
Just curious if any of you have a system that works. I understand that organizing it will take time, but I'm not really sure where to even start.
Thanks!
I have made it through the entry coemption to get into regionals and I need some help developing moving code in python
I am using Oracle virtualbox v6.1.32. My virtual machine is running windows XP x32 and the laptops is is windows 10. The firmware loads onto the RCX just fine, but when it tries to load the programs onto the RCX it has a communication error.
Hi All - a local school teacher is helping some underprivileged kids raise funding for creating an FLL team. The School used to sponsor this program, however, they decided to not sponsor it this year and the students missed the timeline for grant applications. Your help would be greatly appreciated.
Can we change little things like arms or attachments on the robot in the home area during the 2.5 minutes?
This question is for FLL Submerged 2024.
Hi All,
Our team qualified for the regionals. We are based in SE Michigan.
I wonder if anybody in this group is willing to give their mat and the pieces which will greatly help us practice for the regionals. We have one set but a second one will be useful.
Anybody on this group willing to donate or sell their used mat and pieces (and maybe robot) to us.
This is Lego Submerged Kit for grade 4 and 5.
Thanks.
I've seen systems with gyro and relative position of the motors to make a robot turn everytime the same, but I'm having the problem that sometimes the robot walks 10 cm, and then he walks more or less, does anyone have any code that makes he walks the same everytime?
Does anyone have any trick that they used during Qualifications that the judges really liked? We had a fun skit, colorful board, diagram on how our project would work, and we are considering making a social media for our team so we can reach out to different companies.
Hello, looking to build a table for my kids. Looking the specified dimension on FLL website states.
The wall-to-wall dimensions must measure 93±1/8” by 45±1/8”
Would having a larger width at 47" effect anything?
https://youtu.be/Iq7BIvdjDnM?si=bzygmHRjAtRzyMuC&t=1177
I'm not using the programming in this video, but I'm having the same problem. I understood that the robot, when it reaches the final angle, does not find it and keeps rotating around that value. Could you help me?
In my program I only use Proportional. I define a power of 15 or -15 for the robot at the beginning of the program, and then for each motor it will add a proportional value in relation to the angle, then it kind of slows down and always ends up with the value that I entered initially .
Guys I'm now I'm FTC but I'm trying to improve fll movements, the turns and straight and back it's so unreliable, all I can find is about yaw, but with my experience, this sensor is extremely unreliable, does anyone know how to make turns and movements precise? I was thinking on position and relative position of the motors
Hi, so my team and I started using pythfinder(a Python library with which you can create trajectories and make it easier to program the robot). Pythfinder gives one a txt file with different information, but I can't even read it in the spike app. Does anyone know if it would be possible to do this and how?
Hello everyone!
Please consider taking this survey created by our FLL Challenge team Beta Artists to provide feedback on their innovation project idea:
https://forms.gle/ZCmL6t5127jwHTqEA
There is a presentation and prototype link in the first section with some explanation of their idea.
Thanks and all the best!
Hey All!
We're an FLL team from Dover, NH and we'd love If you could fill out a quick survey! It's about 30 seconds long and it assists with our Innovation Project. It's linked here!
My team did really well last season but just isn't motivated this year. I know it's still early, but they've got about 260 points. I don't think that will get them past the first qualifier. Where are you guys?
First year team question - are teams required to wear matching shirts for the tournament?
Hi guys, I made a simple PID line follower but we don't know how we can change it from time based to distance based. If anyone could help change it to distance based it would be very helpful.
Hey! I don´t know if It´s usual or not, but we´ve contacted over 20 organizations and they all tell us they are busy or that we´ve aren´t an interesting team nor company. Is it that we are contacting too high-rated organizations and that we should contact smaller ones?
Hi! im starting saying im not english native, so im sorry if I say something the wrong way I was running programs on the spyke prime, from the lego education windows app, and suddenly it didnt recieve any program... the bluetooth is working, it does connect with my app, i can se the grades and its ok, gyroscope ok... its not a connection problem... but when i "download" or "send" a program to run on my spyke, the spyke dont recieve nothing...
somebody has an idea? im running out of them :/
I'm wondering if it's possible to complete the mission in ways not depicted in the original video. Specifically, my kids are wondering if they can knock down the whale and push the krill into the whale's mouth, then set it back upright in order to complete the mission. I'm looking at the rule book and I don't see anything that suggests they can't do this? Any advice would be appreciated. Thank you!
We didn't find out until the last week that although we will receive feedback from our judging session, we will not know how our overall scored compared to the other teams at the event. Effectively what happened is that the judges met in a room, debated amongst themselves, came out of their room, and announced who advanced, without any transparency. Is this normal for all qualifying tournaments in FLL Challenge?
For an engineering focused tournament, it seems odd that 75% of the points are subjective and kept secret.
For a bit of background, although we didn't expect to qualify, we did expect to know how close we came to qualifying. Missing by one is completely different than being ranked last, which would require a complete rethink of strategy.
Since some FLL teams have already competed - my PDP is claiming we need to offest the competition tables by 3.75" and screw them together due to the submarine mission. He says this is coming from FIRST. Anyone else heard/seen this? My club built/stores our region's tables and I'm nervous about screwing and unscrewing them together over 4 competitions this season and not ruining them. I can't find anywhere public that says this.