Robotics StackExchange | Archived questions

How to use ros2 control to balance something on a 2D plane?

Hi ROS community

For an experiment, I need to balance a ball on a 2D plane. I attached the 2D plane to a Franka Emika Panda robot arm. I already read the Franka Emika documentation and the ros2 control documentation.

I'm still quite confused, Some example controllers seem to use command_interfaces_ to control the joints. In this controller this doesn't seem to be the case.

In my case, I only need to modify/adjust the last two joints to control the 2 axis of the 2D plane. Can somebody guide me, how I can do this with the command_interfaces_ or do I need to use something else? I do have some basic knowledge in control theory and I did read the documentation and read through a couple of examples but I'm still quite puzzled how to use ros2 control with the Franka Emika Panda robot arm.

I appreciate any help and guidance.

Andreas

Asked by Andreas Ziegler on 2022-04-25 15:30:17 UTC

Comments

Answers

I haven't worked with Franka arms in particular, but what you have linked to is a joint_trajectory_controller modified to use an effort command interface. This controller will listen for JointTrajectory messages and will write joint torques to try and track those trajectories. It will behave a bit differently depending on the information provided (e.g. if only a position setpoint is provided, it will interpolate between the position setpoints, etc) but largely speaking, this controller is meant for things like manipulators, where some planner will generate some trajectory of joints that the robot then has to follow over time.

While not impossible to use it for ball balancing, I don't think it would be my first choice. Unless you want to predict the future trajectory of the ball and provide a trajectory of joint angles that the arm can follow to achieve some desired behavior, you probably want something a bit more reactive/direct to change joint angles as the ball position estimate is updated.

I would suggest taking a look at the ForwardCommand controllers. Extending one of them will allow you to define some control law and write commands directly to the joints on whatever interface you have available. In the case of the franka robot linked, it seems like you have access to the effort interface directly, so I would suggest starting by looking at the JointGroupEffortController. This is a ForwardCommand controller - it is only writing the command you give to hardware. So you could either make a child class that extends this controller, that writes effort commands based on your control law, or you could implement your ball balancing controller as a separate node, and have that publish joint commands directly (it will be expecting a Float64MultiArray with joint efforts, in the order in which the joints are defined in your controller config file). The latter approach is probably a bit easier to get started with but will introduce some latency.

Asked by shonigmann on 2022-04-25 19:03:13 UTC

Comments