Login
Account
Sign Up
Home
About Us
Catalog
Search
Register RSS
Embed RSS
FAQ
Get Embed Code
Example: Default CSS
Example: Custom CSS
Example: Custom CSS per Embedding
Super RSS
Usage
View Latest
Create
Contact Us
Technical Support
Guest Posts/Articles
Report Violations
Google Warnings
Article Removal Requests
Channel Removal Requests
General Questions
DMCA Takedown Notice
RSSing>>
Collections:
RSSing
EDA
Intel
Mesothelioma
SAP
SEO
Latest
Articles
Channels
Super Channels
Popular
Articles
Pages
Channels
Super Channels
Top Rated
Articles
Pages
Channels
Super Channels
Trending
Articles
Pages
Channels
Super Channels
Switch Editions?
Cancel
Sharing:
Title:
URL:
Copy Share URL
English
RSSing.com
RSSing>>
Latest
Popular
Top Rated
Trending
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
NSFW?
Claim
0
X
Mark channel Not-Safe-For-Work?
cancel
confirm
NSFW Votes:
(
0
votes)
X
Are you the publisher?
Claim
or
contact us
about this channel.
X
No ratings yet.
Showing article 3 of 4 in channel 80159215
Channel Details:
Title: ROS Answers: Open Source Q&A Forum - RSS feed
Channel Number: 80159215
Language: English
Registered On: May 1, 2024, 6:53 pm
Number of Articles: 4
Latest Snapshot: May 9, 2024, 11:25 am
RSS URL:
http://answers.ros.org/feeds/question/205364/
Publisher:
https://answers.ros.org/questions/
Description: Open source question and answer forum written in Python and Django
Catalog:
//answers13765.rssing.com/catalog.php?indx=80159215
Remove ADS
Viewing all articles
Article 1
Article 2
Article 3
Article 4
Browse latest
Browse all 4
↧
Answer by Novinho for I want to move my turtlebot 2 a fixed set of distances such as 1m forward, 1m right and etc accurately using odometry. This is the C++ code i have currently. However, it does not seem to be using the odometry. How should I change the code to enable myself to move the robot accurately ?Below is the code that I currently have. What it does is enable me to move the turtlebot as well as received odometry data on the console. class TurtleMoveAvoid; class TurtleMoveAvoid { public: TurtleMoveAvoid() { _pub = _n.advertise<geometry_msgs::Twist>("/mobile_base/commands/velocity", 1); _sub = _n.subscribe("/odom", 1, &TurtleMoveAvoid::odomCallback, this); _left = true; _right = true; } void publish() { if (_left && _right) { forward(); } else if (_right) { turnRight(); } else if (_left) { turnLeft(); } else { reverse(); } } void forward() { geometry_msgs::Twist vel; vel.linear.x = 0.2; vel.angular.z = 0.0; _pub.publish(vel); } void reverse() { geometry_msgs::Twist vel; vel.linear.x = -0.2; vel.angular.z = 0.0; _pub.publish(vel); } void turnLeft() { geometry_msgs::Twist vel; vel.linear.x = 0.0; vel.angular.z = 0.7; _pub.publish(vel); } void turnRight() { geometry_msgs::Twist vel; vel.linear.x = 0.0; vel.angular.z = -0.7; _pub.publish(vel); } void odomCallback(const nav_msgs::Odometry::ConstPtr& odom) { ROS_INFO("I received odom: [%f,%f,%f]", odom->twist.twist.linear.x, odom->pose.pose.position.y,odom->pose.pose.orientation.z); double xpos = odom->twist.twist.linear.x; if(xpos < 0.2) //assuming 0.2 is the end { _right = true; _left = true; } else { _right = false; _left = false; } publish(); } private: ros::NodeHandle _n; ros::Publisher _pub; ros::Subscriber _sub; bool _right, _left; };// End of class TurtleMoveAvoid int main(int argc, char **argv) { ros::init(argc, argv, "turtle_move_odom"); TurtleMoveAvoid turtle; ros::Rate loop_rate(10); while (ros::ok()) { ros::spinOnce(); //get new callback, adjust publish then publish again. loop_rate.sleep(); } return 0; }
April 4, 2016, 10:34 am
≫
Next: Navigation of turtlebot (Moving 1m forward, 1m left)
≪
Previous: Answer by Humpelstilzchen for I want to move my turtlebot 2 a fixed set of distances such as 1m forward, 1m right and etc accurately using odometry. This is the C++ code i have currently. However, it does not seem to be using the odometry. How should I change the code to enable myself to move the robot accurately ?Below is the code that I currently have. What it does is enable me to move the turtlebot as well as received odometry data on the console. class TurtleMoveAvoid; class TurtleMoveAvoid { public: TurtleMoveAvoid() { _pub = _n.advertise<geometry_msgs::Twist>("/mobile_base/commands/velocity", 1); _sub = _n.subscribe("/odom", 1, &TurtleMoveAvoid::odomCallback, this); _left = true; _right = true; } void publish() { if (_left && _right) { forward(); } else if (_right) { turnRight(); } else if (_left) { turnLeft(); } else { reverse(); } } void forward() { geometry_msgs::Twist vel; vel.linear.x = 0.2; vel.angular.z = 0.0; _pub.publish(vel); } void reverse() { geometry_msgs::Twist vel; vel.linear.x = -0.2; vel.angular.z = 0.0; _pub.publish(vel); } void turnLeft() { geometry_msgs::Twist vel; vel.linear.x = 0.0; vel.angular.z = 0.7; _pub.publish(vel); } void turnRight() { geometry_msgs::Twist vel; vel.linear.x = 0.0; vel.angular.z = -0.7; _pub.publish(vel); } void odomCallback(const nav_msgs::Odometry::ConstPtr& odom) { ROS_INFO("I received odom: [%f,%f,%f]", odom->twist.twist.linear.x, odom->pose.pose.position.y,odom->pose.pose.orientation.z); double xpos = odom->twist.twist.linear.x; if(xpos < 0.2) //assuming 0.2 is the end { _right = true; _left = true; } else { _right = false; _left = false; } publish(); } private: ros::NodeHandle _n; ros::Publisher _pub; ros::Subscriber _sub; bool _right, _left; };// End of class TurtleMoveAvoid int main(int argc, char **argv) { ros::init(argc, argv, "turtle_move_odom"); TurtleMoveAvoid turtle; ros::Rate loop_rate(10); while (ros::ok()) { ros::spinOnce(); //get new callback, adjust publish then publish again. loop_rate.sleep(); } return 0; }
$
0
0
Hi, dylankc. Did you solve this problem?... If yes, how could you do that? Thanks
↧
Search
RSSing.com
Remove ADS
Viewing all articles
Article 1
Article 2
Article 3
Article 4
Browse latest
Browse all 4
Trending Articles
Practice Sheet of Right form of verbs for HSC Students
September 22, 2019, 11:40 pm
Download: FK ft Shenky – Nakuyewa ”Prod by: Shenky”
February 16, 2017, 4:24 pm
How to win at Markstrat (Markstrat Tips and Tricks) – Vodites
January 5, 2014, 10:34 pm
Ominde Commission Report and Recommendations – Ominde Report of 1964
March 16, 2015, 5:14 am
Bureau of Internal Revenue: Regional Offices (Directory)
January 9, 2014, 11:06 pm
GO 53 on Enhancement of Ex-gratia upto 5 Lakhs Toddy Tappers in Telangana
March 26, 2017, 11:23 pm
Cakewalk CA-2A Leveling Amplifier v2.0.1.97 WiN, v2.0.1.96 OSX Incl Keygen
October 17, 2016, 7:20 am
Mp3 Download: Mdu - Kunjenjenjena
December 7, 2017, 8:16 am
How the kill the job , when DTP request running for long hours.
July 26, 2013, 2:41 am
Microsoft Intune から展開しているアプリのアップデートについて
October 17, 2016, 4:11 am
18-year-old girl was beaten for half an hour by two Northampton men in 'an...
September 1, 2017, 10:00 pm
Car crash in Dunton Bassett leaves driver in critical condition
October 7, 2014, 7:51 am
Macky 2, Two Others In Road Accident
March 29, 2015, 5:34 am
Application log 00000000000000089514: Could not convert queue DLVST90CLNT
May 14, 2015, 11:27 pm
Detroit mafia: D’Anna Brothers agree to plea deal
April 21, 2016, 6:56 am
Delivery block field greyed out using VA02
January 26, 2016, 2:52 pm
Muloraki Au
June 22, 2016, 1:44 am
【個人撮影】スマホのプライベート映像♪「中に出さないで///」カラオケ屋での生ハメ撮りが流出w【リベンジポルノ】@PornHub
October 12, 2017, 2:23 pm
BREAKING NEWS: Diamond Platnumz Is Reported Dead After Ghastly Car Accident
February 9, 2018, 4:56 am
FIAT 500 B0111 B0112
July 5, 2018, 10:31 am
Search
RSSing.com
© 2025 //www.rssing.com
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>