Solving some important issues
Index
- RA Testing RTF and frequency
- RA Helping fixing follow line
- RA issue #2713
- RA Testing Ackerman universes/scalings
- RA Testing ThreadingGUI to MeasuringGUI
- RA Testing change to MeasuringGUI
- RAM issue #156
- RAM issue #161
RA Testing RTF and frequency
This implementation includes viewing RTF, iteration frequency, ROS version and GPU usage.
RA Helping fixing follow line
In this exercise, neither the map nor the lap time were being displayed. I was looking for the source of the problem, which turned out to be somewhere else than what my colleagues thought. For some reason the files configured to perform the correct display were not being used. After some tests I managed to get it to work with the previously implemented version, but this one had some bugs. Thanks to the work of my colleagues they solved it in a different way and the issue was closed.
RA issue #2713
Solution that kills the docker image to avoid port occupied
Sometimes it is likely to encounter a port occupied error, to solve this, the -t option has been added, where you must specify the miniradi tag you are going to use, by default it will be latest
.
1
sh scripts/develop_academy.sh -t <miniradi tag>
If you need more information about the options available for launching the script, you can use:
1
sh scripts/develop_academy.sh -h
Which will display a help message.
The help message:
1
2
3
4
5
6
7
8
9
10
show_help() {
echo "Options:"
echo " -r Specify the RAM version repository URL (default: https://github.com/JdeRobot/RoboticsApplicationManager.git)"
echo " -b Specify the branch of RAM (default: humble-devel)"
echo " -i Specify the ROS2 version (default: humble)"
echo " -g Enable GPU mode (default: false)"
echo " -n Enable Nvidia support (default: false)"
echo " -t Specify the container image (default: latest)"
echo " -h Display this help message"
}
New modification:
1
2
3
4
5
6
# Check if a container with the name is running or exists and remove it if necessary
running_container=$(docker ps -a --filter "ancestor=jderobot/robotics-backend:$container_name" --format "")
if [ -n "$running_container" ]; then
echo "Removing existing container(s)..."
docker rm $running_container
fi
RA Testing Ackerman universes/scalings
Here we simply tested whether the new universes and scales for the cars were well changed.
RA Testing ThreadingGUI to MeasuringGUI
For testing create a new mini RoboticsBackend with the following line:
1
sudo ./build.sh -a adding-rtf-gui -t measuring-gui
Then change the gui in any excercise from threading_gui to measuring_threading_gui.
After testing in the follow line exercise, it now updates correctly:
RA Testing change to MeasuringGUI
For testing is needed to generate a miniRADI wit the following instructions:
1
sudo ./build.sh -t adding-rtf
Errors detected on this line, it seems that the .css file is not included.
1
import "../../styles/visualizers/Frequencies.css";
More issues with files not found
1
2
import monitor from "../../images/monitoring2.png";
RAM issue #156
The problem is that the same output port was always sought to send the errors detected in the program via the terminal. Some exercises used a different port, so this had to be fixed.
New function to search consoles:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
def find_docker_console():
"""Search console in docker different of /dev/pts/0"""
pts_consoles = [f"/dev/pts/{dev}" for dev in os.listdir('/dev/pts/') if dev.isdigit()]
consoles = []
for console in pts_consoles:
if console != "/dev/pts/0":
try:
# Search if it's a console
with open(console, 'w') as f:
f.write("")
consoles.append(console)
except Exception:
# Continue searching
continue
# raise Exception("No active console other than /dev/pts/0")
return consoles
How it’s works:
1
2
3
4
5
6
console_path = find_docker_console()
for i in console_path:
with open(i, 'w') as console:
console.write(errors + "\n\n")
raise Exception(errors)
RAM issue #161
The bug here was that sometimes, by abruptly closing the connection to the client, an attempt could be made to send a message to a client that no longer existed, resulting in an error. This is a concurrency problem, and to solve it, locks were used.
Functions implemented with locks:
1
2
3
4
5
6
7
8
9
10
def send(self, data):
with self.client_lock:
if self.current_client is not None:
self.server.send_message(self.current_client, data)
def on_close(self, client, server):
LogManager.logger.info("Connection with client closed")
with self.client_lock:
if client == self.current_client:
self.current_client = None
This way, if the server is sending a message, the client must wait before closing the connection.