Please select Into the mobile phone version | Continue to access the computer ver.
Robomaster EP SDK Funktion overview
1548 11 2023-4-21
Uploading and Loding Picture ...(0/1)
o(^-^)o
Spookymike
First Officer
Germany
Offline

Hi there,

i´m learning about my new Robomaster EP and Python programming, that i am new to.
I tried to read throug the modules and examples provided with downloading the SDK.
This is all very hard to understand and to figure out what you can use and how to implement.

Those examples provided are pretty basic.

Browsing throug the block programming in the Robomaster App there should be a lot
more funktions to work with. As i understand, every code block represents a funktion or
a method that should also be found in the SDK.

Does anyone have done some sort of reference of all the classes, functions, methods and modules
that explane how to use them, like what parameters to input in the call?

For example like this:
ep_chassis.drive_speed(x=x_val, y=0, z=0, timeout=5)

I know there is a pdf called : RoboMaster EP Programming Guide V1.0
But this explanes mostly all the blocks functions
There is a explanation what those blocks are named within Python API
but most of these i can´t find in the SDK.

Hope someone has what i am looking for :-)

Regards


2023-4-21
Use props
BGA
Captain
United States
Offline

I guess you are mixing 2 different things. SDK usually refers to the external SDK where you write a program in a computer that is then able to control the robot. Everything else you describe is the internal development environment of the robot and that does indeed have a 1:1 mapping between the python API and the blocks in the visual development IDE.
2023-4-22
Use props
Spookymike
First Officer
Germany
Offline

