<commit_before>#!/usr/bin/env python
# coding=utf-8

#include<ros/ros.h>
import rospy
#include<geometry_msgs/Twist.h>
from geometry_msgs.msg import Twist

#include<sensor_msgs/Imu.h>
from sensr_msgs import Imu

#include<iostream>
#include<tf/LinearMath/Matrix3x3.h>
#include<tf/LinearMath/Quaternion.h>

#using namespace std;


def TeleopImu():
	# publish topic is cmd_vel
#	pub = rospy.Publisher("/turtle1/cmd_vel", Twist, queue_size=10)
	pub = rospy.Publisher('turtle1/cmd_vel', Twist, queue_size=10)

	# listen to IMU data
    rospy.Subscriber('imu/data', Imu, callback)


def callBack(const sensor_msgs::Imu::ConstPtr& imu):
	geometry_msgs::Twist vel;
	tf::Quaternion bq(imu->orientation.x,imu->orientation.y,imu->orientation.z,imu->orientation.w);
	double roll,pitch,yaw;
	tf::Matrix3x3(bq).getRPY(roll,pitch,yaw);
	vel.angular.z = roll;
	vel.linear.x = pitch;

	# publish
	pub.publish(vel);


def listener():
    # In ROS, nodes are uniquely named. The anonymous=True flag
    # means that rospy will choose a unique name for this listener node
    rospy.init_node('teleopImu', anonymous=True)
<commit_msg>Updated conversion. To be tested...<commit_after>#!/usr/bin/env python
# coding=utf-8

#include<ros/ros.h>
import rospy
#include<geometry_msgs/Twist.h>
from geometry_msgs.msg import Twist

#include<sensor_msgs/Imu.h>
from sensr_msgs import Imu

#include<iostream>
#include<tf/LinearMath/Matrix3x3.h>
#include<tf/LinearMath/Quaternion.h>

#using namespace std;


def TeleopImu():
	# publish topic is cmd_vel
#	pub = rospy.Publisher("/turtle1/cmd_vel", Twist, queue_size=10)
	pub = rospy.Publisher('turtle1/cmd_vel', Twist, queue_size=10)

	# listen to IMU data
    rospy.Subscriber('imu/data', Imu, callback)


def callBack(imu):
	Twist vel;
	# tf::Quaternion bq(imu->orientation.x, imu->orientation.y, imu->orientation.z, imu->orientation.w);
	# double roll,pitch,yaw;
	# tf::Matrix3x3(bq).getRPY(roll,pitch,yaw);

	# convert to twist message for turtle
	vel.angular.z = imu.angular.z # roll
	vel.linear.x  = imu.linear.x # pitch

	# publish
	pub.publish(vel);


def listener():
    # In ROS, nodes are uniquely named. The anonymous=True flag
    # means that rospy will choose a unique name for this listener node
    rospy.init_node('teleopImu', anonymous=True)

{'fraction_non_alphanumeric': 0.13488576449912126, 'fraction_numerical': 0.009666080843585237, 'mean_word_length': 4.9763779527559056, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1457556', 'n_tokens_mistral': 916, 'n_tokens_neox': 868, 'n_words': 183}