matthias-mayr / Cartesian-Impedance-Controller

A C++ implementation of Cartesian impedance control for torque-controlled manipulators with ROS bindings.
https://matthias-mayr.github.io/Cartesian-Impedance-Controller/
BSD 3-Clause "New" or "Revised" License
204 stars 32 forks source link

Can franka be supported? #4

Closed mao8-explorer closed 1 year ago

mao8-explorer commented 1 year ago

Is there a package that can directly support franka?

matthias-mayr commented 1 year ago

This package does directly support then Panda. The controller just needs to be compiled and the configuration specified.

Lejou commented 1 year ago

Hi, I appreciate this work very much and I want to use it on Panda. @matthias-mayr I take your example of iiwa in the sim_controller.yaml and change it to panda configuration. But it seems that the franka gazebo can not work with this controller with the follow error in the terminator:


...
[ INFO] [1687773077.808108916, 0.364000000]: Initializing Cartesian impedance controller in namespace: /CartesianImpedance_trajectory_controller
[ INFO] [1687773077.809212367, 0.365000000]: End effektor link is: panda_link8
[ INFO] [1687773077.827995057, 0.371000000]: Number of joints specified in parameters: 7
0
[panda_model_spawner-4] process has finished cleanly
log file: /home/lee/.ros/log/fb616e3e-1406-11ee-8b5d-6b76650fee71/panda_model_spawner-4*.log
Segmentation fault (core dumped)
[gazebo-2] process has died [pid 64655, exit code 139, cmd /opt/ros/noetic/lib/gazebo_ros/gzserver -u -e ode worlds/empty.world __name:=gazebo __log:=/home/lee/.ros/log/fb616e3e-1406-11ee-8b5d-6b76650fee71/gazebo-2.log].
log file: /home/lee/.ros/log/fb616e3e-1406-11ee-8b5d-6b76650fee71/gazebo-2*.log
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 523, in call
    responses = transport.receive_once()
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_base.py", line 744, in receive_once
    self.stat_bytes += recv_buff(sock, b, p.buff_size)
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_base.py", line 111, in recv_buff
    raise TransportTerminated("unable to receive data from sender, check sender's logs for details")
rospy.exceptions.TransportTerminated: unable to receive data from sender, check sender's logs for details

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/ros/noetic/lib/controller_manager/spawner", line 219, in <module>
    if __name__ == '__main__': main()
  File "/opt/ros/noetic/lib/controller_manager/spawner", line 197, in main
    resp = load_controller(name)
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 442, in __call__
    return self.call(*args, **kwds)
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/impl/tcpros_service.py", line 533, in call
    raise ServiceException("transport error completing service call: %s"%(str(e)))
rospy.service.ServiceException: transport error completing service call: unable to receive data from sender, check sender's logs for details
[INFO] [1687773079.494856, 0.385000]: Shutting down spawner. Stopping and unloading controllers...
[INFO] [1687773079.496573, 0.385000]: Stopping all controllers...
[WARN] [1687773079.501183, 0.385000]: Controller Spawner error while taking down controllers: unable to connect to service: [Errno 111] Connection refused
[panda_controller_spawner-5] process has died [pid 64666, exit code 1, cmd /opt/ros/noetic/lib/controller_manager/spawner --wait-for initialized franka_state_controller CartesianImpedance_trajectory_controller __name:=panda_controller_spawner __log:=/home/lee/.ros/log/fb616e3e-1406-11ee-8b5d-6b76650fee71/panda_controller_spawner-5.log].
log file: /home/lee/.ros/log/fb616e3e-1406-11ee-8b5d-6b76650fee71/panda_controller_spawner-5*.log

The controller can be found but there is a service that can not be able to connect. I guess the gazebo could not recognize this controller, although it is based on hardware_interface::EffortJointInterface, or the code is crashed somewhere. The problem is probably related to:

[ INFO] [1687773077.827995057, 0.371000000]: Number of joints specified in parameters: 7 0 while there is a "0" here. I check the code and have on idea where is incorrect.

Any advice on it? or I have to use it with the real one?