frankx icon indicating copy to clipboard operation
frankx copied to clipboard

Get state while moving

Open guenhael opened this issue 3 years ago • 6 comments

Hello,

Is there any way to get information like the pose or the "active waypoint" while the robot is moving? It would be very useful.

I tried to do it with Robot.move_async and then Robot.read_once() but it's not permitted.

Thank you for your help.

guenhael avatar Jan 10 '22 14:01 guenhael

Following this! I'd like to be able to record robot poses while it is moving.

yuchen93 avatar Jul 11 '22 05:07 yuchen93

Hi, Following this too!

Toni-SM avatar Jul 26 '22 10:07 Toni-SM

Hello,

For your information, a solution has been programmed and can be found here : https://github.com/guenhael/frankx/tree/get_O_T_EE_while_moving

A pull request has been done to add this update to the official frankx library.

If you have any suggestion of improvement, let me know.

guenhael avatar Jul 29 '22 15:07 guenhael

Hi,

A solution for getting the robot state while moving, for all supported motions types can be found in the pull request https://github.com/pantor/frankx/pull/44

With this modification it is possible to get the state of the robot (stopped or in motion) by calling the original API as follow

robot = Robot("172.16.0.2")

# Get the current state handling the read exception when the robot is in motion
try:
    robot_state = robot.get_state()
except frankx.InvalidOperationException:
    robot_state = robot.get_state(read_once=False)

# Get the current pose handling the read exception when the robot is in motion
try:
    pose = robot.current_pose()
except frankx.InvalidOperationException:
    pose = robot.current_pose(read_once=False)

# Get the current joint positions handling the read exception when the robot is in motion
try:
    joint_positions = robot.current_joint_positions()
except frankx.InvalidOperationException:
    joint_positions = robot.current_joint_positions(read_once=False)

It use has been tested in a reinforcement learning application as exemplified in the skrl - Real-world examples documentation

Toni-SM avatar Sep 19 '22 21:09 Toni-SM

Following this!

lushihan avatar Sep 22 '22 08:09 lushihan

I am also following this. It would be nice to know the results of the PRs.

carloLV avatar Oct 12 '22 12:10 carloLV