Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command the Kangaroo Motion Controller #1

Open
pantherekaj opened this issue Oct 27, 2014 · 6 comments
Open

Command the Kangaroo Motion Controller #1

pantherekaj opened this issue Oct 27, 2014 · 6 comments

Comments

@pantherekaj
Copy link

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
Copy link

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

On Mon, Oct 27, 2014 at 3:14 AM, pantherekaj [email protected]
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
#1.

Andrew Carpenter,

@cottsay
Copy link
Member

cottsay commented Oct 27, 2014

@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
Copy link
Contributor

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
Copy link
Author

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
Copy link
Member

cottsay commented Nov 7, 2014

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
Copy link
Author

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. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants