Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cm510_controller_fw
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
humanoides
cm510_controller_fw
Commits
e2b4a2ce
Commit
e2b4a2ce
authored
8 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Updated the stairs example to use the motion librray and the actual GPIO ports.
parent
57d92b67
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/stairs/Makefile
+1
-1
1 addition, 1 deletion
examples/stairs/Makefile
examples/stairs/stairs.c
+2
-159
2 additions, 159 deletions
examples/stairs/stairs.c
with
3 additions
and
160 deletions
examples/stairs/Makefile
+
1
−
1
View file @
e2b4a2ce
...
@@ -2,7 +2,7 @@ PROJECT=stairs
...
@@ -2,7 +2,7 @@ PROJECT=stairs
########################################################
########################################################
# afegir tots els fitxers que s'han de compilar aquí
# afegir tots els fitxers que s'han de compilar aquí
########################################################
########################################################
SOURCES
=
stairs.c
../mtn_library.c
SOURCES
=
stairs.c
OBJS
=
$(
SOURCES:.c
=
.o
)
OBJS
=
$(
SOURCES:.c
=
.o
)
SRC_DIR
=
./
SRC_DIR
=
./
...
...
This diff is collapsed.
Click to expand it.
examples/stairs/stairs.c
+
2
−
159
View file @
e2b4a2ce
...
@@ -6,162 +6,6 @@
...
@@ -6,162 +6,6 @@
#include
"mtn_library.h"
#include
"mtn_library.h"
typedef
enum
{
wait_start
,
wait_ready
,
walk_to_stairs1
,
wait_stop1
,
up_stairs1
}
main_states
;
typedef
enum
{
wait_start
,
wait_ready
,
walk_to_stairs1
,
wait_stop1
,
up_stairs1
}
main_states
;
typedef
enum
{
up_idle
,
up_wait_stop
,
up_wait_step1
,
up_delay1
,
up_wait_step2
,
up_wait_step3
,
up_wait_step4
,
wait_ready_up
}
stairs_up_states
;
typedef
enum
{
down_idle
,
down_wait_stop
,
down_wait_step1
,
down_wait_step2
,
down_wait_step3
,
wait_ready_down
}
stairs_down_states
;
uint8_t
stairs_up_process
(
void
)
{
static
stairs_up_states
state
=
up_idle
;
uint8_t
done
=
0x00
;
switch
(
state
)
{
case
up_idle
:
if
(
is_action_running
())
{
action_stop_page
();
state
=
up_wait_stop
;
}
else
{
action_set_page
(
227
);
action_start_page
();
state
=
up_wait_step1
;
}
break
;
case
up_wait_stop
:
if
(
is_action_running
())
state
=
up_wait_stop
;
else
{
action_set_page
(
227
);
action_start_page
();
state
=
up_wait_step1
;
}
break
;
case
up_wait_step1
:
if
(
is_action_running
())
state
=
up_wait_step1
;
else
{
user_time_set_one_time
(
1500
);
state
=
up_delay1
;
}
break
;
case
up_delay1
:
if
(
user_time_is_done
())
{
action_set_page
(
224
);
action_start_page
();
state
=
up_wait_step2
;
}
else
state
=
up_delay1
;
break
;
case
up_wait_step2
:
if
(
is_action_running
())
state
=
up_wait_step2
;
else
{
action_set_page
(
225
);
action_start_page
();
state
=
up_wait_step3
;
}
break
;
case
up_wait_step3
:
if
(
is_action_running
())
state
=
up_wait_step3
;
else
{
action_set_page
(
226
);
action_start_page
();
state
=
up_wait_step4
;
}
break
;
case
up_wait_step4
:
if
(
is_action_running
())
state
=
up_wait_step4
;
else
{
action_set_page
(
31
);
action_start_page
();
state
=
wait_ready_up
;
}
break
;
case
wait_ready_up
:
if
(
is_action_running
())
state
=
wait_ready_up
;
else
{
state
=
up_idle
;
done
=
0x01
;
}
break
;
}
return
done
;
}
uint8_t
stairs_down_process
(
void
)
{
static
stairs_down_states
state
=
down_idle
;
uint8_t
done
=
0x00
;
switch
(
state
)
{
case
down_idle
:
if
(
is_action_running
())
{
action_stop_page
();
state
=
down_wait_stop
;
}
else
{
action_set_page
(
228
);
action_start_page
();
state
=
down_wait_step1
;
}
break
;
case
down_wait_stop
:
if
(
is_action_running
())
state
=
down_wait_stop
;
else
{
action_set_page
(
228
);
action_start_page
();
state
=
down_wait_step1
;
}
break
;
case
down_wait_step1
:
if
(
is_action_running
())
state
=
down_wait_step1
;
else
{
action_set_page
(
229
);
action_start_page
();
state
=
down_wait_step2
;
}
break
;
case
down_wait_step2
:
if
(
is_action_running
())
state
=
down_wait_step2
;
else
{
action_set_page
(
230
);
action_start_page
();
state
=
down_wait_step3
;
}
break
;
case
down_wait_step3
:
if
(
is_action_running
())
state
=
down_wait_step3
;
else
{
action_set_page
(
31
);
action_start_page
();
state
=
wait_ready_down
;
}
break
;
case
wait_ready_down
:
if
(
is_action_running
())
state
=
wait_ready_down
;
else
{
state
=
down_idle
;
done
=
0x01
;
}
break
;
}
return
done
;
}
void
user_init
(
void
)
void
user_init
(
void
)
{
{
...
@@ -170,7 +14,6 @@ void user_init(void)
...
@@ -170,7 +14,6 @@ void user_init(void)
balance_calibrate_gyro
();
balance_calibrate_gyro
();
balance_enable_gyro
();
balance_enable_gyro
();
user_time_set_period
(
100
);
user_time_set_period
(
100
);
mtn_lib_init
();
}
}
void
user_loop
(
void
)
void
user_loop
(
void
)
...
@@ -196,7 +39,7 @@ void user_loop(void)
...
@@ -196,7 +39,7 @@ void user_loop(void)
state
=
walk_to_stairs1
;
state
=
walk_to_stairs1
;
}
}
break
;
break
;
case
walk_to_stairs1
:
if
(
exp_gpio_get_value
(
GPIO0
)
||
exp_gpio_get_value
(
GPIO
3
)
)
case
walk_to_stairs1
:
if
(
exp_gpio_get_value
(
GPIO
1
)
==
0x0
0
||
exp_gpio_get_value
(
GPIO
18
)
==
0x00
)
{
{
mtn_lib_stop_mtn
();
mtn_lib_stop_mtn
();
state
=
wait_stop1
;
state
=
wait_stop1
;
...
@@ -210,7 +53,7 @@ void user_loop(void)
...
@@ -210,7 +53,7 @@ void user_loop(void)
else
else
state
=
wait_stop1
;
state
=
wait_stop1
;
break
;
break
;
case
up_stairs1
:
if
(
stairs_up_process
())
case
up_stairs1
:
if
(
stairs_up_process
(
robot_standing
))
state
=
wait_start
;
state
=
wait_start
;
else
else
state
=
up_stairs1
;
state
=
up_stairs1
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment