Skip to content

error: cannot convert '<unresolved overloaded function type>' to 'std::function<void(OdomDebug::state_t)>' #3

@MiPlayer123

Description

@MiPlayer123

Hello. I am trying to use odomDebug and I am running into an error. I have the template installed in my project. Here is the error:

Compiled src/main.cpp make: *** [common.mk:270: bin/main.cpp.o] Error 1
[ERRORS]
src/main.cpp: In function 'void opcontrol()':
src/main.cpp:116:35: error: cannot convert '<unresolved overloaded function type>' to 'std::function<void(OdomDebug::state_t)>'
  116 |  display.setStateCallback(setState);
      |                                   ^
In file included from ./include/main.h:83,
                 from src/main.cpp:1:
./include/odomDebug/odomDebug.hpp:79:60: note:   initializing argument 1 of 'void OdomDebug::setStateCallback(std::function<void(OdomDebug::state_t)>)'
   79 |   void setStateCallback(std::function<void(state_t state)> callback);
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
ERROR - pros.cli.build:make - Failed to make project: Exit Code 2

Here is the code I am using:

void setState(OdomDebug::state_t state) {
	chassis->setState({state.x, state.y, state.theta});
}
void resetSensors() {
	// reset sensors and reset odometry
	chassis->setState({0_in, 0_in, 0_deg});
}

void opcontrol() {
    OdomDebug display(lv_scr_act(), LV_COLOR_ORANGE);
	display.setStateCallback(setState);
	display.setResetCallback(resetSensors);
    while(true) {
        //chassis->getModel()->tank(controller.getAnalog(ControllerAnalog::leftY), controller.getAnalog(ControllerAnalog::rightY));
        display.setData({chassis->getState()}, {LOdom.get(), ROdom.get()});
        pros::delay(10);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions