Please select Into the mobile phone version | Continue to access the computer ver.
Distance sensors, update
3892 21 2020-4-1
Uploading and Loding Picture ...(0/1)
o(^-^)o
thomasnemo.com
lvl.2
Flight distance : 446 ft
Poland
Offline

I was looking for distance sensors in my new RoboMaster. I see block (diy programming) - gray color - not available? Finally I have used infrared to get this facebook post

Update: Here you can download the code, v1.0 - Txt, dsp file
Variables:
variable_headMinAngle = -30 // head angle in left position
    variable_headMaxAngle = 30 // head angle in right position
    variable_headStep = 10 // for how much head change rotation angle (scan environment)
    variable_defaultHeadPitch = -5 // pitch in 0 position (looking straight)
    variable_headUpX = 0 // determine optionally pitch angle for different head position
    variable_normalSpeed = 0.2 // speed
    variable_lazyLevel = 0 // 0-10 value (Octo is waiting after he finds an obstacle)
    variable_senseSightAnimal = 0 // not supported - will try to recognize animal

-

Update:
You can download 1.1 here Download

Code v1.1
- higher iq
- hearingSense - 3 claps to sleep/go, 2 claps to scary
- sightSense - oposite V to scary

Working on version 2.0 now with advanced AI part.

More info: Dji Discussion new thread

2020-4-1
Use props
gpvillamil
lvl.4
Flight distance : 210226 ft
United States
Offline

That's really clever! Using the IR blaster and hit detector as a proximity sensor? Can you share the code?
2020-4-1
Use props
Bitmizu
lvl.1

Singapore
Offline

Awesome! Share your code, pls.
2020-4-1
Use props
thomasnemo.com
lvl.2
Flight distance : 446 ft
Poland
Offline

gpvillamil Posted at 4-1 12:25
That's really clever! Using the IR blaster and hit detector as a proximity sensor? Can you share the code?

Sure, Now the code is a little bit more advanced - will put the code below, Thanks
2020-4-1
Use props
thomasnemo.com
lvl.2
Flight distance : 446 ft
Poland
Offline

I'm not hardware guy but I love inventions related to software, AI/VR and robots. I developed 4 technologies (software) which now I'm implementing in tek projects. I 'm software developer since I was 9 but 10 years ago I forced to care on business side (Bali helped me).  I found 15 people and together we are working on implementation of the projects.   Maybe you could help me and share the info about Smellv.com (http://fb.com/smellvr)? A great VR device - a Kickstarter compaign starts in 1 month.   Btw. It would be great for us to work with Dji on Smell'v (I even asked for help 1 month ago at Dji shop). we will see.

2020-4-2
Use props
thomasnemo.com
lvl.2
Flight distance : 446 ft
Poland
Offline

same video here on Youtube: https://youtu.be/aRc3e4t4iuk
2020-4-2
Use props
robertotr
lvl.1
Flight distance : 30817 ft
  • >>>
Guatemala
Offline

that's a great idea, got really  disappointed realizing that RoboMaster s1 can't avoid obstacles, but your idea can in part solve that. Could you share the code?

2020-4-3
Use props
thomasnemo.com
lvl.2
Flight distance : 446 ft
Poland
Offline

robertotr Posted at 4-3 12:34
that's a great idea, got really  disappointed realizing that RoboMaster s1 can't avoid obstacles, but your idea can in part solve that. Could you share the code?

Yes
Sorry for the delay (Working on Coronavirus app k-virus.com).

Tomorrow morning I will put the code - much better than the from the video. You can play with different variables values.
2020-4-3
Use props
wqiu
lvl.2

China
Offline

Great, maybe we can build up a simple map indoors by IR. Could you please share your code?  
2020-4-5
Use props
thomasnemo.com
lvl.2
Flight distance : 446 ft
Poland
Offline

Hi, finally I'm ready. You can download the code from my website Smell'v - http://smellv.com/#interested.
2020-4-5
Use props
thomasnemo.com
lvl.2
Flight distance : 446 ft
Poland
Offline

----------
2020-4-5
Use props
thomasnemo.com
lvl.2
Flight distance : 446 ft
Poland
Offline

Code link - code
2020-4-5
Use props
thomasnemo.com
lvl.2
Flight distance : 446 ft
Poland
Offline

OMG! now - code link
2020-4-5
Use props
thomasnemo.com
lvl.2
Flight distance : 446 ft
Poland
Offline

ok, finally I have created a new thread, links not working
2020-4-5
Use props
thomasnemo.com
lvl.2
Flight distance : 446 ft
Poland
Offline

wqiu Posted at 4-5 07:37
Great, maybe we can build up a simple map indoors by IR. Could you please share your code?

Yes, I have this almost ready. Robomaster slow down near visited places with obstacles. I’m not sure if he can share information about obstacles...
You can download the code as file from my website http://Smellv.com
2020-4-5
Use props
thomasnemo.com
lvl.2
Flight distance : 446 ft
Poland
Offline

robertotr Posted at 4-3 12:34
that's a great idea, got really  disappointed realizing that RoboMaster s1 can't avoid obstacles, but your idea can in part solve that. Could you share the code?

You can download the code as file from my website http://Smellv.com - link
2020-4-5
Use props
thomasnemo.com
lvl.2
Flight distance : 446 ft
Poland
Offline

Bitmizu Posted at 4-1 17:09
Awesome! Share your code, pls.

Code
2020-4-5
Use props
thomasnemo.com
lvl.2
Flight distance : 446 ft
Poland
Offline

gpvillamil Posted at 4-1 12:25
That's really clever! Using the IR blaster and hit detector as a proximity sensor? Can you share the code?

Link
2020-4-5
Use props
thomasnemo.com
lvl.2
Flight distance : 446 ft
Poland
Offline

variable_headMinAngle = -30 // head angle in left position
    variable_headMaxAngle = 30 // head angle in right position
    variable_headStep = 10 // for how much head change rotation angle (scan environment)
    variable_defaultHeadPitch = -5 // pitch in 0 position (looking straight)
    variable_headUpX = 0 // determine optionally pitch angle for different head position
    variable_normalSpeed = 0.2 // speed
    variable_lazyLevel = 0 // 0-10 value (Octo is waiting after he finds an obstacle)
    variable_senseSightAnimal = 0 // not supported - will try to recognize animal
Code v1.1
- hearingSense
- sightSense
Link

Code v1.0

import random  list_Cx = RmList() list_Cy = RmList() list_Cd = RmList() list_collision = RmList() list_senseTouch = RmList() list_senseSight = RmList() list_senseHearing = RmList() pid_Ii = PIDCtrl() variable_scanX = 0 variable_scanDir = 0 variable_isAlive = 0 variable_headMinAngle = 0 variable_headMaxAngle = 0 variable_headStep = 0 variable_headUpX = 0 variable_lookUp = 0 variable_lookUpStep = 0 variable_defaultHeadPitch = 0 variable_dX1 = 0 variable_dY1 = 0 variable_dX2 = 0 variable_dY2 = 0 variable_dV = 0 variable_normalSpeed = 0 variable_lazyLevel = 0 variable_i = 0 variable_isMoving = 0 variable_senseSightAnimal = 0 variable_senseHearingVoice = 0 def user_defined_saveCoord():     global variable_scanX     global variable_scanDir     global variable_isAlive     global variable_headMinAngle     global variable_headMaxAngle     global variable_headStep     global variable_headUpX     global variable_lookUp     global variable_lookUpStep     global variable_defaultHeadPitch     global variable_dX1     global variable_dY1     global variable_dX2     global variable_dY2     global variable_dV     global variable_normalSpeed     global variable_lazyLevel     global variable_i     global variable_isMoving     global variable_senseSightAnimal     global variable_senseHearingVoice     global list_Cx     global list_Cy     global list_Cd     global list_collision     global list_senseTouch     global list_senseSight     global list_senseHearing     global pid_Ii     list_Cx.append(chassis_ctrl.get_position_based_power_on(rm_define.chassis_forward))     list_Cy.append(chassis_ctrl.get_position_based_power_on(rm_define.chassis_translation))     list_Cd.append(chassis_ctrl.get_position_based_power_on(rm_define.chassis_rotate)) def user_defined_checkSenses():     global variable_scanX     global variable_scanDir     global variable_isAlive     global variable_headMinAngle     global variable_headMaxAngle     global variable_headStep     global variable_headUpX     global variable_lookUp     global variable_lookUpStep     global variable_defaultHeadPitch     global variable_dX1     global variable_dY1     global variable_dX2     global variable_dY2     global variable_dV     global variable_normalSpeed     global variable_lazyLevel     global variable_i     global variable_isMoving     global variable_senseSightAnimal     global variable_senseHearingVoice     global list_Cx     global list_Cy     global list_Cd     global list_collision     global list_senseTouch     global list_senseSight     global list_senseHearing     global pid_Ii     if list_senseTouch[1] == 1:         list_senseTouch[1] = 0         user_defined_collision()     else:         if list_senseSight[1] == 1:             list_senseSight[1] = 0             if list_senseSight[2] != 3:                 user_defined_collision()             else:                 pass         else:             pass def user_defined_brain():     global variable_scanX     global variable_scanDir     global variable_isAlive     global variable_headMinAngle     global variable_headMaxAngle     global variable_headStep     global variable_headUpX     global variable_lookUp     global variable_lookUpStep     global variable_defaultHeadPitch     global variable_dX1     global variable_dY1     global variable_dX2     global variable_dY2     global variable_dV     global variable_normalSpeed     global variable_lazyLevel     global variable_i     global variable_isMoving     global variable_senseSightAnimal     global variable_senseHearingVoice     global list_Cx     global list_Cy     global list_Cd     global list_collision     global list_senseTouch     global list_senseSight     global list_senseHearing     global pid_Ii     user_defined_checkSenses()      if variable_isMoving == 1:         if variable_scanDir == 1:             variable_scanX = variable_scanX + variable_headStep             if variable_scanX > 0:                 if variable_headUpX != 0:                     gimbal_ctrl.angle_ctrl(variable_scanX, variable_scanX / variable_headUpX)                 else:                     gimbal_ctrl.angle_ctrl(variable_scanX, 0)             else:                 if variable_scanX < 0:                     if variable_headUpX != 0:                         gimbal_ctrl.angle_ctrl(variable_scanX, abs(variable_scanX) / variable_headUpX)                     else:                         gimbal_ctrl.angle_ctrl(variable_scanX, 0)                 else:                     gimbal_ctrl.angle_ctrl(0, variable_defaultHeadPitch)         else:             variable_scanX = variable_scanX + 0 - variable_headStep             if variable_scanX < 0:                 if variable_headUpX != 0:                     gimbal_ctrl.angle_ctrl(variable_scanX, abs(variable_scanX) / variable_headUpX)                 else:                     gimbal_ctrl.angle_ctrl(variable_scanX, 0)             else:                 if variable_scanX > 0:                     if variable_headUpX != 0:                         gimbal_ctrl.angle_ctrl(variable_scanX, variable_scanX / variable_headUpX)                     else:                         gimbal_ctrl.angle_ctrl(variable_scanX, 0)                 else:                     gimbal_ctrl.angle_ctrl(0, variable_defaultHeadPitch)         ir_blaster_ctrl.fire_once()         ir_blaster_ctrl.fire_once()         if variable_scanX == variable_headMaxAngle:             variable_scanDir = 2         else:             if variable_scanX == variable_headMinAngle:                 variable_scanDir = 1 def user_defined_life():     global variable_scanX     global variable_scanDir     global variable_isAlive     global variable_headMinAngle     global variable_headMaxAngle     global variable_headStep     global variable_headUpX     global variable_lookUp     global variable_lookUpStep     global variable_defaultHeadPitch     global variable_dX1     global variable_dY1     global variable_dX2     global variable_dY2     global variable_dV     global variable_normalSpeed     global variable_lazyLevel     global variable_i     global variable_isMoving     global variable_senseSightAnimal     global variable_senseHearingVoice     global list_Cx     global list_Cy     global list_Cd     global list_collision     global list_senseTouch     global list_senseSight     global list_senseHearing     global pid_Ii     variable_scanX = 0     variable_scanDir = 1     variable_isMoving = 1     variable_isAlive = 1     chassis_ctrl.move_degree_with_speed(variable_normalSpeed,0)     while not variable_isAlive == 0:         user_defined_brain()  def user_defined_collision():     global variable_scanX     global variable_scanDir     global variable_isAlive     global variable_headMinAngle     global variable_headMaxAngle     global variable_headStep     global variable_headUpX     global variable_lookUp     global variable_lookUpStep     global variable_defaultHeadPitch     global variable_dX1     global variable_dY1     global variable_dX2     global variable_dY2     global variable_dV     global variable_normalSpeed     global variable_lazyLevel     global variable_i     global variable_isMoving     global variable_senseSightAnimal     global variable_senseHearingVoice     global list_Cx     global list_Cy     global list_Cd     global list_collision     global list_senseTouch     global list_senseSight     global list_senseHearing     global pid_Ii     chassis_ctrl.stop()     led_ctrl.set_bottom_led(rm_define.armor_bottom_all, 255, 0, 0, rm_define.effect_always_on)     user_defined_saveCoord()      chassis_ctrl.move_with_distance(180,random.randint(4, 6) / 10)     if random.randint(1, 10) <= 9:         chassis_ctrl.rotate_with_degree(rm_define.clockwise,random.randint(30, 60))     else:         chassis_ctrl.rotate_with_degree(rm_define.anticlockwise,random.randint(30, 60))     led_ctrl.set_bottom_led(rm_define.armor_bottom_all, 255, 255, 255, rm_define.effect_always_on)     list_collision.append(armor_ctrl.get_last_hit_index())     gimbal_ctrl.angle_ctrl(variable_scanX, variable_defaultHeadPitch)     if random.randint(1, 10) <= variable_lazyLevel:         time.sleep(random.randint(5, 20))     chassis_ctrl.move_degree_with_speed(variable_normalSpeed,0) def start():     global variable_scanX     global variable_scanDir     global variable_isAlive     global variable_headMinAngle     global variable_headMaxAngle     global variable_headStep     global variable_headUpX     global variable_lookUp     global variable_lookUpStep     global variable_defaultHeadPitch     global variable_dX1     global variable_dY1     global variable_dX2     global variable_dY2     global variable_dV     global variable_normalSpeed     global variable_lazyLevel     global variable_i     global variable_isMoving     global variable_senseSightAnimal     global variable_senseHearingVoice     global list_Cx     global list_Cy     global list_Cd     global list_collision     global list_senseTouch     global list_senseSight     global list_senseHearing     global pid_Ii     media_ctrl.play_sound(rm_define.media_sound_solmization_1C)     led_ctrl.set_bottom_led(rm_define.armor_bottom_all, 255, 255, 255, rm_define.effect_always_on)     armor_ctrl.set_hit_sensitivity(10)     robot_ctrl.set_mode(rm_define.robot_mode_free)     variable_headMinAngle = -30     variable_headMaxAngle = 30     variable_headStep = 10     variable_defaultHeadPitch = -5     variable_headUpX = 0     variable_normalSpeed = 0.2     variable_lazyLevel = 0     list_senseHearing=RmList()     list_senseHearing.append(0)     list_senseHearing.append(0)     list_senseSight=RmList()     list_senseSight.append(0)     list_senseSight.append(0)     variable_senseSightAnimal = 0     list_senseTouch=RmList()     list_senseTouch.append(0)     list_senseTouch.append(0)     chassis_ctrl.enable_stick_overlay()     gimbal_ctrl.enable_stick_overlay()     gimbal_ctrl.set_rotate_speed(150)     gimbal_ctrl.angle_ctrl(0, variable_defaultHeadPitch)     user_defined_life()  def chassis_impact_detection(msg):     global variable_scanX     global variable_scanDir     global variable_isAlive     global variable_headMinAngle     global variable_headMaxAngle     global variable_headStep     global variable_headUpX     global variable_lookUp     global variable_lookUpStep     global variable_defaultHeadPitch     global variable_dX1     global variable_dY1     global variable_dX2     global variable_dY2     global variable_dV     global variable_normalSpeed     global variable_lazyLevel     global variable_i     global variable_isMoving     global variable_senseSightAnimal     global variable_senseHearingVoice     global list_Cx     global list_Cy     global list_Cd     global list_collision     global list_senseTouch     global list_senseSight     global list_senseHearing     global pid_Ii     list_senseTouch[2] = 1     list_senseTouch[1] = 1 def ir_hit_detection_event(msg):     global variable_scanX     global variable_scanDir     global variable_isAlive     global variable_headMinAngle     global variable_headMaxAngle     global variable_headStep     global variable_headUpX     global variable_lookUp     global variable_lookUpStep     global variable_defaultHeadPitch     global variable_dX1     global variable_dY1     global variable_dX2     global variable_dY2     global variable_dV     global variable_normalSpeed     global variable_lazyLevel     global variable_i     global variable_isMoving     global variable_senseSightAnimal     global variable_senseHearingVoice     global list_Cx     global list_Cy     global list_Cd     global list_collision     global list_senseTouch     global list_senseSight     global list_senseHearing     global pid_Ii     list_senseSight[2] = 1     list_senseSight[1] = 1 def armor_hit_detection_all(msg):     global variable_scanX     global variable_scanDir     global variable_isAlive     global variable_headMinAngle     global variable_headMaxAngle     global variable_headStep     global variable_headUpX     global variable_lookUp     global variable_lookUpStep     global variable_defaultHeadPitch     global variable_dX1     global variable_dY1     global variable_dX2     global variable_dY2     global variable_dV     global variable_normalSpeed     global variable_lazyLevel     global variable_i     global variable_isMoving     global variable_senseSightAnimal     global variable_senseHearingVoice     global list_Cx     global list_Cy     global list_Cd     global list_collision     global list_senseTouch     global list_senseSight     global list_senseHearing     global pid_Ii     list_senseTouch[2] = 2     list_senseTouch[1] = 1
2020-4-5
Use props
Bitmizu
lvl.1

Singapore
Offline

Thanks. Awesome.
2020-4-5
Use props
robertotr
lvl.1
Flight distance : 30817 ft
  • >>>
Guatemala
Offline

thanks man.
2020-4-7
Use props
thomasnemo.com
lvl.2
Flight distance : 446 ft
Poland
Offline

Version 1.1 is ready. Sorry for the delay, working on Covid app
2020-4-15
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules