Conversation
| // Attempt automatic error recovery to clear any previous error state | ||
| // This ensures the robot is ready for control even if the previous run ended with an error | ||
| try { | ||
| robot->automaticErrorRecovery(); |
There was a problem hiding this comment.
Please remove redundant comments -> I guess the function 'automaticErrorRecovery' explains already what the comment is telling :)
common/src/robot_api.cpp
Outdated
| robot = std::make_unique<franka::Robot>(robotIPString); | ||
|
|
||
| // Attempt automatic error recovery to clear any previous error state | ||
| // This ensures the robot is ready for control even if the previous run ended with an error |
There was a problem hiding this comment.
Why is all of this necessary?
Wasn't the user able to build the whole thing so far?
There was a problem hiding this comment.
The user can still build the project at will by choosing freely any desired build method. These are definitely not a "must".
The story so far regarding this build infra:
These are dev tools developed so we can handle testing and evaluation complexity as the toolbox involves binaries for the matlab/simulink mex front end for Windows and Ubuntu Host PC, combined with the back-end layer (robot_api stuff under common + rpc server) for both Jetson (Franka AI companion) + amd64 targets.
This build infrastructure allow us to drive the github workflows for delivering a standalone "drag-and-drop" final franka.mtlbx which is the standard Matlab Toolbox distribution format.
There was a problem hiding this comment.
Same answer as previous comment.
|
|
||
| # Build Cap'n Proto (static libraries with PIC) | ||
| CAPNP_VERSION="1.0.2" | ||
| curl -O https://capnproto.org/capnproto-c++-${CAPNP_VERSION}.tar.gz |
There was a problem hiding this comment.
We opted for a client-server architecture in order to add support for the Franka AI companion (and generally jetson platforms) for our Matlab API (not simulink in this case). Main drive for the capnproto against other alternatives was it's light weight structure, quite simple straightforward and clean API in combination with its delivery of a simple out-of-the-box rpc server framework.
There was a problem hiding this comment.
I don't understand it. It doesn't make sense to add support via proto towards the matlab api. Either you can use the matlab api directly e.g. via simulink or matlab or you don't need matlab and go directly via libfranka :)
If we would add support to communicate via protos (or something similar), we would introduce that on a libfranka level.
There was a problem hiding this comment.
The problem formulation and the motivation behind this was at the time (~1.5-2y ago):
- Windows support if very attractive for Matlab users. Windows has no rt capability (at least adequate for robustly maintaining the FCI 1khz thing). Additionally RT for some workstation setup is painful even for Ubuntu (NVIDIA GPU confict etc).
- We do want some high-level Matlab API support for the robot (not libfranka 1khz level rather than just simple joint point to point motion, traj open-loop follow up) as a feature in order for the users to be able to rapid-prototype and evaluate Matlab infra directly on the robot.
- Support for the Franka AI companion in conjunction Matlab (client running in workstation PC non rt)
Given 1, 2 and 3 we opted for a server-client architecture for supporting our Matlab API.
This is very similar actually with other popular high-level APIs for the robot in python like polymetis and deoxys control.
This architecture was not introduced with this PR btw and is already active since the release of version 1.0.0.
If things have changed regarding the 1 2 and 3 constraints we can drop support for the high-level Matlab API all together. Or supported only in the case where the Matlab is running in RT kernel Ubuntu Host PC.
Please let me know on how you'd like to proceed on that. In my humble opinion this discussion is outside the scope of the current PR and should be part of the overall project dev roadmap.
There was a problem hiding this comment.
Yes of course, that topic is outside of the scope of this :)
I was mostly curious on the 'why'.
|
|
||
| // Set Joint Impedance | ||
| if (!strcmp("set_joint_impedance", cmd)) { | ||
| if (nlhs != 1 || nrhs != 3) |
There was a problem hiding this comment.
These are the number of the given return outputs (nlhs) and and the given function arguments (nrhs) that the user has typed in matlab when calling a function. (standard Matlab nomenclature).
Like e.g >> [a,b,c] = matlab_foo(d,e,f,g) would mean nlhs = 3 and nrhs = 4.
Hence some sanity check in this case when the user is calling our Matlab API methods.
| } | ||
|
|
||
| // Set Joint Impedance | ||
| if (!strcmp("set_joint_impedance", cmd)) { |
There was a problem hiding this comment.
Why do you need to use a strcmp and not just ==?
There was a problem hiding this comment.
It's a balance act dealing with the Matlab mex function style which is traditionally C :).
(Yes there is a more recent C++ infra for Matlab mex function but I've faced interoperability issues in the past and still the standard C mex api is the more mature and "standard" framework.)
Based on that e.g for parsing the matlab cmd we do:
char cmd[64];
mxGetString(prhs[0], cmd, sizeof(cmd)))
which "forces us" into the C-style strcmp().
Again "matlaby" mex function idiomatic stuff.
| } | ||
|
|
||
| // Set Joint Impedance | ||
| if (!strcmp("set_joint_impedance", cmd)) { |
There was a problem hiding this comment.
Where these functions not yet available or why the introduction?
There was a problem hiding this comment.
Yep they were not available as part of the Matlab API of ours. The previous version 1.0.0 included a subset of the libfranka available methods. This PR includes these residual functions following the commonly agreed development roadmap of the project.
| #include <franka/robot.h> | ||
| #include <array> | ||
|
|
||
| kj::Promise<void> FrankaRobotRPCServiceImpl::setK( |
There was a problem hiding this comment.
We opted for a client-server architecture in order to add support for the Franka AI companion (and generally jetson platforms) for our Matlab API (not simulink in this case). Main drive for the capnproto against other alternatives was it's light weight structure, quite simple straightforward and clean API in combination with its delivery of a simple out-of-the-box rpc server framework.
New Franka Toolbox release 4.0.0 including:
FrankaRobotSettingsclass for centralized robot configuration.setJointImpedance,setCartesianImpedance), guiding mode (setGuidingMode), frame transformations (setEE,setK), and motion control (stop).Full build with github workflow build-and-release.yml which is activated when pushing tags to the remote.
you can check the outcome of the release process here --> https://github.com/kvasios/franka_toolbox_for_matlab/releases