RoboticaUtnFrba / create_autonomy

ROS autonomy stack for iRobot Create 2.
BSD 3-Clause "New" or "Revised" License
28 stars 38 forks source link

Add roscontrol #211

Closed serraramiro1 closed 4 years ago

serraramiro1 commented 4 years ago

Description

Adds roscontrol gazebo plugin, as well as a controller, and a hardware interface node to interface with the real robot

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

# Step 1
RVIZ=True RVIZ_CONFIG=navigation LOCALIZATION=amcl ROS_CONTROL=True roslaunch ca_gazebo create_house.launch 
# Step 2
use rviz UI to send goals

with real robot

# Step 1
ROS_CONTROL=true roslaunch ca_bringup minimal.launch 
# Step 2
roslaunch ca_tools keyboard_teleop.launch

Test Configuration:

Checklist:

eborghi10 commented 4 years ago

Travis is failing, please check this to fix it. The command that it uses is this and you try it locally:

catkin lint -W2 --strict --explain $CREATE_AUTONOMY_SRC --ignore plugin_missing_install --ignore target_name_collision

Replace $CREATE_AUTONOMY_SRC with the path to create_autonomy.

eborghi10 commented 4 years ago

Would you update the description of the PR?

eborghi10 commented 4 years ago

Gazebo (ros_control plugin?) is publishing the relationship odom --> base_link without the tf_prefix (createN_tf):

Screenshot from 2020-06-26 20-22-46

Check the parameters here to solve this issue: http://wiki.ros.org/diff_drive_controller

Also put a link to this wiki in create_2_control.yaml and complete the missing parameters.

serraramiro1 commented 4 years ago

Addressed most of the comments, please re-review @eborghi10

serraramiro1 commented 4 years ago

I made a few comments but I'll give it a try in sim & real robot later.

I'm pretty sure this won't work as is, I remember having to change the spinner in the hw interface to an async spinner, I can't test it for obvious reasons

eborghi10 commented 4 years ago

I made a few comments but I'll give it a try in sim & real robot later.

I'm pretty sure this won't work as is, I remember having to change the spinner in the hw interface to an async spinner, I can't test it for obvious reasons

I can give you access to the robot so you can debug the code.

eborghi10 commented 4 years ago

Can you rebase with latest kinetic-devel?

serraramiro1 commented 4 years ago

Can you rebase with latest kinetic-devel?

done

eborghi10 commented 4 years ago
[ERROR] [1593214361.220911060, 0.956000000]: No p gain specified for pid.  Namespace: /create1/gazebo_ros_control/pid_gains/wheel_left_joint                              │
[ERROR] [1593214361.221558857, 0.956000000]: No p gain specified for pid.  Namespace: /create1/gazebo_ros_control/pid_gains/wheel_right_joint  

Can you check if this can be fixed? Hint is here.

eborghi10 commented 4 years ago

move_base is not working. You can check two things to debug it:

  1. Topic remappings with rqt_graph. I checked that odom is not connected between move_base and ros_control. Also the velocity command is unconnected.
  2. Check the Tf prefixes.
serraramiro1 commented 4 years ago
[ERROR] [1593214361.220911060, 0.956000000]: No p gain specified for pid.  Namespace: /create1/gazebo_ros_control/pid_gains/wheel_left_joint                              │
[ERROR] [1593214361.221558857, 0.956000000]: No p gain specified for pid.  Namespace: /create1/gazebo_ros_control/pid_gains/wheel_right_joint  

Can you check if this can be fixed? Hint is here.

Set to 1 0 0, changing d value ends in odd results...

serraramiro1 commented 4 years ago

move_base is not working. You can check two things to debug it:

  1. Topic remappings with rqt_graph. I checked that odom is not connected between move_base and ros_control. Also the velocity command is unconnected.
  2. Check the Tf prefixes.

Addressed, added an external republisher, since controller's topics cant be remapped

eborghi10 commented 4 years ago
[ERROR] [1593214361.220911060, 0.956000000]: No p gain specified for pid.  Namespace: /create1/gazebo_ros_control/pid_gains/wheel_left_joint                              │
[ERROR] [1593214361.221558857, 0.956000000]: No p gain specified for pid.  Namespace: /create1/gazebo_ros_control/pid_gains/wheel_right_joint  

Can you check if this can be fixed? Hint is here.

Set to 1 0 0, changing d value ends in odd results...

I suspect that you should add at least 0.1 to the integral part (the second one).

eborghi10 commented 4 years ago

move_base is not working. You can check two things to debug it:

  1. Topic remappings with rqt_graph. I checked that odom is not connected between move_base and ros_control. Also the velocity command is unconnected.
  2. Check the Tf prefixes.

Addressed, added an external republisher, since controller's topics cant be remapped

Have you checked if the code doesn't have a way to changing it? Maybe it would be better to have our own copy of the code.

eborghi10 commented 4 years ago

I'm seeing this issue when running with the real robot:

Loading controller: mobile_base_controller
Traceback (most recent call last):
  File "/opt/ros/melodic/lib/controller_manager/spawner", line 212, in <module>
    if __name__ == '__main__': main()
  File "/opt/ros/melodic/lib/controller_manager/spawner", line 190, in main
    resp = load_controller(name)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 442, in __call__
    return self.call(*args, **kwds)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 512, in call
    raise ServiceException("unable to connect to service: %s"%e)
rospy.service.ServiceException: unable to connect to service: [Errno 104] Connection reset by peer
[INFO] [1593792112.905556]: Shutting down spawner. Stopping and unloading controllers...
[INFO] [1593792112.907553]: Stopping all controllers...
[WARN] [1593792112.911548]: Controller Spawner error while taking down controllers: unable to connect to service: [Errno 111] Connection refused
[create1/robot_hw_interface-4] process has died [pid 51963, exit code -6, cmd /create_ws/devel/lib/create_control/create_control_node __name:=robot_hw_interface __log:=/home/create/.ros/log/7f7d1f76-bd46-11ea-a694-9cb6d0e33077/create1-robot_hw_interface-4.log].
log file: /home/create/.ros/log/7f7d1f76-bd46-11ea-a694-9cb6d0e33077/create1-robot_hw_interface-4*.log
[create1/controller_spawner-5] process has died [pid 51969, exit code 1, cmd /opt/ros/melodic/lib/controller_manager/spawner mobile_base_controller __name:=controller_spawner __log:=/home/create/.ros/log/7f7d1f76-bd46-11ea-a694-9cb6d0e33077/create1-controller_spawner-5.log].
log file: /home/create/.ros/log/7f7d1f76-bd46-11ea-a694-9cb6d0e33077/create1-controller_spawner-5*.log