Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse
Brand Logo

ModalAI Forum

C

cy208183395

@cy208183395
Contributor
Unfollow Follow
About
Posts
12
Topics
6
Shares
0
Groups
1
Followers
0
Following
0

Posts

Recent Best Controversial

  • Help!!! When flying can't control speed
    C cy208183395

    VelocityNedYaw fails when it controls the code of flight distance and speed, no matter how to adjust the parameters, it will fly at the same speed. And the orientation of the header at initialization is random rather than fixed to the north.

    #!/usr/bin/env python3
    
    import asyncio
    from mavsdk import System
    from mavsdk.offboard import (PositionNedYaw, VelocityNedYaw, OffboardError)
    
    async def run():
    drone = System()
    await drone.connect(system_address="udp://:14551")
    
    print("Waiting for drone to connect...")
    async for state in drone.core.connection_state():
        if state.is_connected:
            print(f"-- Connected to drone!")
            break
    
    # print("Waiting for drone to have a global position estimate...")
    # async for health in drone.telemetry.health():
    #     if health.is_global_position_ok and health.is_home_position_ok:
    #         print("-- Global position estimate OK")
    #         break
    print("-- Arming")
    await drone.action.arm()
    # need delay!!
    await asyncio.sleep(5)
    
    print("-- Setting initial setpoint")
    await drone.offboard.set_position_ned(PositionNedYaw(0.0, 0.0, 0.0, 0.0))
    
    print("-- Starting offboard")
    try:
        await drone.offboard.start()
    except OffboardError as error:
        print(f"Starting offboard mode failed with error code: {error._result.result}")
        print("-- Disarming")
        await drone.action.disarm()
        return
    
    # async def print_z_velocity(drone):
    #     async for odom in drone.telemetry.position_velocity_ned():
    #         print(f"{odom.velocity.north_m_s} {odom.velocity.down_m_s}")
    
    # asyncio.ensure_future(print_z_velocity(drone))
    
    # print("-- Go 0m North, 0m East, -10m Down within local coordinate system")
    # await drone.offboard.set_position_velocity_ned(
    #     PositionNedYaw(0.0, 0.0, -10.0, 0.0),
    #     VelocityNedYaw(0.0, 0.0, -1.0, 0.0))
    # await asyncio.sleep(10)
    
    # print("-- Go 10m North, 0m East, 0m Down within local coordinate system")
    # await drone.offboard.set_position_velocity_ned(
    #     PositionNedYaw(50.0, 0.0, -10.0, 0.0),
    #     VelocityNedYaw(1.0, 0.0, 0.0, 0.0))
    # await asyncio.sleep(20)
    
    print("-- Go 0m North, 0m East, -0.5m Down within local coordinate system")
    await drone.offboard.set_position_velocity_ned(
        PositionNedYaw(0.0, 0.0, -0.5, 0.0),
        VelocityNedYaw(0.0, 0.0, -1.0, 0.0))
    await asyncio.sleep(5)
    
    print("-- Go 0.5m North, 0m East, -0.5m Down within local coordinate system")
    await drone.offboard.set_position_velocity_ned(
        PositionNedYaw(0.5, 0.0, -0.5, 90.0),
        VelocityNedYaw(0.2, 0.0, 0.0, 90.0)
        )
    await asyncio.sleep(5)
    
    # print("-- Go 0.5m North, 0m East, -0.5m Down within local coordinate system")
    # await drone.offboard.set_position_velocity_ned(
    #     PositionNedYaw(0.3, 0.3, -0.5, 90.0),
    #     VelocityNedYaw(0.0, 0.2, 0, 0.0))
    # await asyncio.sleep(5)
    
    
    
    
    
    
    # await drone.action.land()
    
    
    try:
        await drone.action.land()
    except:
        print("Failed to land")
    
    print("-- Disarming")
    try:
        await drone.action.disarm()
    except:
        print("Disarming failed")
    
    
    
    # print("-- Stopping offboard")
    # try:
    #     await drone.offboard.stop()
    # except OffboardError as error:
    #     print(f"Stopping offboard mode failed with \
    #             error code: {error._result.result}")
    if __name__ == "__main__":
        # Run the asyncio loop
        # asyncio.run(run())
        loop = asyncio.get_event_loop()
        loop.run_until_complete(run())
    
    VOXL 2 velocitynedyaw

  • offboard_position_velocity_ned.py
    C cy208183395

    VelocityNedYaw fails when it controls the code of flight distance and speed, no matter how to adjust the parameters, it will fly at the same speed. And the orientation of the header at initialization is random rather than fixed to the north.

    #!/usr/bin/env python3

    import asyncio
    from mavsdk import System
    from mavsdk.offboard import (PositionNedYaw, VelocityNedYaw, OffboardError)

    async def run():

    drone = System()
    await drone.connect(system_address="udp://:14551")
    
    print("Waiting for drone to connect...")
    async for state in drone.core.connection_state():
        if state.is_connected:
            print(f"-- Connected to drone!")
            break
    
    # print("Waiting for drone to have a global position estimate...")
    # async for health in drone.telemetry.health():
    #     if health.is_global_position_ok and health.is_home_position_ok:
    #         print("-- Global position estimate OK")
    #         break
    print("-- Arming")
    await drone.action.arm()
    # need delay!!
    await asyncio.sleep(5)
    
    print("-- Setting initial setpoint")
    await drone.offboard.set_position_ned(PositionNedYaw(0.0, 0.0, 0.0, 0.0))
    
    print("-- Starting offboard")
    try:
        await drone.offboard.start()
    except OffboardError as error:
        print(f"Starting offboard mode failed with error code: {error._result.result}")
        print("-- Disarming")
        await drone.action.disarm()
        return
    
    # async def print_z_velocity(drone):
    #     async for odom in drone.telemetry.position_velocity_ned():
    #         print(f"{odom.velocity.north_m_s} {odom.velocity.down_m_s}")
    
    # asyncio.ensure_future(print_z_velocity(drone))
    
    # print("-- Go 0m North, 0m East, -10m Down within local coordinate system")
    # await drone.offboard.set_position_velocity_ned(
    #     PositionNedYaw(0.0, 0.0, -10.0, 0.0),
    #     VelocityNedYaw(0.0, 0.0, -1.0, 0.0))
    # await asyncio.sleep(10)
    
    # print("-- Go 10m North, 0m East, 0m Down within local coordinate system")
    # await drone.offboard.set_position_velocity_ned(
    #     PositionNedYaw(50.0, 0.0, -10.0, 0.0),
    #     VelocityNedYaw(1.0, 0.0, 0.0, 0.0))
    # await asyncio.sleep(20)
    
    print("-- Go 0m North, 0m East, -0.5m Down within local coordinate system")
    await drone.offboard.set_position_velocity_ned(
        PositionNedYaw(0.0, 0.0, -0.5, 0.0),
        VelocityNedYaw(0.0, 0.0, -1.0, 0.0))
    await asyncio.sleep(5)
    
    print("-- Go 0.5m North, 0m East, -0.5m Down within local coordinate system")
    await drone.offboard.set_position_velocity_ned(
        PositionNedYaw(0.3, 0.0, -0.5, 90.0),
        VelocityNedYaw(0.2, 0.0, 0.0, 0.0)
        )
    await asyncio.sleep(5)
    
    print("-- Go 0.5m North, 0m East, -0.5m Down within local coordinate system")
    await drone.offboard.set_position_velocity_ned(
        PositionNedYaw(0.3, 0.3, -0.5, 90.0),
        VelocityNedYaw(0.0, 0.2, 0, 0.0))
    await asyncio.sleep(5)
    
    
    
    
    
    
    # await drone.action.land()
    
    
    try:
        await drone.action.land()
    except:
        print("Failed to land")
    
    print("-- Disarming")
    try:
        await drone.action.disarm()
    except:
        print("Disarming failed")
    
    
    
    # print("-- Stopping offboard")
    # try:
    #     await drone.offboard.stop()
    # except OffboardError as error:
    #     print(f"Stopping offboard mode failed with \
    #             error code: {error._result.result}")
    if __name__ == "__main__":
    # Run the asyncio loop
    # asyncio.run(run())
    loop = asyncio.get_event_loop()
    loop.run_until_complete(run())
    
    VOXL 2

  • Starting the HITL mode for VOXL2
    C cy208183395

    @Eric-Katzfey
    So, am I because I didn't connect the JST connector to the VOXL2 J18 port.
    The original type-c connection is not able to read data?

    VOXL 2

  • Starting the HITL mode for VOXL2
    C cy208183395

    Hello, I followed the tutorial(https://docs.modalai.com/voxl2-PX4-hitl/) to set up the simulation environment and disabled px4 and qvio.:
    2024-07-19 15-57-48屏幕截图.png

    Then I ran

    voxl-px4-hitl
    

    and used the command

    qshell dsp_hitl status
    

    to query the status of the HITL driver:

    2024-07-19 15-57-00屏幕截图.png

    Why is there no data?

    I am connecting to VOXL2 via type-c to adb. Could this be related to the issue? (I did not connect the JST connector to the VOXL2 J18 port)

    If the pins of VOXL2 are not connected, please tell me where the J18 port of VOXL2 (VOXL2 Starlight) is located. Thank you very much for your help!

    VOXL 2

  • Regarding the issue of recovering voxl-suite!
    C cy208183395

    @tom

    1. I connected to my personal WiFi, but this WiFi cannot connect to the external network.
      2024-07-13 14-35-36屏幕截图.png

    2024-07-13 14-35-08屏幕截图.png

    1. Which tutorial should I follow? Please point it out for me. Thank you!
    VOXL 2

  • Regarding the issue of recovering voxl-suite!
    C cy208183395

    First, I encountered issues while installing the Docker environment on VOXL2. The main problem occurred with the sudo apt update command. After executing this command, it showed that I couldn't fetch Docker from the Docker website. I suspect it is a network issue with VOXL2, so I tried changing the source. However, I still got stuck due to Python3 issues. I then attempted to uninstall Python3, and finally, the following problem appeared
    (the version number after voxl-suite disappeared) :

    2024-07-12 22-36-03屏幕截图.png

    Therefore, I have two issues that need your kind assistance:

    1. Is the network problem here related to an inability to connect to the external network?
    2. How can I recover voxl-suite? Should I reflash the SDK?
      Honestly, I appreciate your previous help that has gotten me this far, but since I am a beginner, I hope you can explain it to me carefully. Thank you very much for your assistance!
    VOXL 2

  • Regarding building the mavsdk-python Docker image.
    C cy208183395

    @Eric-Katzfey Yes, I currently have Docker installed on my host machine, but it is not installed on the voxl2.

    VOXL 2

  • Regarding building the mavsdk-python Docker image.
    C cy208183395

    @Eric-Katzfey

    I encountered a new problem. After I installed Docker as you suggested this website .I successfully started and ran it:

    1.png
    &&
    2.png

    But when I followed the tutorial to download the repository and executed the command

    ./build-image.sh
    

    it showed "command not found":
    4.png

    I tried setting the environment variable, but it still didn't work.

    Then I continued to watch the tutorial video, entered the voxl2 shell, navigated to the folder /data/docker/mavsdk, and executed the command ./run-docker.sh. It still showed that the docker command was not found:
    6.png

    This means that whether I am in the voxl2 shell environment or not, the docker command is not found.

    Can you help me? I followed your requirements, but I am stuck here. Please help me, thank you!

    VOXL 2

  • Regarding controlling drone flight using code
    C cy208183395

    @Eric-Katzfey said in Regarding controlling drone flight using code:

    @cy208183395 I would take a look at the documentation for MAVSDK. It has a python interface available and can do drone control.

    Thanks for your reply

    Starling & Starling 2

  • Regarding building the mavsdk-python Docker image.
    C cy208183395

    @Eric-Katzfey said in Regarding building the mavsdk-python Docker image.:

    @cy208183395 The voxl-configure-docker-support script is only used on VOXL. For VOXL 2 you need to install Docker and not run that script.
    Thank you very much for your reply

    VOXL 2

  • Regarding building the mavsdk-python Docker image.
    C cy208183395

    When I was preparing to follow the mavsdk-python tutorial , I encountered an issue with the command :

    voxl-configure-docker-support.sh
    

    2

    As a workaround, I tried using the command:

    ./build-image.sh
    

    to execute this repo, but then I faced this problem:

    1

    What should I do? My development board is VOXL2. Please help me, thank you!

    VOXL 2

  • Regarding controlling drone flight using code
    C cy208183395

    I am using the Starling drone and have completed your basic drone training camp, where I learned how to control the drone using a wireless controller. However, I now want to control the drone using Python programming. I reviewed the VOXL2 SDK and found that there is no clear process to control the drone for takeoff, landing, moving forward, etc. Is there any way you can help me with this? Thank you!

    Starling & Starling 2
  • Login

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups