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

ModalAI Forum

Filip SlezakF

Filip Slezak

@Filip Slezak
Contributor
Unfollow Follow
About
Posts
12
Topics
2
Shares
0
Groups
1
Followers
0
Following
0

Posts

Recent Best Controversial

  • Communication through J18
    Filip SlezakF Filip Slezak

    @Eric-Katzfey Hey, we already have this board on https://www.modalai.com/collections/expansion-board/products/m0078 - would that work?

    (and the PWM breakout board https://www.modalai.com/products/flight-core-pwm-output-cable-and-break-out-board)

    Ask your questions right here!

  • Communication through J18
    Filip SlezakF Filip Slezak

    @Eric-Katzfey Hi Eric, thanks for pointing this out. How would you go about establishing a serial communication with a Teensy or other microcontroller then?

    Ask your questions right here!

  • Communication through J18
    Filip SlezakF Filip Slezak

    Hi, I'd like to communicate with a teensy from a Voxl2 through the serial channel on J18. Can you help me set this up?

    I tried UART first and then the I2C but I haven't figured this out. Here's my code

    import smbus
    
    # Open the I2C bus
    bus = smbus.SMBus(0)  # Use /dev/i2c-0
    
    # I2C device address
    address = 0x988000  # Replace with the actual I2C device address
    
    # Read lines of data from the I2C device
    while True:
        received_data = ""
        while True:
            byte = bus.read_byte(address)
            if byte == ord('\n'):  # Check for newline character
                break
            received_data += chr(byte)
    
        # Process the received data
        print("Received line:", received_data)
    
    # Close the I2C bus
    bus.close()
    

    and the one I want to use on the teensy

    #include <Wire.h>
    
    #define I2C_ADDRESS 0x42  // Replace with the I2C device address
    
    void setup() {
      Wire.begin(); // Initialize I2C communication
      Serial.begin(115200); // Set baud rate for serial monitor
    }
    
    void loop() {
      Wire.beginTransmission(I2C_ADDRESS);  // Begin transmission to the I2C device
      Wire.write("Hello, World!");  // Send the message
      Wire.endTransmission();  // End transmission
    
      Serial.println("Message sent!");
    
      delay(1000); // Wait for 1 second before sending the next message
    }
    

    This is my first attempt at dealing with I2C so extra comments are welcome as well. Would still be easier if I could use these pins for UART so tell me if that's an option.

    Thanks!

    Ask your questions right here!

  • Upgrading PX4 for VOXL2
    Filip SlezakF Filip Slezak

    @Eric-Katzfey Yeah ok I think I got it. So just execute the above dpkg install. Would be cool if it checked for updates itself every once in a while

    VOXL 2

  • Upgrading PX4 for VOXL2
    Filip SlezakF Filip Slezak

    @Eric-Katzfey Is this just a command to execute on the voxl, px4 will be updated and all else remain equal - custom configs and all?

    Thanks

    VOXL 2

  • PWM and CAN channels
    Filip SlezakF Filip Slezak

    @Vinny Hi, is there any update on this CAN support through FlightCore V2?

    We're seriously considering the option instead of a PWM through the I/O board to control our motors. Unfortunately, I can't seem to find any code that would do this from the PX4 pilot - other than that the connector exists. How is this supported by the board interfaces? How would I go about sending commands to that bus?

    Let me know if you need more info.
    Best

    Flight Core v2

  • PWM channel control for auxiliary functions
    Filip SlezakF Filip Slezak

    Any tips on how to control this from ROS for offboard mode?

    VOXL 2 IO

  • PWM channel control for auxiliary functions
    Filip SlezakF Filip Slezak

    Yes, thanks. Although incomplete 🙂
    Need to configure quad_x_io.main.mix (find / -name "filename") with the code below where X is the channel defined in the 2nd link below (AUX1 5 or AUX2 6)

    # Hexacopter X airframe config
    R: 6x ...
    # For each AUX channel
    M: 1
    S: 3 X ...
    

    Writing this from home, sorry for '...' but simply copy the config to quad_x.main.mix to quad_x_io.main.mix, both these files are loaded on boot and if the io board is connected it overrides the former

    AUX1 will be on pin7 and AUX2 on pin8.

    1. https://docs.px4.io/v1.12/en/concept/mixing.html
    2. https://docs.modalai.com/voxl2-io-user-guide/#supported-mixers-and-airframe-setup

    Or properly rename the file and change the name being loaded in the px4 startup script but I didn't do that to avoid issues in case it's used by something else too...

    VOXL 2 IO

  • VOXL2 unused/repurposed GPIO
    Filip SlezakF Filip Slezak
    def gpio_init(pin):
        with open("/sys/class/gpio/export", "w") as config:
            config.write(str(pin).encode())
        return
    
    def gpio_exit(pin):
        with open("/sys/class/gpio/unexport", "w") as config:
            config.write(str(pin).encode())
        return
    
    def gpio_set_mode(pin, direction):
        with open("/sys/class/gpio/gpio{}/direction".format(pin), "w") as mode:
            mode.write(str(direction).encode())
        return
    
    def gpio_set_value(pin, value):     
        with open("/sys/class/gpio/gpio{}/value".format(pin), "w") as gpio:
            gpio.write(str(value).encode())
        return
         
    
    Ask your questions right here!

  • PWM channel control for auxiliary functions
    Filip SlezakF Filip Slezak

    Hi all,

    How should I go about controlling the PWM channel 7 or 8 (hexacopter airframe) from VOXL2 code and/or remote control? I can't find where the AUX channels are mapped

    Thx

    VOXL 2 IO

  • VOXL2 unused/repurposed GPIO
    Filip SlezakF Filip Slezak

    @tom said in VOXL2 unused/repurposed GPIO:

    Link Preview Image
    VOXL 2 Linux User Guide

    ModalAI technical documentation for VOXL and VOXL 2 Companion Computers for PX4 and ArduPilot Obstacle Avoidance and GPS-denied navigation, assembled in the USA

    favicon

    ModalAI Technical Docs (docs.modalai.com)

    Indeed, thanks for the fast reply. I also just ran into the bind.c here https://forum.modalai.com/topic/1466/voxl2-gpio-and-serial-interfaces/3 and turns out I didn't account for the chip offset. How do I figure out which one to use? In this case it was 1100. This should now be a permanent setting right?

    To modify those from code I could copy the _gpio_control function above and use it in a ros package, right? I am looking for a clean way to do this. Please tell me if there's a better way to directly toggle based on radio signal.

    Also, I can't find any python code examples, are there any?

    Ask your questions right here!

  • VOXL2 unused/repurposed GPIO
    Filip SlezakF Filip Slezak

    Hey, trying to do something very similar myself.

    Can't seem to toggle pin 46 on the VOXL2 J10. Following docs.modalai.com/voxl-gpio-io I run into the following:

    voxl2:~$ echo 46 > /sys/class/gpio/export
    -bash: echo write error: Invalid argument
    

    Eventually, I'd like this to match the state of a radio remote control switch to kill another board's power supply. Maybe through ROS
    but preferably not. Can you guide me through it please?

    Ask your questions right here!
  • Login

  • Don't have an account? Register

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