{"action":"created","issue":{"url":"https://api.github.com/repos/ros-drivers/rosserial/issues/277","repository_url":"https://api.github.com/repos/ros-drivers/rosserial","labels_url":"https://api.github.com/repos/ros-drivers/rosserial/issues/277/labels{/name}","comments_url":"https://api.github.com/repos/ros-drivers/rosserial/issues/277/comments","events_url":"https://api.github.com/repos/ros-drivers/rosserial/issues/277/events","html_url":"https://github.com/ros-drivers/rosserial/issues/277","id":213069434,"number":277,"title":"Sync lost when publishing Odometry message. ","user":{"login":"AlexisTM","id":6976744,"avatar_url":"https://avatars3.githubusercontent.com/u/6976744?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexisTM","html_url":"https://github.com/AlexisTM","followers_url":"https://api.github.com/users/AlexisTM/followers","following_url":"https://api.github.com/users/AlexisTM/following{/other_user}","gists_url":"https://api.github.com/users/AlexisTM/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexisTM/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexisTM/subscriptions","organizations_url":"https://api.github.com/users/AlexisTM/orgs","repos_url":"https://api.github.com/users/AlexisTM/repos","events_url":"https://api.github.com/users/AlexisTM/events{/privacy}","received_events_url":"https://api.github.com/users/AlexisTM/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2017-03-09T15:22:29Z","updated_at":"2017-03-10T21:05:59Z","closed_at":"2017-03-09T15:42:19Z","body":"Dear, \r\n\r\n* Hardware : `Mega2560`\r\n* Software : `Indigo, 0.6.4`\r\n\r\nI keep having Sync issues when I am trying to send the nav_msgs/Odometry message. \r\n\r\nI have multiple other topics, LEDs subscriber to a std_msgs/ColorRGBA topic, US sensors (non blocking architecture with NewPing library) publishing a std_msgs/Bool topic. All those are working if I do not send the Odometry message (commenting off  `rover_odom.publish(&odometry_msg);`) but if I uncomment it, simply loose Sync all the time. \r\n\r\nIs the message too big?\r\n\r\n```\r\nboolean odometrySender(){\r\n    analogWrite(LED_R_PIN, 255);\r\n    analogWrite(LED_G_PIN, 0);\r\n    analogWrite(LED_B_PIN, 0);\r\n    now_encoder_time = millis()/1000.0;\r\n    if(!updated_left) return false;\r\n    if(!updated_right) return false;\r\n\r\n    delta_left = current_encoder_left - last_encoder_left;\r\n    delta_right = current_encoder_right - last_encoder_right;\r\n\r\n    omega_left = (delta_left * distance_per_tick) / (now_encoder_time - last_encoder_time);\r\n    omega_right = (delta_right * distance_per_tick) / (now_encoder_time - last_encoder_time);\r\n\r\n    v_left = omega_left * WHEEL_RADIUS; //radius\r\n    v_right = omega_right * WHEEL_RADIUS;\r\n\r\n    vx = ((v_right + v_left) / 2)*10; // Times 10 ?\r\n    vy = 0;\r\n    vth = ((v_right - v_left)/distance_between_wheels)*10;\r\n\r\n    double dt = (now_encoder_time - last_encoder_time);\r\n    double delta_x = (vx * cos(th)) * dt;\r\n    double delta_y = (vx * sin(th)) * dt;\r\n    double delta_th = vth * dt;\r\n\r\n    x += delta_x;\r\n    y += delta_y;\r\n    th += delta_th;\r\n\r\n    //geometry_msgs::Quaternion odom_quat = tf::createQuaternionMsgFromYaw(th);\r\n/*\r\n    geometry_msgs::TransformStamped odom_trans;\r\n    odom_trans.header.stamp = ros_now_encoder_time;\r\n    odom_trans.header.frame_id = \"odom\";\r\n    odom_trans.child_frame_id = \"base_link\";\r\n\r\n    odom_trans.transform.translation.x = x;\r\n    odom_trans.transform.translation.y = y;\r\n    odom_trans.transform.translation.z = 0.0;\r\n    //odom_trans.transform.rotation = odom_quat;\r\n\r\n    //send the transform\r\n    odom_broadcaster.sendTransform(odom_trans);\r\n*/\r\n    //Odometry message\r\n\r\n    odometry_msg.header.stamp = nh.now();\r\n    odometry_msg.header.frame_id = \"odom\";\r\n\r\n    //set the position\r\n    odometry_msg.pose.pose.position.x = x;\r\n    odometry_msg.pose.pose.position.y = y;\r\n    odometry_msg.pose.pose.position.z = 0.0;\r\n    //odometry_msg.pose.pose.orientation = quat;\r\n\r\n     //set the velocity\r\n    odometry_msg.child_frame_id = \"base_link\";\r\n    odometry_msg.twist.twist.linear.x = vx;\r\n    odometry_msg.twist.twist.linear.y = vy;\r\n    odometry_msg.twist.twist.angular.z = vth;\r\n\r\n    //publish the message\r\n    rover_odom.publish(&odometry_msg);\r\n\r\n    last_encoder_left = current_encoder_left;\r\n    last_encoder_right = current_encoder_right;\r\n    last_encoder_time = now_encoder_time;\r\n    updated_left = false;\r\n    updated_right = false;\r\n    analogWrite(LED_R_PIN, 0);\r\n    analogWrite(LED_G_PIN, 0);\r\n    analogWrite(LED_B_PIN, 255);\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ros-drivers/rosserial/issues/comments/285784511","html_url":"https://github.com/ros-drivers/rosserial/issues/277#issuecomment-285784511","issue_url":"https://api.github.com/repos/ros-drivers/rosserial/issues/277","id":285784511,"user":{"login":"attermann","id":11416985,"avatar_url":"https://avatars0.githubusercontent.com/u/11416985?v=3","gravatar_id":"","url":"https://api.github.com/users/attermann","html_url":"https://github.com/attermann","followers_url":"https://api.github.com/users/attermann/followers","following_url":"https://api.github.com/users/attermann/following{/other_user}","gists_url":"https://api.github.com/users/attermann/gists{/gist_id}","starred_url":"https://api.github.com/users/attermann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/attermann/subscriptions","organizations_url":"https://api.github.com/users/attermann/orgs","repos_url":"https://api.github.com/users/attermann/repos","events_url":"https://api.github.com/users/attermann/events{/privacy}","received_events_url":"https://api.github.com/users/attermann/received_events","type":"User","site_admin":false},"created_at":"2017-03-10T21:05:59Z","updated_at":"2017-03-10T21:05:59Z","body":"Here you go: https://github.com/ecostech/rosproxy.\r\n\r\nI had to extract it from a larger project, so forgive any untidiness, but it should build in catkin_make.\r\n\r\nThere is example Arduino code in rosproxy_arduino/sketchbook, and the Arduino headers you will need to copy to ros_lib are in rosproxy_arduino/sketchbook/libraries/ros_lib/rosproxy_msgs.  These headers aren't re-built by catkin yet, so if you change the custom msgs for any reason then you will need to re-build ros_lib manually.\r\n\r\nCheers."}}
{"actor":{"display_login":"attermann"}}