## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
- INCLUDE_DIRS include
+# INCLUDE_DIRS include
# LIBRARIES roboint
CATKIN_DEPENDS message_runtime roscpp rospy std_msgs
# DEPENDS system_lib
-bool[9] input
+bool[8] input
+int16 ax
+int16 ay
+int16 a1
+int16 a2
+int16 av
int16 d1
+int16 d2
<build_depend>sensor_msgs</build_depend>
<build_depend>nav_msgs</build_depend>
<build_depend>tf</build_depend>
+ <run_depend>tf</run_depend>
<!-- The export tag contains other, unspecified, tags -->
<export>
import roslib; roslib.load_manifest('roboint')
import rospy
import tf
+import tf.broadcaster
+import tf.transformations
from math import sin, cos, pi
from geometry_msgs.msg import Twist, TransformStamped, Point32
from sensor_msgs.msg import LaserScan
self.y = 0
self.alpha = 0
self.last_in = None
- self.tf_broadcaster = tf.TransformBroadcaster()
+ self.tf_broadcaster = tf.broadcaster.TransformBroadcaster()
self.last_time = rospy.Time.now()
self.x_last = 0
self.y_last = 0
self.last_time = current_time
def update_odometry(self, msg, current_time):
- in_now = msg.input[1:3]
+ in_now = msg.input[:2]
if self.last_in is not None:
in_diff = [abs(a - b) for a, b in zip(in_now, self.last_in)] # get changed inputs
# fix in_diff from actual motor direction
while(ros::ok()) {
roboint::Inputs msg;
- msg.input[0] = 0; // unused, Hardware starts at 1
- for (int i=1; i<=8; i++) {
- msg.input[i] = (transfer_area->E_Main & (1<<(i-1))) >> (i-1);
+ sem_wait(&hFt->lock);
+ for (int i=0; i<=7; i++) {
+ msg.input[i] = (transfer_area->E_Main & (1<<i)) >> i;
}
+ msg.ax = transfer_area->AX;
+ msg.ay = transfer_area->AY;
+ msg.a1 = transfer_area->A1;
+ msg.a2 = transfer_area->A2;
+ msg.av = transfer_area->AV;
msg.d1 = transfer_area->D1;
+ msg.d2 = transfer_area->D2;
+ sem_post(&hFt->lock);
/**
* The publish() function is how you send messages. The parameter