You are here

Help needed in controlling multiple VESC boards (multiple motors) with VESC ROS (need to debug errors)

1 post / 0 new
shreyas.srinivasan
Offline
Last seen: 2 years 1 month ago
Joined: 2022-08-23 13:11
Posts: 1
Help needed in controlling multiple VESC boards (multiple motors) with VESC ROS (need to debug errors)

I modified the following files in VESC ROS : https://github.com/sbgisen/vesc to get the proceeding errors when I was trying to control 2 motors using the VESC ROS Interface.

Modified code of "velocity_control_sample.launch":

""


<launch>

<!-- Controller -->

<arg name="model" default="$(find vesc_hw_interface)/launch/test.xacro"/>

<param name="robot_description" command="$(find xacro)/xacro $(arg model)"/>

 

Boot hardware interfaces -->

<node name="vesc_hw_interface_node_1" pkg="vesc_hw_interface" type="vesc_hw_interface_node" output="screen">

<rosparam>

joint_name: arm1_joint

command_mode: velocity

port: /dev/ttyACM0

num_motor_pole_pairs: 10

gear_ratio: 1

torque_const: 1

</rosparam>

</node>

<node name="vesc_hw_interface_node_2" pkg="vesc_hw_interface" type="vesc_hw_interface_node" output="screen">

<rosparam>

joint_name: arm2_joint

command_mode: velocity

port: /dev/ttyACM1

num_motor_pole_pairs: 10

gear_ratio: 1

torque_const: 1

</rosparam>

</node>

 

<!-- Boot ros_controllers -->

<rosparam>

joint_state_controller:

type: joint_state_controller/JointStateController

publish_rate: 100

 

<!--joint_velocity_controller_1:

type: velocity_controllers/JointVelocityController

publish_rate: 100

base_frame_id: base_link

joint: arm1_joint-->

 

joint_velocity_controller_2:

type: velocity_controllers/JointVelocityController

publish_rate: 100

base_frame_id: base_link

joint: arm2_joint

 

joint_velocity_controller_1:

type: velocity_controllers/JointVelocityController

publish_rate: 100

base_frame_id: base_link

joint: arm1_joint

 

</rosparam>

 

<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" args="joint_state_controller

joint_velocity_controller_1

joint_velocity_controller_2"/>

</launch>

 

""

Modified code of "test.xacro":

""

<?xml version="1.0"?>

 

<robot name="vesc_test">

<link name="base_link"></link>

 

<joint name="arm1_joint" type="revolute">

<parent link="base_link"/>

<child link="arm1_link"/>

<origin xyz="0 1.36 0" rpy="1.57 0.0 0.0"/>

<axis xyz="0 0 1"/>

<limit effort="100" lower="100" upper="100" velocity="100"/>

</joint>

 

<link name="arm1_link"></link>

 

<joint name="arm2_joint" type="revolute">

<parent link="base_link"/>

<child link="arm2_link"/>

<origin xyz="0 -1.2 -0.25" rpy="0 0.0 0.0"/>

<axis xyz="0 0 1"/>

<limit effort="100" lower="100" upper="100" velocity="100"/>

</joint>

 

<link name="arm2_link"></link>

 

</robot>

 





""

Error when I do roslaunch : "roslaunch vesc_hw_interface velocity_control_sample.launch":

""

process[vesc_hw_interface_node_1-1]: started with pid [22176]
process[vesc_hw_interface_node_2-2]: started with pid [22177]
process[controller_spawner-3]: started with pid [22178]
[ INFO] [1665065249.028335730]: Joint limits are loaded
[ INFO] [1665065249.035389428]: Gear ratio is set to 1.000000
[ INFO] [1665065249.035460946]: Torque constant is set to 1.000000
[ INFO] [1665065249.035497194]: The number of motor pole pairs is set to 10
[ INFO] [1665065249.036451237]: mode: velocity
[ INFO] [1665065249.036777679]: Joint limits are loaded
[ INFO] [1665065249.040281165]: Gear ratio is set to 1.000000
[ INFO] [1665065249.040330125]: Torque constant is set to 1.000000
[ INFO] [1665065249.040347934]: The number of motor pole pairs is set to 10
[ INFO] [1665065249.040991319]: mode: velocity
[INFO] [1665065249.453687]: Controller Spawner: Waiting for service controller_manager/load_controller
[INFO] [1665065249.457591]: Controller Spawner: Waiting for service controller_manager/switch_controller
[INFO] [1665065249.463098]: Controller Spawner: Waiting for service controller_manager/unload_controller
[INFO] [1665065249.467841]: Loading controller: joint_state_controller
[INFO] [1665065249.480781]: Loading controller: joint_velocity_controller_1
[INFO] [1665065249.500746]: Loading controller: joint_velocity_controller_2
[ERROR] [1665065249.507634155]: Exception thrown while initializing controller 'joint_velocity_controller_2'.
Could not find resource 'arm2_joint' in 'hardware_interface::VelocityJointInterface'.
[ERROR] [1665065249.507716149]: Initializing controller 'joint_velocity_controller_2' failed
[ERROR] [1665065250.509234]: Failed to load joint_velocity_controller_2
[INFO] [1665065250.511685]: Controller Spawner: Loaded controllers: joint_state_controller, joint_velocity_controller_1
[INFO] [1665065250.520736]: Started controllers: joint_state_controller, joint_velocity_controller_1

""

When I do "rostopic list", I get the following topics:

""

/canary

/joint_states

/joint_velocity_controller_1

/command /rosout /rosout_agg

""

When I do "rostopic pub /joint_velocity_controller_1/command std_msgs/Float64 80", I am able to do velocity control for one motor.

When I do "rostopic pub /joint_velocity_controller_2/command std_msgs/Float64 80", nothing happens, and am not able to control velocity for the other motor. Please help me in solving this.