Many okapilib PID and logging issues

I was trying to use okapilib for PID yesterday, and a lot of things went wrong (even though it had worked perfectly by doing the exact same thing on our previous robot (and I used almost exactly the same code, just changing some things for this robot)). First, I tried to just use the normal OdomChassisController (we don’t (well we do but only for programming skills which I wasn’t working on) have tracking wheels), and I accidentally set it to try to drive horizontally and had all the turning constants to 0, so of course it didn’t move. Not realizing that, I just wanted to try ChassisControllerIntegrated because I was wondering what that would be like, but I couldn’t figure out how to use it (and I couldn’t find any examples either). I was trying to do

std::shared_ptr\<ChassisControllerIntegratred\> db = ChassisControllerBuilder()
	.withMotors(/*left motors*/, /*right motors*/)
	.withDimenions({AbstractMotor::gearset::blue, /*gear ratio*/} /*later changed to the gearset * the gear ratio (yes it was a double)*/ {{/*wheel diameter*/, /*wheel track*/}, imev5tpr * /*reciprocal of gear ratio*/})

Which of course didn’t work by itself because it returned an ongoing builder, so I first tried adding .buildCCI() to it (because it appeared in my autocomplete and said that it builds a ChassisControllerIntegrated), but it said that that was protected, so I tried to find a non-protected one that worked, but I couldn’t find one. I looked at the okapi docs and looked it up, but couldn’t find any examples of how to make one, so I tried to cast it and even tried using ->buildCCI() and nothing worked. Since I didn’t actually plan to use ChassisControllerIntegrated anyway, I gave up and tried to just use ChassisControllerPID (since I wasn’t using full odom), which I also couldn’t figure out how to build (.buildCCPID() was also protected). Then, I realized what I had done wrong with OdomChassisController, and fixed it and it worked. I started trying to tune P (after a lot of messing around with gear ratios), but I noticed that (with values of the same magnitude that worked for our old robot), it either didn’t have enough power and acted like there was a kD that was too large (kD was 0 though) in that it was going to the target, stopping, trying to keep going, stopping again, and so on, but when I put kP higher (I tried values in the middle also), instead of oscillating then gradually slowing down like normal it violently went back and forth in an infinite loop, not slowing down at all and seeming to start rocking before it was even close to the target (which might have to do with the fact that our center of gravity is far back and we are light and fast (to the point where if we switch directions quickly while driving we almost tip over), but even still it seemed almost like it was using no p control at a constant speed, which was very weird). Thinking that there might have been something wrong with the error, I tried to log it by using the Logger (which I have never used before), but then I ran into another issue (which again I found no examples for). I am trying to use .withLogger({NULL, "log.txt", Logger::LogLevel::debug}) (log.txt is a file in src and I couldn’t figure out what to put for itimer so I just set it to null), but I am getting this error after a lot of confusing file paths before it: Users/[user]/Library/Application Support/Code/User/globalStorage/sigbots.pros/install/pros-toolchain-macos/arm-none-eabi/include/c++/10.3.1/bits/shared_ptr_base.h:669:11: error: '__d' cannot be used as a function. I think it might have to do with me putting null for itimer, but if anyone knows what should go there or what I am doing wrong, please let me know. Thank you!

Sorry, I meant ChassisControllerIntegrated (I had rewritten the code instead of copying it and made a typo) and I used backslashes to try to make it not an html tag but for some reason they showed up so ignore them.

Also, I messed up, log.txt is in the regular project directory, not src. Actually, I just tried putting it in src, and it changed the error a bit (I think this part was actually before the __d part and it just went away I guess). It is now (still with a lot of confusing file paths before it): /Users/[user]/Library/Application Support/Code/User/globalStorage/sigbots.pros/install/pros-toolchain-macos/arm-none-eabi/include/c++/10.3.1/bits/alloc_traits.h:78:11: error: no type named 'type' in 'struct std::__allocator_traits_base::__rebind<okapi::Logger::LogLevel, std::_Sp_counted_deleter<std::nullptr_t, const char*, okapi::Logger::LogLevel, __gnu_cxx::_S_single>, void>'

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.