Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of Robocode by
Diff: source/Movement.cpp
- Revision:
- 106:02d3327bf76a
- Parent:
- 105:d489c2e8de35
- Child:
- 107:02bc5b4e67b7
- Child:
- 114:8e8a7a9b6fd8
--- a/source/Movement.cpp Thu May 04 09:19:26 2017 +0000
+++ b/source/Movement.cpp Fri May 05 10:48:36 2017 +0000
@@ -29,6 +29,9 @@
return 0;
}
+/**
+ * Stops current movement immediately
+**/
void stop_move()
{
set_speed(0,0);
@@ -36,6 +39,9 @@
is_moving = false;
}
+/**
+ * Stops current turn immediately
+**/
void stop_turn()
{
set_speed(0,0);
@@ -43,6 +49,13 @@
is_turning = false;
}
+
+/**
+ * move for wanted distance on circle with a given radius
+ * needs to be called until return < 0
+ * if calling distance not 0: distance and radius initilisation.
+ * by Claudio Citterio
+**/
float move_for_distance_with_radius(float distance, float r)
{
@@ -131,7 +144,12 @@
return wanted_dist;
}
-
+/**
+ * move for wanted distance
+ * needs to be called until return < 0
+ * if calling distance not 0: distance initilisation.
+ * by Claudio Citterio
+**/
float move_for_distance(float distance)
{
printf("move for distance\r\n");
@@ -182,7 +200,13 @@
return wanted_dist;
}
-float turn_for_deg(float deg) //if deg not 0 equals initilisation.
+/**
+ * turn for wanted degree
+ * needs to be called until return < 0
+ * if deg not 0: turn initilisation.
+ * Claudio Citterio
+**/
+float turn_for_deg(float deg)
{
if(deg != 0) {
@@ -226,6 +250,10 @@
return (wanted_deg);
}
+/** has errors
+ * moves to next coordinate from coordinate list
+ * by Claudio Citterio
+**/
int move_to_next_coord()
{
@@ -270,7 +298,10 @@
return 0;
}
-// Tobias Berger
+/**
+ * this function searchs a nearby brick, moves towards it and grabbs it
+ * by Tobias Berger, state machine by Claudio Citterio
+**/
int move_in_search_for_brick()
{
float upper = getDistanceIR(2); // get distance from upper Center Sensor
