SoftBank Robotics documentation What's new in NAOqi 2.8?

qiFramework 1.6.9

Complete support of optional libqi type

  • In C++, optional type is boost::optional<T>
  • In qilang, optional type is Opt<T>
  • In Python, everywhere an Opt<T> is expected, either a T valuer or None can be used

Note

qilang C++ code generator (qicc) declares all struct fields of Opt type as optional fields, in order that compatibility with other versions of the struct where Opt fields are missing (typically older versions) is kept.

IDL example

struct MyData // v1
x: Opt<int>
End

interface MyObject
fn action(data:MyData)
end

Then later we can add new data fields as long as they are optional without breaking the protocol compatibility:

struct MyData // v2
x: Opt<int>
y: Opt<int>
End

Optional types can also be used as normal function parameters or returned value:

interface MyObject
fn action(data:Opt<int>) -> Opt<int>
End