sbgisen / vesc

VESC Interface for ROS
Apache License 2.0
44 stars 33 forks source link

Running with Two Vesc Controllers #39

Closed David9696 closed 2 years ago

David9696 commented 2 years ago

Hi,

Thanks for the great package.

I am thinking to make a simple arm with 2 joints. How could I run multiple vesc controllers with this package? I understand that it is possible to achieve it by using CombinedRobotHW. However, I am new to ROS and still learning. Could you please give me some guides or examples for how to proceed?

Appreciate if you could you could help.

Thanks,

David

ssr-yuki commented 2 years ago

@David9696 This page would support you. https://github.com/ros-controls/ros_control/wiki/Writing-CombinedRobotHW

Parker-Bergen commented 2 years ago

You can run two using a launch file and adding a name space to each node. Example of what I did below for the launch file: The "ns" is the namespace param `

<param name="num_motor_pole_pairs" value="14"/>

` With this I can reference each node in the code as follows: `vel_left_pub_ = nh_.advertise("vesc_left/commands/motor/current", 1); vel_right_pub_ = nh_.advertise("vesc_right/commands/motor/current", 1); ` Hopefully this helps.
ssr-yuki commented 2 years ago

I close this issue since there is no reply from the author for one week.

David9696 commented 2 years ago

@David9696 This page would support you. https://github.com/ros-controls/ros_control/wiki/Writing-CombinedRobotHW

Hi,

Thanks.

I followed the tutorial and it worked.

David9696 commented 2 years ago

You can run two using a launch file and adding a name space to each node. Example of what I did below for the launch file: The "ns" is the namespace param <node pkg="vesc_driver" type="vesc_driver_node" name="vesc_left" ns="vesc_left"> <param name="port" value="/dev/ttyACM0" /> <param name="num_motor_pole_pairs" value="14"/> </node> <node pkg="vesc_driver" type="vesc_driver_node" name="vesc_right" ns="vesc_right"> <param name="port" value="/dev/ttyACM1" /> <param name="num_motor_pole_pairs" value="14"/> </node> With this I can reference each node in the code as follows: vel_left_pub_ = nh_.advertise<std_msgs::Float64>("vesc_left/commands/motor/current", 1); vel_right_pub_ = nh_.advertise<std_msgs::Float64>("vesc_right/commands/motor/current", 1); Hopefully this helps.

Hi,

Thanks.

This method works as well.

mzahana commented 2 years ago

@David9696 Hi! I am trying to use vesc_hw_interface to interface two vesc drivers through two different ports to control a differential drive robot.

Since it worked with you, can you please describe how you used CombinedRobotHW to do that?

Thank you in advance.