User Program Manual
[
Front page
] [
New
|
List of pages
|
Search
|
Recent changes
|
Help
]
Start:
[[FrontPage]]
#contents
*Source & Compile [#abfd7a75]
**Source [#e5675d3d]
-Phenox source programs are very simple, consisting of fo...
--pxlib.c(/root/dirs/pc/code/basic)
--pxlib.h(/root/dirs/pc/code/basic)
--main.c(/root/dirs/pc/work/(user project folder)
**Compile [#xd783d27]
***Library building [#l5e5bd2b]
-If users modify pxlib.c or pxlib.h, library compilation ...
cd /root/dirs/pc/code
make clean all
***Project building [#c8d9a42f]
-After library building is finished, project compilation ...
cd /root/dirs/pc/work/(user project folder)
make clean all
-Users can compile all projects by make-command in work/ ...
cd /root/dirs/pc/work/
make clean all
***Executing script [#z9e14d5d]
-Before runnging Phenox program, users need to mount SD c...
cp tutorial_***.sh user_custom.sh
vi user_custom.sh
-To enable Phenox to execute program immediately after fi...
cp user_custom.sh /etc/profile.d
**Simple main.c example [#ab3675be]
-This is a source file of Tutorial6. See [[Tutorials]]
#ref(main.c);
*Struct [#m6ffe293]
**Operating parameters(pconfig) [#qbf9cc6b]
--User can modify following parameters which depend on en...
-duty_hover
--Nominal duty in hovering state(manual and automatic mode)
-duty_hover_max
--Maximum duty in hovering state(manual and automatic mode)
--If this parameter is too small, Phenox cannot go upper.
-duty_hover_min
--Minimum duty in hovering state(manual and automatic mode)
--If this parameter is too large, Phenox cannot go down.
-duty_up
--Constant duty in goint upper state(automatic mode)
--If this parameter is too small, Phenox cannot go upper.
-duty_down
--Constant duty in goint down state(automatic mode)
--If this parameter is too large, Phenox cannot go down.
-pgain_vision_tx, dgain_vision_tx
--PD control gain of X axis(visual feedback controller of...
-pgain_vision_ty, dgain_vision_ty
--PD control gain of Y axis(visual feedback controller of...
-pgain_vision_tz, dgain_vision_tz
--PD control gain of Z axis(visual feedback controller of...
-pgain_sonar,dgain_sonar
--PD control gain of Z axis(feedback controller of the ra...
-whisleborder
--Threashold of detecting whisle
-soundborder
--Threashold of detecting sound
-uptime_max
--Maximum time in going-upper state(seconds)
-downtime_max
--Maximum time in going-down state(seconds)
-Usage
pconfig pc;
pxget_pconfig(&pc)//get current pconfig mode
pc.*** = foo;//edit parameter which users are interested...
pxset_pconfig(&pc)//reflect the parameter.
--Users can left unknown or unfamiliar parameters open.
--The change of the parameter is immediately updated anyw...
**Manual control input(manconfig) [#qf57d064]
--Phenox orders these configurations in manual mode.
--Any controllers can be applied to control Phenox manual...
-stop
--0:Nothing
--1:stop all motors
-start
--0:Nothing
--1:
---If motor is not rotating, Phenox enters startup mode f...
---If motor is rotating, Phenox enters hovering state.
-yaw
-- -1:CCW yaw rotation when Phenox is in hovering state.
-- 0:Nothing
-- 1:CW yaw rotation when Phenox is in hovering state.
-horizontal
--Analog value from 0 to 255 to control X axis.
--Nominl value should be 127.
-vertical
--Analog value from 0 to 255 to control Y axis.
--Nominl value should be 127.
-height
--Analog value from 0 to 255 to control Z axis.
--Nominal value should be 127.
-Usage
manconfig mc;
mc.start = commandfromcontroller[0];
mc.yaw = commandfromcontroller[1];
mc.stop = commandfromcontroller[2];
mc.horizontal = commandfromcontroller[3];
mc.vertical = commandfromcontroller[4];
mc.height = commandfromcontroller[5];
pxset_manconfig(&mc);
--In tutorial, to prevent receiving special character suc...
**Self-state(selfstate) [#vbf36201]
-pitch
--Current pitch angle(degree around X axis)
-roll
--Current roll angle(degree around Y axis)
-yaw
--Current yaw angle(degree around Z axis)
-vision_tx
--Self-position estimated from visual feature points(X ax...
-vision_ty
--Self-position estimated from visual feature points(Y ax...
-vision_tz
--Self-position estimated from visual feature points(Z ax...
-vision_vx
--Self-velocity estimated from visual feature points(X ax...
-vision_vy
--Self-velocity estimated from visual feature points(Y ax...
-vision_vz
--Self-velocity estimated from visual feature points(Z ax...
-range
--Self-position estimated from range sensor(Z axis)
-Usage
selfstate st;
pxget_selfstate(&st);
printf("%.2f %.2f %.2f %.2f %.2f %.2f %.2f\n",st.pitch,s...
*Function [#d10f07dc]
**Base [#c5314bde]
***void pxinit_chain() [#bdca4f7c]
-This function executes initialize sequence which users s...
--It includes memory map allocation for communication for...
-CPU0 wakes CPU1 up to enter to initialize sequence of pe...
++IMU initialization
++Motor controller initialization
++Mic initialization.
++Two camera initialization.
-Default values of pconfig and manconfig are set by this ...
-Users must call this function first before executing any...
***void pxclose_chain() [#hf89a6b7]
-This function frees memory and close feature points trac...
-Users exexute this function before closing program.
***int pxget_cpu1ready() [#ke51e858]
-This finction is used for waiting for initialization of ...
-CPU1 starts following program in the background after in...
++calculates self attitude from IMUs.
++feature points and image acquision background and write...
at 30fps.
++battery voltage monitoring
-Sound detection starts once for self check.If users exec...
,return,
,0,CPU1 is not initialized
,1,CPU1 is initialized
***void pxset_manauto(int val) [#o203e58a]
-This function sets controller mode to Phenox
,val,
,0,Phenox enters manual control mode immediately
,1,Phenox enters automatic control mode immediately
-If users use manual-auto combination, switching from man...
***int pxget_manauto(); [#eebc90b9]
-This function gets current controller mode from Phenox
,return,
,0,Phenox is in manual control mode.
,1,Phenox is in automatic control mode.
***void pxset_automode_xy(int val) [#pb7fda68]
-When CPU0 is in automatic control mode(pxget_manauto() =...
-If val == 0: Phenox selects PD controller based on visua...
--Users can set target position by pxset_visioncontrol_xy...
--PD controll parameter can be tuned by editing pgain_vis...
-If val == 1: Users directly control roll,pitch angle by ...
--pxset_dst_pitch(float degree) and pxset_dst_roll(float ...
,val,
,0,Phenox selects PD control based on visual feature poin...
,1,"Phenox selects direct angle control of roll,pitch ang...
***void pxset_visioncontrol_xy(float tx,float ty); [#pb8d...
-This functions set desired horizontal position(tx,ty) ba...
--As follows, relative position from current position sho...
selfstate st;
pxget_selfstate(&st);
pxset_visioncontrol_xy(st.vision_tx+alpha,st.vision_ty+b...
***void pxset_automode_z(int val) [#w6e8d1b7]
-When CPU0 is in automatic control mode(pxget_manauto() =...
--If val == 0: Phenox selects PD control based on visual ...
---User can set desired height using pxset_visioncontrol_...
---PD controll parameter can be tuned by editing pgain_vi...
--If val == 1: Phenox selects PD control based on range s...
---User can set desired height using pxset_rangecontrol_z()
---PD control parameter can be tuned by editing pgain_ran...
,val,
,0,Phenox selects PD control based on visual feature poin...
,1,Phenox selects PD control based range sensor(30cm to 1...
***void pxset_visioncontrol_z(float tz); [#oa981cb1]
-This functions set desired height based on visual featur...
--As follows, relative position from current position sho...
selfstate st;
pxget_selfstate(&st);
pxset_visioncontrol_z(st.vision_tz+alpha)
***void pxset_rangecontrol_z(float tz); [#v12dbbb8]
-This functions set desired height based on range sensor ...
-Range sensor is different from visual feature point base...
-range sensor can be applied only from 30cm to 120cm, so ...
***void pxset_operate_mode(int val); [#scd07690]
-When CPU0 is in automatic control mode(pxget_manauto() =...
+When motor is not rotating
-If val == 0: Halt mode
-If val == 1: Startup and going-upper mode
--Phenox enters startup sequence for 3sec, and goes upper.
--Then, Phenox enters hovering state(pxset_operate_mode()...
++User-defined height
--After users call pxset_automode_z(1)(height estimation ...
++User-defined limit time
--Limit time which Phenox enters hovering mode from going...
-If val == 2: Startup and hovering mode
--Phenox enters startup sequence for 3sec, and enters hov...
++User-defined height control rule
--If pxget_automode_z() == 0 (height control using featur...
---Users can set desired height by calling pxset_visionco...
---PD controll parameter can be tuned by editing pgain_vi...
--If pxget_automode_z() == 1 (height control using range ...
---Users can set desired height by calling pxset_sonarcon...
---PD controll parameter can be tuned by editing pgain_ra...
++User-defined horizontal control rule
--if pxget_automode_xy() == 0 (horizontal control using f...
---Users can set desired horizontal position by calling p...
---PD controll parameter can be tuned by editing pgain_vi...
--If pxget_automode_xy() == 1 (Users directly control rol...
---Users can directly control roll,pitch angle by calling...
-If val == 3: Go to halt mode immediately
2.when motor is rotating
-If val == 0: Phenox stops motors immediately.
-If val == 1: Phenox enters going-upper mode skipping sta...
-If val == 2: Phenox enters hovering mode skipping startu...
-If val == 3: Phenox enters going-down mode skipping star...
**Image [#b5c15f5c]
***int pxget_img_detect(char id) [#rfd9d8b5]
-In Phenox, FPGA continues to get image from two camera a...
--And there is an idle time between the end of image sign...
--pxget_img_detect() returns the state whether the select...
,id,
,0,front camera is selected
,1,bottom camera is selected
,return,
,0,the selected camera signal is not in idle state(cannot...
,1,the selected camera signal is in idle state(can copy c...
***void pxset_imgfull(char id, IplImage *img, int div) [#...
-This functions saves image of the selected camera to use...
--Initialization of IplImage is requiered before calling ...
IplImage *img = cvCreateImage(cvSize(hlength,vlength),IP...
,id,
,0,front camera is selected
,1,bottom camera is selected
,div,
,0,image size is 320 x 240 x 2byte(RGB color)
,1,image size is 160 x 120 x 2byte(RGB color)
,2,image size is 80 x 60 x 2byte(RGB color)
***void pxset_featurelog(int val) [#he60b7ae]
-This function writes feature points location and its tra...
-This function should be called periodically in timer int...
-Log file is automaically created and initialized in pxli...
,val,
,0,feature points of front camera is saved in log file
,1,feature points of bottom camera is saved in log file
-Users can find feature the log file in /media/boot/featu...
-And users can see log file using openframeworks using ou...
-In our Ubuntu host machines, following comands starts vi...
cd ~/openframework/of_v0.7.4_linux64_release/examples/vi...
make clean all
cp /media/boot/featurelog.txt .
./bin/visualizer
**Sound [#ne2f6151]
***int pxget_whisle_detect(); [#rae77e02]
-If whisle sound(3kHz peak) is detected, return 1
-Users need to reset this state to call pxset_whisle_dete...
,return,
,0,whisle sound is not detected
,1,whisle sound is detected
***void pxset_whisle_detect(int val); [#w721aa53]
-This function is used to reset state of pxget_whisle_det...
pxset_whisle_detect(0);
***void pxset_whisle_border(int val); [#laa6d47b]
-This function is used to set threashold of whisle detect...
***int pxget_sound_detect(); [#mb2d8205]
-If voice sound is detected, return 1
-Users need to reset this state to call pxset_sound_detec...
***void pxset_sound_detect(int val); [#p8d74271]
-This function is used to reset state of pxget_sound_dete...
pxset_sound_detect(0);
***int pxget_sound(short *buffer, int size); [#uadef73a]
-This function copies sound raw data to allocated buffer.
-Size over 36,864 byte is ignored. It is equivalent to 1....
End:
[[FrontPage]]
#contents
*Source & Compile [#abfd7a75]
**Source [#e5675d3d]
-Phenox source programs are very simple, consisting of fo...
--pxlib.c(/root/dirs/pc/code/basic)
--pxlib.h(/root/dirs/pc/code/basic)
--main.c(/root/dirs/pc/work/(user project folder)
**Compile [#xd783d27]
***Library building [#l5e5bd2b]
-If users modify pxlib.c or pxlib.h, library compilation ...
cd /root/dirs/pc/code
make clean all
***Project building [#c8d9a42f]
-After library building is finished, project compilation ...
cd /root/dirs/pc/work/(user project folder)
make clean all
-Users can compile all projects by make-command in work/ ...
cd /root/dirs/pc/work/
make clean all
***Executing script [#z9e14d5d]
-Before runnging Phenox program, users need to mount SD c...
cp tutorial_***.sh user_custom.sh
vi user_custom.sh
-To enable Phenox to execute program immediately after fi...
cp user_custom.sh /etc/profile.d
**Simple main.c example [#ab3675be]
-This is a source file of Tutorial6. See [[Tutorials]]
#ref(main.c);
*Struct [#m6ffe293]
**Operating parameters(pconfig) [#qbf9cc6b]
--User can modify following parameters which depend on en...
-duty_hover
--Nominal duty in hovering state(manual and automatic mode)
-duty_hover_max
--Maximum duty in hovering state(manual and automatic mode)
--If this parameter is too small, Phenox cannot go upper.
-duty_hover_min
--Minimum duty in hovering state(manual and automatic mode)
--If this parameter is too large, Phenox cannot go down.
-duty_up
--Constant duty in goint upper state(automatic mode)
--If this parameter is too small, Phenox cannot go upper.
-duty_down
--Constant duty in goint down state(automatic mode)
--If this parameter is too large, Phenox cannot go down.
-pgain_vision_tx, dgain_vision_tx
--PD control gain of X axis(visual feedback controller of...
-pgain_vision_ty, dgain_vision_ty
--PD control gain of Y axis(visual feedback controller of...
-pgain_vision_tz, dgain_vision_tz
--PD control gain of Z axis(visual feedback controller of...
-pgain_sonar,dgain_sonar
--PD control gain of Z axis(feedback controller of the ra...
-whisleborder
--Threashold of detecting whisle
-soundborder
--Threashold of detecting sound
-uptime_max
--Maximum time in going-upper state(seconds)
-downtime_max
--Maximum time in going-down state(seconds)
-Usage
pconfig pc;
pxget_pconfig(&pc)//get current pconfig mode
pc.*** = foo;//edit parameter which users are interested...
pxset_pconfig(&pc)//reflect the parameter.
--Users can left unknown or unfamiliar parameters open.
--The change of the parameter is immediately updated anyw...
**Manual control input(manconfig) [#qf57d064]
--Phenox orders these configurations in manual mode.
--Any controllers can be applied to control Phenox manual...
-stop
--0:Nothing
--1:stop all motors
-start
--0:Nothing
--1:
---If motor is not rotating, Phenox enters startup mode f...
---If motor is rotating, Phenox enters hovering state.
-yaw
-- -1:CCW yaw rotation when Phenox is in hovering state.
-- 0:Nothing
-- 1:CW yaw rotation when Phenox is in hovering state.
-horizontal
--Analog value from 0 to 255 to control X axis.
--Nominl value should be 127.
-vertical
--Analog value from 0 to 255 to control Y axis.
--Nominl value should be 127.
-height
--Analog value from 0 to 255 to control Z axis.
--Nominal value should be 127.
-Usage
manconfig mc;
mc.start = commandfromcontroller[0];
mc.yaw = commandfromcontroller[1];
mc.stop = commandfromcontroller[2];
mc.horizontal = commandfromcontroller[3];
mc.vertical = commandfromcontroller[4];
mc.height = commandfromcontroller[5];
pxset_manconfig(&mc);
--In tutorial, to prevent receiving special character suc...
**Self-state(selfstate) [#vbf36201]
-pitch
--Current pitch angle(degree around X axis)
-roll
--Current roll angle(degree around Y axis)
-yaw
--Current yaw angle(degree around Z axis)
-vision_tx
--Self-position estimated from visual feature points(X ax...
-vision_ty
--Self-position estimated from visual feature points(Y ax...
-vision_tz
--Self-position estimated from visual feature points(Z ax...
-vision_vx
--Self-velocity estimated from visual feature points(X ax...
-vision_vy
--Self-velocity estimated from visual feature points(Y ax...
-vision_vz
--Self-velocity estimated from visual feature points(Z ax...
-range
--Self-position estimated from range sensor(Z axis)
-Usage
selfstate st;
pxget_selfstate(&st);
printf("%.2f %.2f %.2f %.2f %.2f %.2f %.2f\n",st.pitch,s...
*Function [#d10f07dc]
**Base [#c5314bde]
***void pxinit_chain() [#bdca4f7c]
-This function executes initialize sequence which users s...
--It includes memory map allocation for communication for...
-CPU0 wakes CPU1 up to enter to initialize sequence of pe...
++IMU initialization
++Motor controller initialization
++Mic initialization.
++Two camera initialization.
-Default values of pconfig and manconfig are set by this ...
-Users must call this function first before executing any...
***void pxclose_chain() [#hf89a6b7]
-This function frees memory and close feature points trac...
-Users exexute this function before closing program.
***int pxget_cpu1ready() [#ke51e858]
-This finction is used for waiting for initialization of ...
-CPU1 starts following program in the background after in...
++calculates self attitude from IMUs.
++feature points and image acquision background and write...
at 30fps.
++battery voltage monitoring
-Sound detection starts once for self check.If users exec...
,return,
,0,CPU1 is not initialized
,1,CPU1 is initialized
***void pxset_manauto(int val) [#o203e58a]
-This function sets controller mode to Phenox
,val,
,0,Phenox enters manual control mode immediately
,1,Phenox enters automatic control mode immediately
-If users use manual-auto combination, switching from man...
***int pxget_manauto(); [#eebc90b9]
-This function gets current controller mode from Phenox
,return,
,0,Phenox is in manual control mode.
,1,Phenox is in automatic control mode.
***void pxset_automode_xy(int val) [#pb7fda68]
-When CPU0 is in automatic control mode(pxget_manauto() =...
-If val == 0: Phenox selects PD controller based on visua...
--Users can set target position by pxset_visioncontrol_xy...
--PD controll parameter can be tuned by editing pgain_vis...
-If val == 1: Users directly control roll,pitch angle by ...
--pxset_dst_pitch(float degree) and pxset_dst_roll(float ...
,val,
,0,Phenox selects PD control based on visual feature poin...
,1,"Phenox selects direct angle control of roll,pitch ang...
***void pxset_visioncontrol_xy(float tx,float ty); [#pb8d...
-This functions set desired horizontal position(tx,ty) ba...
--As follows, relative position from current position sho...
selfstate st;
pxget_selfstate(&st);
pxset_visioncontrol_xy(st.vision_tx+alpha,st.vision_ty+b...
***void pxset_automode_z(int val) [#w6e8d1b7]
-When CPU0 is in automatic control mode(pxget_manauto() =...
--If val == 0: Phenox selects PD control based on visual ...
---User can set desired height using pxset_visioncontrol_...
---PD controll parameter can be tuned by editing pgain_vi...
--If val == 1: Phenox selects PD control based on range s...
---User can set desired height using pxset_rangecontrol_z()
---PD control parameter can be tuned by editing pgain_ran...
,val,
,0,Phenox selects PD control based on visual feature poin...
,1,Phenox selects PD control based range sensor(30cm to 1...
***void pxset_visioncontrol_z(float tz); [#oa981cb1]
-This functions set desired height based on visual featur...
--As follows, relative position from current position sho...
selfstate st;
pxget_selfstate(&st);
pxset_visioncontrol_z(st.vision_tz+alpha)
***void pxset_rangecontrol_z(float tz); [#v12dbbb8]
-This functions set desired height based on range sensor ...
-Range sensor is different from visual feature point base...
-range sensor can be applied only from 30cm to 120cm, so ...
***void pxset_operate_mode(int val); [#scd07690]
-When CPU0 is in automatic control mode(pxget_manauto() =...
+When motor is not rotating
-If val == 0: Halt mode
-If val == 1: Startup and going-upper mode
--Phenox enters startup sequence for 3sec, and goes upper.
--Then, Phenox enters hovering state(pxset_operate_mode()...
++User-defined height
--After users call pxset_automode_z(1)(height estimation ...
++User-defined limit time
--Limit time which Phenox enters hovering mode from going...
-If val == 2: Startup and hovering mode
--Phenox enters startup sequence for 3sec, and enters hov...
++User-defined height control rule
--If pxget_automode_z() == 0 (height control using featur...
---Users can set desired height by calling pxset_visionco...
---PD controll parameter can be tuned by editing pgain_vi...
--If pxget_automode_z() == 1 (height control using range ...
---Users can set desired height by calling pxset_sonarcon...
---PD controll parameter can be tuned by editing pgain_ra...
++User-defined horizontal control rule
--if pxget_automode_xy() == 0 (horizontal control using f...
---Users can set desired horizontal position by calling p...
---PD controll parameter can be tuned by editing pgain_vi...
--If pxget_automode_xy() == 1 (Users directly control rol...
---Users can directly control roll,pitch angle by calling...
-If val == 3: Go to halt mode immediately
2.when motor is rotating
-If val == 0: Phenox stops motors immediately.
-If val == 1: Phenox enters going-upper mode skipping sta...
-If val == 2: Phenox enters hovering mode skipping startu...
-If val == 3: Phenox enters going-down mode skipping star...
**Image [#b5c15f5c]
***int pxget_img_detect(char id) [#rfd9d8b5]
-In Phenox, FPGA continues to get image from two camera a...
--And there is an idle time between the end of image sign...
--pxget_img_detect() returns the state whether the select...
,id,
,0,front camera is selected
,1,bottom camera is selected
,return,
,0,the selected camera signal is not in idle state(cannot...
,1,the selected camera signal is in idle state(can copy c...
***void pxset_imgfull(char id, IplImage *img, int div) [#...
-This functions saves image of the selected camera to use...
--Initialization of IplImage is requiered before calling ...
IplImage *img = cvCreateImage(cvSize(hlength,vlength),IP...
,id,
,0,front camera is selected
,1,bottom camera is selected
,div,
,0,image size is 320 x 240 x 2byte(RGB color)
,1,image size is 160 x 120 x 2byte(RGB color)
,2,image size is 80 x 60 x 2byte(RGB color)
***void pxset_featurelog(int val) [#he60b7ae]
-This function writes feature points location and its tra...
-This function should be called periodically in timer int...
-Log file is automaically created and initialized in pxli...
,val,
,0,feature points of front camera is saved in log file
,1,feature points of bottom camera is saved in log file
-Users can find feature the log file in /media/boot/featu...
-And users can see log file using openframeworks using ou...
-In our Ubuntu host machines, following comands starts vi...
cd ~/openframework/of_v0.7.4_linux64_release/examples/vi...
make clean all
cp /media/boot/featurelog.txt .
./bin/visualizer
**Sound [#ne2f6151]
***int pxget_whisle_detect(); [#rae77e02]
-If whisle sound(3kHz peak) is detected, return 1
-Users need to reset this state to call pxset_whisle_dete...
,return,
,0,whisle sound is not detected
,1,whisle sound is detected
***void pxset_whisle_detect(int val); [#w721aa53]
-This function is used to reset state of pxget_whisle_det...
pxset_whisle_detect(0);
***void pxset_whisle_border(int val); [#laa6d47b]
-This function is used to set threashold of whisle detect...
***int pxget_sound_detect(); [#mb2d8205]
-If voice sound is detected, return 1
-Users need to reset this state to call pxset_sound_detec...
***void pxset_sound_detect(int val); [#p8d74271]
-This function is used to reset state of pxget_sound_dete...
pxset_sound_detect(0);
***int pxget_sound(short *buffer, int size); [#uadef73a]
-This function copies sound raw data to allocated buffer.
-Size over 36,864 byte is ignored. It is equivalent to 1....
Page: