ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
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);
}
}
2 | No.2 Revision |
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);
}
}