Kinovarobotics / kortex

Code examples and API documentation for KINOVA® KORTEX™ robotic arms
https://www.kinovarobotics.com/
Other
107 stars 84 forks source link

Using the gen3_lite robot, how to get the position and velocity feedback of the robot in the method of waypoint_trajectory point trajectory planning? #183

Open xh16166 opened 10 months ago

xh16166 commented 10 months ago

Dear Kinova team,

I am currently learning how to use the Kinova Gen3 Lite robot for trajectory planning. I would like to perform point trajectory planning based on the official tutorial 110_WayPoints. Additionally, I hope to receive feedback from the robot while it is in motion, such as joint angles and velocities. However, I am not sure how to obtain feedback information when the robot is performing WayPoints motion. Therefore, I would like to ask how to write a program and if there is a specific reference example available. Thank you very much.

Best regards, xh

felixmaisonneuve commented 9 months ago

Hi @xh16166,

Sory for the delay,

The first thing you would need to do is create a "router_realtime" (with a UDP connection) and create a BaseCyclic object. Like this : https://github.com/Kinovarobotics/kortex/blob/6f557a8c65d5b5d8e83bf4966604788a05713658/api_cpp/examples/200-Actuator_low_level_control/01-actuator_low_level_velocity_control.cpp#L250-L275

Then, in your code, you can use your BaseCyclic to fetch feedback by calling k_api::BaseCyclic::Feedback base_feedback = base_cyclic->RefreshFeedback();

From the feedback, you can access all the data you want for the base, every actuator and the interconnect. Refer to the Feedback page for more details.

With that, you can either create a thread that runs at the same time as your waypoint thread on create a loop after sending your WaypointList and fetch feedback every ms.

I went over it a bit fast. If you have any questions, I will be happy to help you.

Best, Felix