Sorry i don´t get it
I clicked together some blocks in the R-App just to see the App internal Pyhon conversion.
But nothing in this code i can find anywhere in the modules of the Python SDK :-(

    robot_ctrl.set_mode(rm_define.robot_mode_free)
    chassis_ctrl.move_with_speed(0.5,0,0)
    led_ctrl.set_flash(rm_define.armor_all, 2)
    led_ctrl.set_bottom_led(rm_define.armor_bottom_all, 69, 215, 255, rm_define.effect_always_on)
    led_ctrl.set_top_led(rm_define.armor_top_all, 69, 215, 255, rm_define.effect_always_on)
    led_ctrl.set_single_led(rm_define.armor_top_all, 1, rm_define.effect_always_on)
    led_ctrl.turn_off(rm_define.armor_all)
    led_ctrl.gun_led_on()
    chassis_ctrl.set_pwm_value(rm_define.pwm_all, 7.5)
    chassis_ctrl.enable_stick_overlay()
    chassis_ctrl.set_follow_gimbal_offset(0)
    chassis_ctrl.set_trans_speed(0.5)
    chassis_ctrl.set_rotate_speed(30)
    chassis_ctrl.set_wheel_speed(100,100,100,100)
    chassis_ctrl.move(0)
    chassis_ctrl.move_with_time(0,1)
    chassis_ctrl.move_with_distance(0,1)
    chassis_ctrl.move_degree_with_speed(0.5,0)
    chassis_ctrl.rotate(rm_define.clockwise)
    chassis_ctrl.rotate_with_time(rm_define.clockwise, 1)
    chassis_ctrl.rotate_with_degree(rm_define.clockwise,0)
    chassis_ctrl.rotate_with_speed(rm_define.clockwise,30)
    chassis_ctrl.move_and_rotate(0, rm_define.clockwise)
    chassis_ctrl.move_with_speed(0.5,0.5,30)
    chassis_ctrl.stop()
    gimbal_ctrl.enable_stick_overlay()
    gimbal_ctrl.set_follow_chassis_offset(0)
    gimbal_ctrl.set_rotate_speed(30)
    gimbal_ctrl.recenter()
    gimbal_ctrl.rotate(rm_define.gimbal_up)
    gimbal_ctrl.rotate_with_degree(rm_define.gimbal_up,0)
    gimbal_ctrl.yaw_ctrl(0)
    gimbal_ctrl.angle_ctrl(0, 0)
    gimbal_ctrl.rotate_with_speed(30,30)
    gun_ctrl.set_fire_count(1)
    gun_ctrl.fire_once()
    gun_ctrl.fire_continuous()
    gun_ctrl.stop()
    ir_blaster_ctrl.set_fire_count(1)
    ir_blaster_ctrl.fire_once()
    ir_blaster_ctrl.fire_continuous()
    ir_blaster_ctrl.stop()
    vision_ctrl.enable_detection(rm_define.vision_detection_marker)
    vision_ctrl.enable_detection(rm_define.vision_detection_line)
    media_ctrl.enable_sound_recognition(rm_define.sound_detection_applause)
    vision_ctrl.set_marker_detection_distance(1)
    vision_ctrl.marker_detection_color_set(rm_define.marker_detection_color_red)
    vision_ctrl.line_follow_color_set(rm_define.line_follow_color_blue)
    media_ctrl.exposure_value_update(rm_define.exposure_value_large)
    vision_ctrl.detect_marker_and_aim(rm_define.marker_trans_red_heart)
    armor_ctrl.set_hit_sensitivity(5)
    armor_ctrl.cond_wait(rm_define.cond_ir_hit_detection)
    media_ctrl.play_sound(rm_define.media_sound_attacked)
    media_ctrl.play_sound(rm_define.media_sound_attacked,wait_for_complete_flag=True)
    media_ctrl.play_sound(rm_define.media_custom_audio_undefined)
    media_ctrl.capture()
    media_ctrl.record(1)
2023-4-23
Use props
BGA
Captain
United States
Offline

Spookymike Posted at 4-23 07:06
Sorry i don´t get it
I clicked together some blocks in the R-App just to see the App internal Pyhon conversion.
But nothing in this code i can find anywhere in the modules of the Python SDK :-(

That is what I said, the Python SDK is different from the internal python coding environment, so what you are seeing is expected.
2023-4-25
Use props
Spookymike
First Officer
Germany
Offline

OK, as i understand using the robomaster APP and leanring the EP Programming guide is absolute useless if i want to focus on leanring how to programm the EP external inPython and get used to the python language :-(
So all i can do is trying to read the python SDK files and learning by mistakes. So sad here in germany there is no communitiy of technerds. I tried talking to some collegues of mine from the software department, but really no one ever heard about the Robotmaster, no tech neards nearby ;-)
So i try to do small steps by step!
Thanks
2023-4-26
Use props
BGA
Captain
United States
Offline

Spookymike Posted at 4-26 10:11
OK, as i understand using the robomaster APP and leanring the EP Programming guide is absolute useless if i want to focus on leanring how to programm the EP external inPython and get used to the python language :-(
So all i can do is trying to read the python SDK files and learning by mistakes. So sad here in germany there is no communitiy of technerds. I tried talking to some collegues of mine from the software department, but really no one ever heard about the Robotmaster, no tech neards nearby ;-)
So i try to do small steps by step!

The external Python SDK is documented here: https://robomaster-dev.readthedocs.io/en/latest/
2023-4-26
Use props
Janno-mann
lvl.3
Flight distance : 153737 ft
Germany
Offline

BGA Posted at 4-26 11:28
The external Python SDK is documented here: https://robomaster-dev.readthedocs.io/en/latest/

To sum this up: what you write and learn in the internal python coding environment can in no way be used in a standard Python SDK based Windows editor with the robomaster or robomsterpy package?

Meaning it is practically useless to expand the knowledge how to write python based Robomaster programs based on the examples in the Robomaster App.
Why does DJI force students to write two different Python codes?
2023-11-19
Use props
BGA
Captain
United States
Offline

Janno-mann Posted at 11-19 06:41
To sum this up: what you write and learn in the internal python coding environment can in no way be used in a standard Python SDK based Windows editor with the robomaster or robomsterpy package?

Meaning it is practically useless to expand the knowledge how to write python based Robomaster programs based on the examples in the Robomaster App.

Well, those are 2 different environments. One runs inside the robot and allows to program it even without a computer to run programs. You can also write programs to be used by the robot when battling or things like that.

The external one can be considered an "advanced" programming environment with more flrxibility but all of the disadvantages of being outside the robot.
2023-11-23
Use props
BGA
Captain
United States
Offline

BGA Posted at 11-23 04:19
Well, those are 2 different environments. One runs inside the robot and allows to program it even without a computer to run programs. You can also write programs to be used by the robot when battling or things like that.

The external one can be considered an "advanced" programming environment with more flrxibility but all of the disadvantages of being outside the robot.

And, BTW, I might be able to solve that somewhat and increase the interaction surface between internal and external programs. We will see.
2023-11-23
Use props
stmarx
lvl.3
Flight distance : 153737 ft
Germany
Offline

  A solution for an autonomous RoboMaster EP

RoboMaster EP comes equipped with a power connection module (with IMU) and an intelligent controller unit, missing a controlling computer. The solution is to mount a Raspberry Pi 3B+ with Touchsreen via USB, that will control the RoboMaster, running the python SDK and control programs on board.
My solution, since I found the installation of the RoboMaster SDK on the Raspberry Pi and its connection to the robot via USB not trivial.


[url=]Favorite[/url]
[url=]Like[/url]

RobomasterEPwithRaspberryPI.jpg (439.48 KB, Down times: 0)



2023-11-23
Use props
stmarx
lvl.3
Flight distance : 153737 ft
Germany
Offline

BGA Posted at 11-23 04:19
Well, those are 2 different environments. One runs inside the robot and allows to program it even without a computer to run programs. You can also write programs to be used by the robot when battling or things like that.

The external one can be considered an "advanced" programming environment with more flrxibility but all of the disadvantages of being outside the robot.

As said above I am programming Robomaster EP with the external Python environment.

I want to use the external adapters (2 connected Sharp distance sensors) for obstacle detection and try to use the examples from the SDK  Robomaster Doc Documentation from May 09, 2020.

Now every example from that Documentation (like for example "res = ep_sensor.sensor_adapter_ctrl.get_sensor_adapter_adc(1, 2)")
produces the error: "AttributeError: 'DistanceSensor' object has no attribute 'sensor_adapter_ctrl'"

Can I really not use my RoboMaster EP according to DJI Documentation or am I just not able to program Python?
2023-11-26
Use props
stmarx
lvl.3
Flight distance : 153737 ft
Germany
Offline

stmarx Posted at 11-26 13:28
As said above I am programming Robomaster EP with the external Python environment.

I want to use the external adapters (2 connected Sharp distance sensors) for obstacle detection and try to use the examples from the SDK  Robomaster Doc Documentation from May 09, 2020.

Sorry you all, I am afraid I made a mistake here: the SDK Robomaster Doc Documentation is not documenting the external Python environment but that for the internal!

Still, I am stuck trying to read my sensors on the adapters for obstacle detection, because there seems to be an error in the python package "robomasterpy". When running the example program "dji-sdk/RoboMaster-SDK/examples/14_sensor/03_io_data.py" from the GitHub of the "robomasterpy" I get the Error:
%Run Adapter03_io_data.py
Traceback (most recent call last):
  File "/home/pi/robomaster/Adapter03_io_data.py", line 16, in <module>
    ep_sensor.sub_adapter(freq=5, callback=sub_data_handler)
AttributeError: 'SensorAdaptor' object has no attribute 'sub_adapter'

This although the attribute 'sub_adapter' is defined in the sub function 'sensor.py' of the "robomasterpy".
I am at a complete loss here...
2023-11-27
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules