Skip to content

Robot motion tracking system

Motion Tracking System -- PepperΒΆ


IntroductionΒΆ

The robot motion tracking system is a system that allows the robot to track the user's motion and provide feedback based on the user's motion. The system consists of a Web Server, which actively listens for incoming data from the two ESP8266 modules. The ESP8266 modules are connected to the robot and are responsible for tracking the user's motion. These sensors send rotation data to the Web Server, which can then be parsed and used to provide feedback to the user.

System ArchitectureΒΆ

The system consists of three main components: the Web Server, the ESP8266 modules, and the Pepper robot. The Web Server is responsible for receiving data from the ESP8266 modules and processing it. The ESP8266 modules are responsible for sending rotation data to the web server, which is then parsed.

Parsing DataΒΆ

To parse the data received by the web server, one must utilize the class InputProcessor. This class is responsible for both starting the server and processing data received by the server. To start parsing data, one can do the following:

1
2
InputProcessor processor = new InputProcessor();
processor.startListening(); // This starts the web server.

To parse data received by the server, one can register an event listener with the InputProcessor class. This event listener will be called whenever new data is received by the server. To register an event listener, one can do the following:

1
2
3
4
5
6
processor.setInputHandler(new IInputHandler() {
    @Override
    public void accept(Vector3f rotationVector, int sensorId) {
        // Do something with the input.
    }
});

Providing FeedbackΒΆ

If one wants to provide feedback to the user, one must first provide an exercise to the InputProcessor object. This can be done by calling the setExercise(Exercise exercise) method. This method takes an Exercise object as a parameter. This object contains information about the exercise, such as the name of the exercise, the muscle group it targets, and the video associated with the exercise. One can then check the status of the current exercise by calling one of the following methods:

1
2
3
4
5
6
7
8
9
processor.getCurrentProgress(); // Returns the current progress of the exercise as a scalar (0 - 1)

processor.getError(int sensorId, float time); // Get the error offset for a given sensor at a given time

processor.getAverageError(int sensorId); // Get the average error for a given sensor

processor.secondsPassed(); // Get the number of seconds that have passed since the exercise started

processor.hasFinished(); // Check if the exercise has finished