You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to write an Odrive C++ client by using the test_node.cpp in the test directory as a reference to instantiate the required helper objects using the latest API found in libfibre.h. I managed to compile my application with no errors but was wondering how does one access/run the functions similar to what is demonstrated in the JS demo?
The odrive interfaces has also been created by passing the latest odrive-interface.yaml from the Odrive repository to the generator tool.
here's my on_found_cb function:
void on_found_cb(void* fibre_obj_ptr, LibFibreObject* obj, LibFibreInterface* intf, const char* path, size_t path_length) {
fibre_obj_ptr = obj;
// I tried this with no luck
//obj->get_vbus_voltage();
//obj->vel_input(2);
//from odrive interfce:
//In `CONTROL_MODE_VELOCITY_CONTROL`, sets the desired velocity of the axis.
}
I also managed to port the old example to use the new API but am not so sure how to access the returned value after the function call and pass arguments to the remote functions.
Another version of on_found_cb function:
void on_found_cb(void* fibre_obj_ptr, LibFibreObject* obj, LibFibreInterface* intf, const char* path, size_t path_length) {
fibre_obj_ptr = obj;
LibFibreInterfaceInfo* info = libfibre_get_interface_info(intf);
for (size_t i = 0; i < sizeof(info->functions); ++i) {
if (std::strcmp(info->name, "get_vbus_voltage") == 0)
{
LibFibreObject** child_obj_ptr;
libfibre_get_attribute(intf, obj, i, child_obj_ptr);
fibre::Function* func = reinterpret_cast<fibre::Function*>(info->functions[i]);
CoroAsFunc* call = new CoroAsFunc{func};
uint8_t tx_buf[sizeof(LibFibreObject*)];
*(LibFibreObject**)tx_buf = obj;
cbufptr_t args[] = {tx_buf};
call->call(&args[0], 1, &on_finished_call);
}
}
libfibre_free_interface_info(info);
}
Thank you!
The text was updated successfully, but these errors were encountered:
grassjelly
changed the title
running function from C++ client
How to call remote functions from a C++ client
May 2, 2023
I am trying to write an Odrive C++ client by using the test_node.cpp in the test directory as a reference to instantiate the required helper objects using the latest API found in libfibre.h. I managed to compile my application with no errors but was wondering how does one access/run the functions similar to what is demonstrated in the JS demo?
The odrive interfaces has also been created by passing the latest odrive-interface.yaml from the Odrive repository to the generator tool.
here's my on_found_cb function:
I also managed to port the old example to use the new API but am not so sure how to access the returned value after the function call and pass arguments to the remote functions.
Another version of on_found_cb function:
Thank you!
The text was updated successfully, but these errors were encountered: