Okapi V4 logger not working?

When I tried to enable the logger it crashes the pros terminal when pointed to use it. And it doesn’t even make a file on my sdcard when pointed there.

  Motor leftMotor(5, false, AbstractMotor::gearset::green, AbstractMotor::encoderUnits::degrees);
  Motor rightMotor(4, true, AbstractMotor::gearset::green, AbstractMotor::encoderUnits::degrees);
  Motor middleMotor(3, false, AbstractMotor::gearset::red, AbstractMotor::encoderUnits::degrees);

  // chassis declaration
  std::shared_ptr<ChassisController> chassis = ChassisControllerBuilder()
    .withMotors(leftMotor, rightMotor, middleMotor)
    .withSensors(leftEncoder, rightEncoder)
    .withDimensions({{4_in, 10_in}, imev5GreenTPR})
    .withLogger(
        std::make_shared<Logger>(
            TimeUtilFactory::createDefault().getTimer(), // It needs a Timer
            "/usd/Chassis_Diagnostics", // Output to the PROS terminal
            Logger::LogLevel::info // Most verbose log level
        )
    )
    .build();

Are you on the latest version (RC8)?

Yes, I’m using the h-drive one from your push request last week that was based off of RC8 I believe. Add HDriveModel by Octogonapus · Pull Request #394 · OkapiLib/OkapiLib · GitHub

Instead of guessing, please just check the version.

It’s from a pull request. Besides that the date is later than the RC8 build. I don’t know how to check the release I’m on.

You check it with prosv5 c inf, run inside a project. Please upgrade to the latest release.

This is what I got and I believe it to be up to date.

Name      Version    Origin
--------  ---------  -------------
kernel    3.2.0      pros-mainline
okapilib  4.0.0-RC8  local

I don’t trust your build, given that it is not from an official release. Otherwise, can you try to collect a stacktrace?

I can do that. How do you do that on the V5?

in case of a segfault or data abort exception, the first step is to make sure you run your program with the PROS terminal connected. When the exception occurs, you should see a section that starts with “BEGIN STACK TRACE” and contains a list of numbers. These numbers are the addresses of the instructions on the call stack at the time of the exception. Make a note of them. Now we can translate the addresses into filenames and even line numbers. Close the PROS terminal connection if you haven’t already, and run the following command: (For windows:)

"%PROS_TOOLCHAIN%\bin\arm-none-eabi-addr2line" -faps -e .\bin\hot.package.elf

(For linux/macos:)

arm-none-eabi-addr2line -faps -e ./bin/hot.package.elf

then you can paste in the addresses from earlier. Note: You may also need to change hot.package.elf to cold.package.elf if you get a bunch of question marks. Also if you don’t have the hot or cold packages, run with monolith.elf instead. This should give you the location of the line that triggered the exception.

2 Likes

This is all that I get from the terminal. The warning is from my h-drive I’m using a mixture of red and green motor cartridges.

         _+=+_
      .-`  .  `-.          8888888b.  8888888b.   .d88888b.   .d8888b.
   _+`     "     `+_       888   Y88b 888   Y88b d88P" "Y88b d88P  Y88b
  \\\sssssssssssss///      888    888 888    888 888     888 Y88b.
     .ss\  *  /ss.         888   d88P 888   d88P 888     888  "Y888b.
 .+bm  .s  *  s.  md+.     8888888P"  8888888P"  888     888     "Y88b.
.hMMMMs .  *  . sMMMMh.    888        888 T88b   888     888       "888
 `\hMMMb \ | / dMMMh:      888        888  T88b  Y88b. .d88P Y88b  d88P
   -SNMNo  -  oNMNs-       888        888   T88b  "Y88888P"   "Y8888P"
     `+dMh\./dMd/
        `:yNy:`                      Powered by PROS for VEX V5
           "                Copyright (c) Purdue University ACM SIGBots
Version:        3.2.0     Platform:  V1.0.8 (b124)     Uptime:    0.001 s
Compiled:   Nov 14 2019 15:24:08     Directory:  00/Documents/Pacman V2


2210 (My Task) WARN: ChassisControllerBuilder: The default gearset is selected. This could be a bug.

And when I run this arm-none-eabi-addr2line -faps -e ./bin/cold.package.elf and give it the memory address of the my task warning I get 0x00002210: ?? ??:0

2210 is not the memory address of your task. You see a memory permission error on the brain’s screen, but there is no stacktrace?

1 Like

That’s all I got back both from the brain screen and the pros terminal.

Is there a data abort message printed to the brain’s screen?

No all that is on the screen is a custom lvgl screen

That does not sound like a crash, then. Can you reproduce it in a new project?

That’s something I was thinking of trying, I’ll let you know. Do you want me to try the okapi RC8 build or the other one that I’ve been using?

Please try to only use official builds.

I created a new project with prosv5 conductor new-project test-project and put this in the main.cpp file.

#include "okapi/api.hpp"
using namespace okapi;

void opcontrol() {
auto drive = ChassisControllerBuilder()
                .withMotors(1, -2) // Left motor is 1, right motor is 2 (reversed)
                .withLogger(
                    std::make_shared<Logger>(
                        TimeUtilFactory::createDefault().getTimer(), // It needs a Timer
                        "/ser/sout", // Output to the PROS terminal
                        Logger::LogLevel::debug // Most verbose log level
                    )
                )
                .build();
}

When I run it on hardware with the terminal attached I get.

Version:        3.2.0     Platform:  V1.0.8 (b124)     Uptime:    0.001 s
Compiled:   Nov 14 2019 22:38:15     Directory:  Documents/test-project


2 (User Operator Control (PROS)) WARN: ChassisControllerBuilder: The default gearset is selected. This could be a bug.
2 (User Operator Control (PROS)) WARN: ChassisControllerBuilder: The calculated TPR from the given gearset and ratio (300) does not equal the TPR given in the ChassisScales (900). This is probably a bug.

Looks normal to me. What is the problem?