ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

Android Tutlebot Teleop Source Code Structure (Hydro)

asked 2014-08-03 23:46:06 -0600

syaz nyp fyp gravatar image

updated 2014-08-04 22:20:05 -0600

Hi guys.

i'm working on the code structure of the teleop of turtlebot (hydro).

Is there anyway possible to find out what code is being sent out when i shift the joystick up, down, left, etc?

I understand that the joystick it self is being imported from:

import org.ros.android.view.VirtualJoystickView;

From the best of my knowledge, I can't really figure out which part of the whole source code actually has the code that I'm looking for

I would like to play around with GUI itself. Well, let's say just inserting a 4 directional buttons (up, down, left, right) to move to the turtlebot instead of the virtual joystick.

What is the code that is needed to be sent out here for each buttons?

How may i go about doing this?

Any help will be greatly appreciated. Thank you! :)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-08-04 10:34:59 -0600

bvbdort gravatar image

updated 2014-08-04 10:37:54 -0600

Not sure, if you are looking for this ?

You have to publish twist messages with veloctiy info after detecting touch of buttons. Here is some code extract

refer this code for futhurinfo

              import org.ros.message.geometry_msgs.Twist;
              import org.ros.node.topic.Publisher;

              private Publisher<org.ros.message.geometry_msgs.Twist> publisher;
              private org.ros.message.geometry_msgs.Twist currentVelocityCommand =
                      new org.ros.message.geometry_msgs.Twist();

              public boolean onTouchEvent(MotionEvent event) {

                      // other stuff

              case MotionEvent.ACTION_UP:        

                {
                        currentVelocityCommand.linear.x = linearV; // 
                        currentVelocityCommand.linear.y = 0;
                        currentVelocityCommand.linear.z = 0;
                        currentVelocityCommand.angular.x = 0;
                        currentVelocityCommand.angular.y = 0;
                        currentVelocityCommand.angular.z = -angularV; //

                    publisher.publish(currentVelocityCommand);
                }
             }
edit flag offensive delete link more

Comments

1

@bvbdort, your invaluable help eventually led me to this.. (which was what i was looking for) : http://docs.ros.org/hydro/api/android_core/html/VirtualJoystickView_8java.htmlhttp://docs.ros.org/hydro/api/android_core/html/VirtualJoystickView_8java_source.html thank you so much for the help :)

syaz nyp fyp gravatar image syaz nyp fyp  ( 2014-08-04 20:12:22 -0600 )edit

Question Tools

Stats

Asked: 2014-08-03 23:46:06 -0600

Seen: 863 times

Last updated: Aug 04 '14