smd-ros-devel / kangaroo_x2_driver

ROS Driver for the Dimension Engineering Kangaroo x2 Motion Controller
9 stars 2 forks source link

Command the Kangaroo Motion Controller #1

Open pantherekaj opened 9 years ago

pantherekaj commented 9 years ago

Hi, the code you provided is functioning well for me. However, i'm interested in how to command to move the motor. I'm able to connect to my driver, and get the odometry as well as published topic and subscribed topic. Is there a way that i can command the kangaroo motor driver to move the motor in ROS? Thanks.

WingedOwl commented 9 years ago

I'm sorry, but I believe that you have the wrong email address.

On Mon, Oct 27, 2014 at 3:14 AM, pantherekaj notifications@github.com wrote:

Hi, the code you provided is functioning well for me. However, i'm interested in how to command to move the motor. I'm able to connect to my driver, and get the odometry as well as published topic and subscribed topic. Is there a way that i can command the kangaroo motor driver to move the motor in ROS? Thanks.

— Reply to this email directly or view it on GitHub https://github.com/smd-ros-devel/kangaroo_x2_driver/issues/1.

Andrew Carpenter,

cottsay commented 9 years ago

@WingedOwl, this is a Github notification from the SDSM&T Github organization for ROS. As a member of the team last year, you were added to the group. If you wish to unsubscribe, leave the organization.

@pantherekaj, you'll need to publish a JointTrajectory message to control the angular velocity of the two joints which the motor driver controls.

It looks like @mattamert set the default joint names at https://github.com/smd-ros-devel/kangaroo_x2_driver/blob/master/src/kangaroo_driver.cpp#L32-L33 to 1 and 2, but that can be overridden to your liking by the rosparams ch1_joint_name and ch2_joint_names.

For example, to send commands using rostopic, you could execute a command like:

rostopic pub -r 30 joint_trajectory trajectory_msgs/JointTrajectory '{joint_names: ["1", "2"], points: [ { velocities: [.5, .5] } ]}'

(I don't have a machine to test on right now, so that may not work perfectly without tweaking)

Note that this driver only utilizes the "velocities" value in the JointTrajectory message, not the position or acceleration.

Cheers,

--scott

mattamert commented 9 years ago

Like @cottsay said, this driver is only set up to send a signal to the Kangaroo to control the velocities of the motors connected to it. However, if you need it to, it should be relatively straight forward to set it up so that it can control absolute position as well. In fact, there is already support in https://github.com/smd-ros-devel/kangaroo_x2_driver/blob/master/src/kang_lib.cpp to create a position message from the given parameters.

Also, please note that there are a few variables that you will most likely want to change. These were specific to the robot that we were working with, but we did not have the time to set up rosparams for them since we were under a strict deadline. They include: encoder_lines_per_revolution (the number of encoder lines it takes to rotate through one revolution - defaulted to 3200), hz (which is the hertz that you want to receive data from the kangaroo - defaulted to 50), and the address of the kangaroo (which is defaulted in various places to 128).

pantherekaj commented 9 years ago

Hi, thanks for the help! i'm able to command the vehicle to move using rostopic. and it works fine for me. However, i would like to clarify that is the odometry published by this driver, able to used as nav_msgs/Odometry type? Because i need the odometry(x,y,z) in order produce a map by using LaserScan data by LMS1xx with the odometry.

cottsay commented 9 years ago

I'm glad to hear you were able to command the controller, @pantherekaj. At SDSM&T, we implement all controller drivers such that they are not specific to one drive system. For instance, two of these controllers could be used to implement a 4-wheel mecanum drive system, and the forward and inverse kinematics would be different from a 2-wheel differential drive system or a 4-wheel skid-steer system.

Just as this driver responds to joint messages, it publishes joint statuses (sensor_msgs/JointState). We typically use another node or set of nodes to "implement" the driver in our compitation graph as necessary. For example implementations, see:

We also use a helper for multiple joint_state topics, if necessary: https://github.com/smd-ros-devel/joint_state_aggregator

Best,

--scott

pantherekaj commented 9 years ago

Hi im sorry it took me awhile to reply. Have been so busy in school lately. The link you gave me was perfect! It solved all my problems. I am now able to receive odom and the laser data in Rviz and create a map. We really appreciate the help you had given us. Thanks a lot we wouldn't have done it without your help. :+1: