0
$\begingroup$

enter image description hereQuestion edit Latest (09-Apr):

I wrote my own custom hardware interface called dig_cont (actuator interface and sensor interface) and I am able to compile and run successfully. I can see two different topic for dig_cont which is my actuator and sensor I have interfaced with. It has two different topics as shown. So I am going to send my microcontroller, a trigger signal to actuate and it gives a feedback back to the interface with its state. I did not implement a GPIO instead, I chose to send the trigger as velocity and receive its position for my actuator.

  1. I want to know which topic my sensor feedback updates to? All I can see is two different topics for dig_cont. I believe the trigger signal should be updated through /dig_cont/commands, am I right?

  2. Why is my controller name dig_cont not visible in rqt graph similar to diff_cont. Maybe It is not configured properly?

Feed:

ubuntu@MobileRobot:~/ros2_ws$ ros2 launch dandebot_description launch_robot.launch.py 
[INFO] [launch]: All log files can be found below /home/ubuntu/.ros/log/2024-04-09-09-41-49-037336-MobileRobot-19687
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [19691]
[INFO] [twist_mux-2]: process started with pid [19693]
[twist_mux-2] [INFO] [1712670109.378276539] [twist_mux]: Topic handler 'topics.joystick' subscribed to topic 'cmd_vel_joy': timeout = 0.500000s , priority = 100.
[twist_mux-2] [INFO] [1712670109.379431617] [twist_mux]: Topic handler 'topics.navigation' subscribed to topic 'cmd_vel': timeout = 0.500000s , priority = 10.
[twist_mux-2] [INFO] [1712670109.379640602] [twist_mux]: Topic handler 'topics.servo' subscribed to topic 'cmd_vel_servo': timeout = 0.500000s , priority = 100.
[robot_state_publisher-1] [WARN] [1712670109.389885430] [kdl_parser]: The root link base_link has an inertia specified in the URDF, but KDL does not support a root link with an inertia.  As a workaround, you can add an extra dummy link to your URDF.
[robot_state_publisher-1] [INFO] [1712670109.389953062] [robot_state_publisher]: got segment base_footprint
[robot_state_publisher-1] [INFO] [1712670109.390011924] [robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1712670109.390018656] [robot_state_publisher]: got segment camera_1
[robot_state_publisher-1] [INFO] [1712670109.390037998] [robot_state_publisher]: got segment digging_frame
[robot_state_publisher-1] [INFO] [1712670109.390042987] [robot_state_publisher]: got segment laser_1
[robot_state_publisher-1] [INFO] [1712670109.390060360] [robot_state_publisher]: got segment leftwheel_1
[robot_state_publisher-1] [INFO] [1712670109.390064929] [robot_state_publisher]: got segment rightwheel_1
[INFO] [ros2_control_node-3]: process started with pid [19753]
[INFO] [spawner-4]: process started with pid [19755]
[INFO] [spawner-5]: process started with pid [19757]
[INFO] [spawner-6]: process started with pid [19759]
[ros2_control_node-3] [WARN] [1712670114.992177586] [controller_manager]: [Deprecated] Passing the robot description parameter directly to the control_manager node is deprecated. Use '~/robot_description' topic from 'robot_state_publisher' instead.
[ros2_control_node-3] [INFO] [1712670114.992538295] [resource_manager]: Loading hardware 'dandebot' 
[ros2_control_node-3] [INFO] [1712670114.993326592] [resource_manager]: Initialize hardware 'dandebot' 
[ros2_control_node-3] [INFO] [1712670114.993509170] [DiffDriveArduino]: Configuring...
[ros2_control_node-3] [INFO] [1712670114.993793225] [DiffDriveArduino]: Finished Configuration
[ros2_control_node-3] [INFO] [1712670114.993806448] [resource_manager]: Successful initialization of hardware 'dandebot'
[ros2_control_node-3] [INFO] [1712670114.993948738] [resource_manager]: Loading hardware 'DigController' 
[ros2_control_node-3] [INFO] [1712670114.994726613] [resource_manager]: Initialize hardware 'DigController' 
[ros2_control_node-3] [INFO] [1712670114.994902467] [DigController]: Configuring Actuators...
[ros2_control_node-3] [INFO] [1712670114.995134096] [DigController]: Finished Initializing Actuators...
[ros2_control_node-3] [INFO] [1712670114.995145271] [resource_manager]: Successful initialization of hardware 'DigController'
[ros2_control_node-3] [INFO] [1712670114.995218957] [resource_manager]: Loading hardware 'DigControllerFeedback' 
[ros2_control_node-3] [INFO] [1712670114.995309343] [resource_manager]: Initialize hardware 'DigControllerFeedback' 
[ros2_control_node-3] [INFO] [1712670114.995330207] [DigControllerFeedback]: Configuring Sensors...
[ros2_control_node-3] [INFO] [1712670114.995450199] [DigControllerFeedback]: Finished Initializing Sensors..
[ros2_control_node-3] [INFO] [1712670114.995459131] [resource_manager]: Successful initialization of hardware 'DigControllerFeedback'
[ros2_control_node-3] [INFO] [1712670114.995547155] [resource_manager]: 'configure' hardware 'DigControllerFeedback' 
[ros2_control_node-3] [INFO] [1712670114.995563933] [DigControllerFeedback]: Configuration successful.
[ros2_control_node-3] [INFO] [1712670114.995571543] [resource_manager]: Successful 'configure' of hardware 'DigControllerFeedback'
[ros2_control_node-3] [INFO] [1712670114.995578865] [resource_manager]: 'activate' hardware 'DigControllerFeedback' 
[ros2_control_node-3] [INFO] [1712670114.995585923] [DigControllerFeedback]: Successfully activated!
[ros2_control_node-3] [INFO] [1712670114.995592717] [resource_manager]: Successful 'activate' of hardware 'DigControllerFeedback'
[ros2_control_node-3] [INFO] [1712670114.995601682] [resource_manager]: 'configure' hardware 'DigController' 
[ros2_control_node-3] [INFO] [1712670114.995608454] [resource_manager]: Successful 'configure' of hardware 'DigController'
[ros2_control_node-3] [INFO] [1712670114.995615749] [resource_manager]: 'activate' hardware 'DigController' 
[ros2_control_node-3] [INFO] [1712670114.995621898] [DigController]: Activating Dig Controller...
[ros2_control_node-3] [INFO] [1712670114.995784003] [resource_manager]: Successful 'activate' of hardware 'DigController'
[ros2_control_node-3] [INFO] [1712670114.995798048] [resource_manager]: 'configure' hardware 'dandebot' 
[ros2_control_node-3] [INFO] [1712670114.995805810] [resource_manager]: Successful 'configure' of hardware 'dandebot'
[ros2_control_node-3] [INFO] [1712670114.995813479] [resource_manager]: 'activate' hardware 'dandebot' 
[ros2_control_node-3] [INFO] [1712670114.995820061] [DiffDriveArduino]: Starting Controller...
[ros2_control_node-3] [INFO] [1712670115.004922170] [resource_manager]: Successful 'activate' of hardware 'dandebot'
[ros2_control_node-3] [INFO] [1712670115.012059746] [controller_manager]: update rate is 30 Hz
[ros2_control_node-3] [INFO] [1712670115.012235157] [controller_manager]: RT kernel is recommended for better performance
[ros2_control_node-3] [INFO] [1712670115.306154682] [controller_manager]: Loading controller 'joint_broad'
[spawner-4] [INFO] [1712670115.363645812] [spawner_joint_broad]: Loaded joint_broad
[ros2_control_node-3] [INFO] [1712670115.364885662] [controller_manager]: Configuring controller 'joint_broad'
[ros2_control_node-3] [INFO] [1712670115.365000558] [joint_broad]: 'joints' or 'interfaces' parameter is empty. All available state interfaces will be published
[spawner-4] [INFO] [1712670115.446832382] [spawner_joint_broad]: Configured and activated joint_broad
[ros2_control_node-3] [INFO] [1712670115.538087962] [controller_manager]: Loading controller 'diff_cont'
[spawner-6] [INFO] [1712670115.580553490] [spawner_diff_cont]: Loaded diff_cont
[ros2_control_node-3] [INFO] [1712670115.581333953] [controller_manager]: Loading controller 'dig_cont'
[INFO] [spawner-4]: process has finished cleanly [pid 19755]
[ros2_control_node-3] [INFO] [1712670115.613354313] [controller_manager]: Configuring controller 'diff_cont'
[spawner-5] [INFO] [1712670115.614195053] [spawner_dig_cont]: Loaded dig_cont
[ros2_control_node-3] [INFO] [1712670115.646575217] [controller_manager]: Configuring controller 'dig_cont'
[ros2_control_node-3] [INFO] [1712670115.648069760] [dig_cont]: configure successful
[spawner-6] [INFO] [1712670115.747167790] [spawner_diff_cont]: Configured and activated diff_cont
[ros2_control_node-3] [INFO] [1712670115.779496946] [dig_cont]: activate successful
[spawner-5] [INFO] [1712670115.813855217] [spawner_dig_cont]: Configured and activated dig_cont
[INFO] [spawner-6]: process has finished cleanly [pid 19759]
[INFO] [spawner-5]: process has finished cleanly [pid 19757]

Status:


ros2 topic list
/cmd_vel
/cmd_vel_joy
/cmd_vel_servo
/diagnostics
/diff_cont/cmd_vel_unstamped
/diff_cont/odom
/diff_cont/transition_event
/dig_cont/commands
/dig_cont/transition_event
/dynamic_joint_states
/joint_broad/transition_event
/joint_states
/parameter_events
/robot_description
/rosout
/tf
/tf_static

Command Interfaces:
    dig_to_base_link/velocity [available] [claimed]
    leftwheel_to_base_link/velocity [available] [claimed]
    rightwheel_to_base_link/velocity [available] [claimed]
state interfaces
    dig_to_base_link/position
    leftwheel_to_base_link/position
    leftwheel_to_base_link/velocity
    rightwheel_to_base_link/position
    rightwheel_to_base_link/velocity



ubuntu@MobileRobot:~$ ros2 control list_hardware_components
Hardware Component 1
    name: DigControllerFeedback
    type: sensor
    plugin name: dig_controller/DigControllerFeedback
    state: id=3 label=active
    command interfaces
Hardware Component 2
    name: DigController
    type: actuator
    plugin name: dig_controller/DigController
    state: id=3 label=active
    command interfaces
        dig_to_base_link/velocity [available] [claimed]
Hardware Component 3
    name: dandebot
    type: system
    plugin name: diffdrive_arduino/DiffDriveArduino
    state: id=3 label=active
    command interfaces
        leftwheel_to_base_link/velocity [available] [claimed]
        rightwheel_to_base_link/velocity [available] [claimed]


Controller yaml:

controller_manager:
  ros__parameters:
    update_rate: 30
    # use_sim_time: true

    diff_cont:
      type: diff_drive_controller/DiffDriveController

    joint_broad:
      type: joint_state_broadcaster/JointStateBroadcaster

    dig_cont:
      type: forward_command_controller/ForwardCommandController

dig_cont:
  ros__parameters:

    publish_rate: 30.0
    joints:
      - dig_to_base_link
      
    interface_name: velocity

diff_cont:
  ros__parameters:

    publish_rate: 30.0

    base_frame_id: base_link

    left_wheel_names: ['leftwheel_to_base_link']
    right_wheel_names: ['rightwheel_to_base_link']
    wheel_separation: 0.65
    wheel_radius: 0.1692

    use_stamped_vel: false

$\endgroup$
1
  • $\begingroup$ please don't fully rewrite your question, this is not the sense of this forum. but see my updated answer below $\endgroup$ Commented Apr 7 at 6:09

1 Answer 1

0
$\begingroup$

The typical ros2_control approach is to write a controller to interact (from ROS via topics, services) with the hardware component. Have a look at this example of a GPIO controller.

It seems that you have mixed controllers and hardware components. Why are you calling your hardware component (derived from actuator interface) "dig_controller"? The pluginlib error comes from the controller_manager, which obviously can't load your hardware component as a controller.

$\endgroup$
7
  • $\begingroup$ Thank you for your quick reply. The problem was the type in my controller yaml file where I chose digController instead of Forward command controller so it was not able to link up. However, when I try to read and write something, I print the received variables and the ones I send, but it doesn't print anything. How do you think my approach towards this should be? $\endgroup$ Commented Apr 7 at 17:39
  • $\begingroup$ If you see my read and write function in my cpp file, you will see how I print it. It works for all the other cpp nodes but it doesn't for this. Am I doing something wrong here? Does that mean that my read and write functions are not really executed? $\endgroup$ Commented Apr 7 at 17:40
  • $\begingroup$ Introspect your system with ros2controlcli: Are the interface claimed? If nothing is claiming the interfaces of your hardware, the read/write method might not get called. $\endgroup$ Commented Apr 7 at 18:03
  • $\begingroup$ Yes they are claimed after I changed the type in my yaml file: ubuntu@MobileRobot:~/ros2_ws$ ros2 control list_hardware_interfaces command interfaces dig_to_base_link/velocity [available] [claimed] leftwheel_to_base_link/velocity [available] [claimed] rightwheel_to_base_link/velocity [available] [claimed] state interfaces dig_to_base_link/position leftwheel_to_base_link/position leftwheel_to_base_link/velocity rightwheel_to_base_link/position rightwheel_to_base_link/velocity $\endgroup$ Commented Apr 7 at 18:18
  • $\begingroup$ I am sure that something is wrong. I have added the rqt_graph of what's going on in the post. The topic /dig_cont seems to be inactive $\endgroup$ Commented Apr 7 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.