Skip to content

Backend support for real Kinova control with ft and gripper - #2

Open
KishanSawant wants to merge 8 commits into
devfrom
idle-real-backend
Open

Backend support for real Kinova control with ft and gripper#2
KishanSawant wants to merge 8 commits into
devfrom
idle-real-backend

Conversation

@KishanSawant

@KishanSawant KishanSawant commented Jul 23, 2026

Copy link
Copy Markdown

Summary

Adds generated real-hardware control for the Kinova Gen3 through the robif2b backend, with optional Robotiq FT-sensor and 2F-85 gripper communication.

Changes

  • Generate and build a robif2b CMake target.
  • Configure the Kinova through MOTION_SPEC_KINOVA_IP.
  • Reuses the existing automatically derived wrench_outputs to conditionally generate real FT-sensor support and wire measured hardware data into the model’s generated wrench objects.
  • Use the model timestep as the Kinova control period.
  • Reject non-finite commands and handle configure, update and shutdown failures.
  • Log joint torque commands.

Robotiq devices

  • The Kinova arm is always controlled.
  • Select peripheral communication with MOTION_SPEC_COMMUNICATION_DEVICES env variable:
    arm, ft, gripper, ft,gripper, or all.
  • Peripheral communication defaults to disabled (arm).
  • Configure serial ports through env variables:
    • MOTION_SPEC_ROBOTIQ_FT_PORT
    • MOTION_SPEC_ROBOTIQ_GRIPPER_PORT
  • Configure startup FT bias sampling through MOTION_SPEC_ROBOTIQ_FT_BIAS_SAMPLES (100 by default, 0 disables it).
  • Generate FT code only when the model declares a measured FT wrench.
  • Generate gripper support independently of wrench presence.
  • Wire FT measurements to the automatically generated wrench IDs rather than a hardcoded wrench name.
  • Cleanly stop device worker threads and configured hardware.

MOTION_SPEC_COMMUNICATION_DEVICES only selects devices supported by the
generated model. Selecting ft for a model without a declared FT wrench does not add FT support.

Model and introspection

  • Keep the base Kinova URDF payload-free.
  • Add a separate Kinova URDF containing the fixed FT frame and combined FT-sensor/2F-85 payload inertia.
  • Add a dummy URDF root for KDL root-inertia compatibility.
  • Support case and namespace differences in KDL link lookup.
  • Derive commanded-torque log channels from the declared serial kinematic chain instead of assuming seven joints.
  • Log post-saturation commanded joint torques.
  • Correct elapsed-monitor introspection timing.
  • Flush protobuf frame logs before backend teardown.
  • Preserve runtime-TTL recovery coverage for generated runs.

Comment thread code-generator/main.stg

app-arm-includes(backend, has_arm) ::= <<
<({app-arm-includes-<backend>})(has_arm)>
app-arm-includes(backend, has_arm, wrench_outputs) ::= <<

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all these changes with passing wrench_outputs as an arg to methods have to go. not a right implementation. for eg. its being passed to mujoco templates also even though not being used. and a very specific case for wrench. this should be coming from sensors.

Comment thread code-generator/main.stg

app-arm-post-setup(backend, arm_solvers, motions) ::= <<
<({app-arm-post-setup-<backend>})(arm_solvers, motions)>
app-arm-start(backend, arm_solvers, fsm_namespace, fsm_step_event, fsm_step_event_idx) ::= <<

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why fsm specifics being passed??

>>

app-arm-includes-mj_kdl(has_arm) ::= <<
app-arm-includes-mj_kdl(has_arm, wrench_outputs) ::= <<

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented above

)
# ST4 treats an empty list as present in <if(...)>. Keep the automatically
# derived wrench list, but expose its empty case as null to template guards.
if not ir.get("wrench_outputs"):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too specific fix

@vamsikalagaturu

Copy link
Copy Markdown

MOTION_SPEC_COMMUNICATION_DEVICES this is not the way to specify or load urdf. this is the issuse with composability.

given we have scene graph now, we should generate kdl chain from the ktree. and use that. that will let us compose in graph. instead of this.

@vamsikalagaturu

Copy link
Copy Markdown

@minhnh dont need to review this. as the codebase itself is still in dev stage. i havent finished with it and need lot of refinements.

@vamsikalagaturu

Copy link
Copy Markdown

@KishanSawant you can keep this open and work on the real world experiments (u can make changes as u need). i have only had a brief look at PR. I can address all once i get back next week.

robot-init-robif2b-KinovaGen3(solver) ::= <<
<if(solver.runtime_owner)> robif2b_kinova_gen3_nbx kinova_<solver.runtime_id>{};
kinova_<solver.runtime_id>.conf.ip_address = "<ip-lookup.(solver.id)>";
const char *kinova_<solver.runtime_id>_ip = std::getenv("MOTION_SPEC_KINOVA_IP");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these has to come from a config file rather than env.

\} robif2b_ft;
<endif>

struct robif2b_gripper_runtime {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this not in an if block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants