
Hi,
I am currently working on controlling two dc motors with integrated controller using ros_canopen, ROS kinetic, ubuntu 16.04.
So far I have done steps 1 through 7 in THIS answer. But I am stuck at the controller_manager part of getting it to work.
Just a tiny recap, I have made an URDF, made driver and controller configs, launched canopen_motor_node and i am able to use init, get/set_object and the other services canopen_motor_node provides.
However, as I am trying to control a diff drive robot I would like to use the diff_drive_controller so I have made the following config file for the controller:
raw19: mobile_base_controller: type : "diff_drive_controller/DiffDriveController" #topic : "test" left_wheel : 'motor1' right_wheel : 'motor2' publish_rate: 50.0 # default: 50 pose_covariance_diagonal : [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0] twist_covariance_diagonal: [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0] required_drive_mode: 2 # Wheel separation and diameter. These are both optional. # diff_drive_controller will attempt to read either one or both from the # URDF if not specified as a parameter wheel_separation : 0.42 wheel_radius : 0.1313 # Wheel separation and radius multipliers wheel_separation_multiplier: 1.0 # default: 1.0 wheel_radius_multiplier : 1.0 # default: 1.0 # Velocity commands timeout [s], default 0.5 cmd_vel_timeout: 0.25 # Base frame_id base_frame_id: base_link #default: base_link # Velocity and acceleration limits # Whenever a min_* is unspecified, default to -max_* linear: x: has_velocity_limits : true max_velocity : 1.0 # m/s min_velocity : -1.0 # m/s has_acceleration_limits: true max_acceleration : 0.8 # m/s^2 min_acceleration : -0.8 # m/s^2 has_jerk_limits : true max_jerk : 5.0 # m/s^3 angular: z: has_velocity_limits : true max_velocity : 0.7 # rad/s has_acceleration_limits: true max_acceleration : 0.5 # rad/s^2 has_jerk_limits : true max_jerk : 2.5 # rad/s^3 I have tried following the edit/answer of THIS question and THIS video/answer but I can't seem to get it to work. But i don't if that is because I am not using Gazebo. I think my main issue is understanding ros_control/controller_manager and how to initiate/spawn the controllers. My preliminary thoughts are that the error is in my launch or urdf file.
Launch file
<?xml version="1.0"?> <launch> <arg name="model" default="$(find robot)/urdf/rawcopy.xacro" /> <arg name="rvizconfig" default="$(find robot)/rviz/urdf.rviz" /> <!-- send urdf to param server --> <param name="/raw19/robot_description" command="$(find xacro)/xacro $(arg model) --inorder" /> <!-- robot state publisher --> <node ns="raw19" pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher"/> <node ns="raw19" name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" output="screen"/> <!-- canopen_motor_node --> <node ns="raw19" name="driver" pkg="canopen_motor_node" type="canopen_motor_node" output="screen" clear_params="true" launch-prefix=""> <rosparam command="load" file="$(find robot)/config/driver_config.yaml" /> </node> <!-- controllers --> <rosparam command="load" file="$(find robot)/config/diff_controller.yaml" /> <!-- load_controllers --> <node ns="raw19" name="controller" pkg="controller_manager" type="controller_manager" args="spawn joint_state_controller mobile_base_controller" respawn="false" output="screen"/> <!-- Show in Rviz --> <node ns="raw19" name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true" /> </launch> When i launch and run 'rostopic list' and 'rosservice list' I just get the following. I would expect to get at least two services a la '*/command'. Am I wrong to assume this?
/clicked_point /diagnostics /initialpose /move_base_simple/goal /raw19/joint_states /rosout /rosout_agg /tf /tf_static rosservice list:
/raw19/controller/get_loggers /raw19/controller/set_logger_level /raw19/driver/get_loggers /raw19/driver/get_object /raw19/driver/halt /raw19/driver/init /raw19/driver/recover /raw19/driver/set_logger_level /raw19/driver/set_object /raw19/driver/shutdown /raw19/joint_state_publisher/get_loggers /raw19/joint_state_publisher/set_logger_level /raw19/robot_state_publisher/get_loggers /raw19/robot_state_publisher/set_logger_level /raw19/rviz/get_loggers /raw19/rviz/reload_shaders /raw19/rviz/set_logger_level /rosout/get_loggers /rosout/set_logger_level urdf file
<?xml version="1.0"?> <robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="raw19"> <material name="blue"> <color rgba="0.2 0.2 0.8 1"/> </material> <material name="red"> <color rgba="0.9 0.0 0.0 1"/> </material> <link name="base_link"> <visual> <origin rpy="1.57 0.0 0.0" xyz="0.0 0.0 0.152"/> <geometry> <mesh filename="package://robot/meshes/RAW.stl" scale="0.005 0.005 0.005"/> </geometry> <material name="blue"/> </visual> <collision> <origin xyz="0.0 0.0 0.175"/> <geometry> <box size="0.6 0.8 0.35"/> </geometry> </collision> </link> <link name="left_wheel"> <visual> <origin rpy="0.0 0.0 0.0" xyz="0.0 0.0 0.0"/> <geometry> <cylinder length="0.01" radius="0.1313"/> </geometry> <material name="red"/> </visual> </link> <joint name="motor1" type="continuous"> <axis xyz="0 0 1"/> <limit effort="1.0" velocity="0.2"/> <parent link="base_link"/> <child link="left_wheel"/> <origin rpy="0.0 1.57 0.0" xyz="0.21 0.0 0.1313"/> </joint> <link name="right_wheel"> <visual> <origin rpy="0.0 0.0 0.0" xyz="0.0 0.0 0.0"/> <geometry> <cylinder length="0.01" radius="0.1313"/> </geometry> <material name="red"/> </visual> </link> <joint name="motor2" type="continuous"> <axis xyz="0 0 1"/> <limit effort="1000.0" velocity="0.5"/> <parent link="base_link"/> <child link="right_wheel"/> <origin rpy="0 1.57 0" xyz="-0.21 0.0 0.1313"/> </joint> <transmission name="left_wheel_transmission"> <type>transmission_interface/SimpleTransmission</type> <joint name="motor1"> <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface> </joint> <actuator name="left_wheel_actuator"> <mechanicalReduction>1</mechanicalReduction> <hardwareInterface>VelocityJointInterface</hardwareInterface> </actuator> </transmission> <transmission name="right_wheel_transmission"> <type>transmission_interface/SimpleTransmission</type> <joint name="motor2"> <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface> </joint> <actuator name="right_wheel_actuator"> <mechanicalReduction>1</mechanicalReduction> <hardwareInterface>VelocityJointInterface</hardwareInterface> </actuator> </transmission> <gazebo> <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so"> </plugin> </gazebo> </robot> I hope that someone can shed some light on why I can't get it to work.
Originally posted by rhas on ROS Answers with karma: 37 on 2019-01-25
Post score: 1
Original comments
Comment by PeteBlackerThe3rd on 2019-01-25:
What exactly is it that isn't working? What error message if any are you getting?
Comment by gvdhoorn on 2019-01-25:\
I would expect to get at least two services a la '*/command'. Am I wrong to assume this?
The wiki page shows no services at all.
What gave you the impression that you should see services?
Comment by rhas on 2019-01-28:
As stated in Mathias' answer, I misunderstood where the service (that actually was a topic) originated from. I thought it was the controller_manager, but it was the canopen_motor_node once the system was initialized. Either way, I appreciate the help, thank you.