kandi background
Explore Kits

towr | trajectory optimization for legged robots | Robotics library

 by   ethz-adrl C++ Version: 1.4.0 License: BSD-3-Clause

 by   ethz-adrl C++ Version: 1.4.0 License: BSD-3-Clause

Download this library from

kandi X-RAY | towr Summary

towr is a C++ library typically used in Automation, Robotics applications. towr has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.
A base-set of variables, costs and constraints that can be combined and extended to formulate trajectory optimization problems for legged systems. These implementations have been used to generate a variety of motions such as monoped hopping, biped walking, or a complete quadruped trotting cycle, while optimizing over the gait and step durations in less than 100ms (paper). Features: :heavy_check_mark: Intuitive and efficient formulation of variables, cost and constraints using Eigen. :heavy_check_mark: ifopt enables using the high-performance solvers Ipopt and Snopt. :heavy_check_mark: Elegant rviz visualization of motion plans using xpp. :heavy_check_mark: ROS/catkin integration (optional). :heavy_check_mark: Light-weight (~6k lines of code) makes it easy to use and extend. Install • Run • Develop • Contribute • Publications • Authors.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • towr has a low active ecosystem.
  • It has 466 star(s) with 140 fork(s). There are 36 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 16 open issues and 42 have been closed. On average issues are closed in 68 days. There are no pull requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of towr is 1.4.0
towr Support
Best in #Robotics
Average in #Robotics
towr Support
Best in #Robotics
Average in #Robotics

quality kandi Quality

  • towr has 0 bugs and 0 code smells.
towr Quality
Best in #Robotics
Average in #Robotics
towr Quality
Best in #Robotics
Average in #Robotics

securitySecurity

  • towr has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • towr code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
towr Security
Best in #Robotics
Average in #Robotics
towr Security
Best in #Robotics
Average in #Robotics

license License

  • towr is licensed under the BSD-3-Clause License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
towr License
Best in #Robotics
Average in #Robotics
towr License
Best in #Robotics
Average in #Robotics

buildReuse

  • towr releases are available to install and integrate.
  • Installation instructions, examples and code snippets are available.
  • It has 59 lines of code, 0 functions and 2 files.
  • It has low code complexity. Code complexity directly impacts maintainability of the code.
towr Reuse
Best in #Robotics
Average in #Robotics
towr Reuse
Best in #Robotics
Average in #Robotics
Top functions reviewed by kandi - BETA

kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample Here

Get all kandi verified functions for this library.

Get all kandi verified functions for this library.

towr Key Features

A light-weight, Eigen-based C++ library for trajectory optimization for legged robots.

Install

copy iconCopydownload iconDownload
sudo apt-get install ros-<ros-distro>-towr-ros

Run

copy iconCopydownload iconDownload
roslaunch towr_ros towr_ros.launch  # debug:=true  (to debug with gdb)

Publications

copy iconCopydownload iconDownload
@article{winkler18,
  author    = {Winkler, Alexander W and Bellicoso, Dario C and 
               Hutter, Marco and Buchli, Jonas},
  title     = {Gait and Trajectory Optimization for Legged Systems 
               through Phase-based End-Effector Parameterization},
  journal   = {IEEE Robotics and Automation Letters (RA-L)},
  year      = {2018},
  month     = {July},
  pages     = {1560-1567},
  volume    = {3},
  doi       = {10.1109/LRA.2018.2798285},
}

Python JSON TypeError : list indices must be integers or slices, not str

copy iconCopydownload iconDownload
import json

# Opening JSON file
f = open('data.json',)

# returns JSON object as
# a dictionary
data = json.load(f)

# Iterating through the json
# list
for i in data['Results']:
    for row in i["Attachments"]:
        print("Emiten_Code is ", row["Emiten_Code"], ", File_ID is ",row["File_ID"])

# Closing file
f.close()

"""
OUTPUT -
Emiten_Code is  AALI , File_ID is  8ef70399-e349-4fe6-bf98-b224e11d05a4
Emiten_Code is  ABMM , File_ID is  22d8cfba-7ff3-4aac-8325-a5c0a444a170
Emiten_Code is  ABMM , File_ID is  3e2ebdd6-53d2-42d8-bba2-29bf61fc1e52
Emiten_Code is  ACES , File_ID is  e7ab91d9-db2e-4832-90cc-438321ff46bd
Emiten_Code is  ACES , File_ID is  f267a10e-6b18-4d62-a92f-5f42c0ac4064
Emiten_Code is  ACES , File_ID is  61305b4e-2754-4f91-ace0-a4925e54b21c
Emiten_Code is  ACES , File_ID is  cdf09705-6783-4a9d-a7ec-d35da3430fb1
Emiten_Code is  ACES , File_ID is  88d74da3-a999-48eb-b3c1-efc2099acddd
Emiten_Code is  ADHI , File_ID is  030ef1ea-e1f3-44db-9391-b53de8731576
Emiten_Code is  ADRO , File_ID is  a969fd6b-44ea-4fe8-adb5-ae19308c89d2
"""

A better solution for Itext 7 Text fitting

copy iconCopydownload iconDownload
PdfWriter writer;
try {
    writer = new PdfWriter(new File("test2.pdf"));

    PdfDocument document = new PdfDocument(writer);
    document.getDocumentInfo().addCreationDate();
    document.getDocumentInfo().setTitle("Title");
    document.setDefaultPageSize(PageSize.A4);
    Document doc =  new Document(document);
    doc.setFontSize(12);


    Paragraph par =  new Paragraph();
    Text ch01 = new Text("Prev Text ");
    par.add(ch01);
    Paragraph space = new Paragraph();
    space.setMaxWidth(40);
    for(int i=0;i<40;i++) {
        par.add("\u00a0");
        space.add("\u00a0");
    }
    Text ch02 =  new Text(" next text");
    par.add(ch02);
    doc.add(par);


    Paragraph linePara = new Paragraph().add("Test from UserInput")
            .setTextAlignment(TextAlignment.CENTER).setBorder(new DottedBorder(1));

    float width = doc.getPageEffectiveArea(PageSize.A4).getWidth();
    float height = doc.getPageEffectiveArea(PageSize.A4).getHeight();

    IRenderer primul = ch01.createRendererSubTree().setParent(doc.getRenderer());
    IRenderer spaceR = space.createRendererSubTree().setParent(doc.getRenderer());
    LayoutResult primulResult = primul.layout(new LayoutContext(new LayoutArea(1, new Rectangle(width,height))));
    LayoutResult layoutResult = spaceR.layout(new LayoutContext(new LayoutArea(1, new Rectangle(width,height))));
    Rectangle primulBox  = ((TextRenderer) primul).getInnerAreaBBox();
    Rectangle rect  = ((ParagraphRenderer) spaceR).getOccupiedArea().getBBox();
    float rwidth =  rect.getWidth();
    float rheight =  rect.getHeight();

    float x = primulBox.getWidth()+ doc.getLeftMargin();
    float y =  rect.getY() + doc.getBottomMargin();


    Rectangle towr =  new Rectangle(x, y, rwidth, rheight);

    PdfCanvas pdfcanvas =  new PdfCanvas(document.getFirstPage());
    Canvas canvas =  new Canvas(pdfcanvas, towr);
    //from theinternet
    float fontSizeL = 1;
    float fontSizeR = 14;
    while (Math.abs(fontSizeL - fontSizeR) > 1e-1) {
        float curFontSize = (fontSizeL + fontSizeR) / 2;
        linePara.setFontSize(curFontSize);
        // It is important to set parent for the current element renderer to a root renderer
        IRenderer renderer = linePara.createRendererSubTree().setParent(canvas.getRenderer());
        LayoutContext context = new LayoutContext(new LayoutArea(1, towr));
        if (renderer.layout(context).getStatus() == LayoutResult.FULL) {
            // we can fit all the text with curFontSize
            fontSizeL = curFontSize;
        } else {
            fontSizeR = curFontSize;
        }
    }
    canvas.add(linePara);
    new PdfCanvas(document.getFirstPage()).rectangle(towr).setStrokeColor(ColorConstants.BLACK).stroke();
    canvas.close();
    doc.close();
    writer.flush();


} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

Community Discussions

Trending Discussions on towr
  • Python JSON TypeError : list indices must be integers or slices, not str
  • A better solution for Itext 7 Text fitting
Trending Discussions on towr

QUESTION

Python JSON TypeError : list indices must be integers or slices, not str

Asked 2021-Jun-02 at 13:15

I am trying to loop through a dataframe but I am getting a for row in i["Attachments"]: TypeError: list indices must be integers or slices, not str My JSON file has Attachments yet it is giving me errors. I have possibly tried all ways from Stackoverflow to get this issue solved, but to my dismay none of them really worked. this is my Json file

idx.json

{"Search": {"ReportType": "rda", "KodeEmiten": "ACES;BOGA;PTBA;ERAA;ITMG;TLKM;BBCA;ADRO;ASII;DOID;INDF;JSMR;LPKR;PTPP;PGAS;SRIL;TINS;EXCL;BBNI;BBRI;BMRI;BBTN;SCMA;ABMM;LINK;TPIA;BRPT;TKIM;SMRA;MNCN;INDY;PNLF;APLN;KIJA;WSKT;AKRA;JPFA;AALI;UNTR;SIDO;NATO;WIKA;MAPI;INTP;SSMS;CPIN;SMGR;BSDE;LSIP;MEDC;ASRI;ANTM;BRIS;BTPS;BJBR;BJTM;POWR;CTRA;GGRM;INKP;INDF;ISAT;MDKA;CARE;APIC;TOWR;SMSM;FREN;SOCI;TBIG;UNVR;WSBP;DMAS;BWPT;LPPF;MPPA;MLPL;GIAA;BDMN;HRUM;SSIA;SIMP;SMCB;MYRX;BBKP;BUMI;BMTR;BHIT;AISA;PWON;PPRO;HMSP;FIRE;ADHI;KRAS;KREN;BKSL;TBLA;TAMU;RALS;TARA", "Year": "2019", "Periode": null, "indexfrom": 0, "pagesize": 10}, "ResultCount": 173, "Results": [{"KodeEmiten": "AALI", "File_Modified": "2020-07-28T09:33:52.167", "Report_Period": null, "Report_Year": "2019", "NamaEmiten": "Astra Agro Lestari Tbk", "Attachments": [{"Emiten_Code": "AALI", "File_ID": "8ef70399-e349-4fe6-bf98-b224e11d05a4", "File_Modified": "2020-07-28T09:33:52.167", "File_Name": "AALI_Annual Report_2019.pdf", "File_Path": "http://www.idx.co.id/Portals/0/StaticData/ListedCompanies/Corporate_Actions/New_Info_JSX/Jenis_Informasi/01_Laporan_Keuangan/04_Annual Report//2019/AALI/AALI_Annual Report_2019.pdf", "File_Size": 5202426, "File_Type": ".pdf", "Report_Period": null, "Report_Type": "rda", "Report_Year": "2019", "NamaEmiten": "Astra Agro Lestari Tbk"}]}, {"KodeEmiten": "ABMM", "File_Modified": "2020-07-28T09:33:57.473", "Report_Period": null, "Report_Year": "2019", "NamaEmiten": "ABM Investama Tbk", "Attachments": [{"Emiten_Code": "ABMM", "File_ID": "22d8cfba-7ff3-4aac-8325-a5c0a444a170", "File_Modified": "2020-07-28T09:33:57.473", "File_Name": "ABMM_Annual Report 2019_lamp.pdf", "File_Path": "http://www.idx.co.id/Portals/0/StaticData/ListedCompanies/Corporate_Actions/New_Info_JSX/Jenis_Informasi/01_Laporan_Keuangan/04_Annual Report//2019/ABMM/ABMM_Annual Report 2019_lamp.pdf", "File_Size": 3877885, "File_Type": ".pdf", "Report_Period": null, "Report_Type": "rda", "Report_Year": "2019", "NamaEmiten": "ABM Investama Tbk"}, {"Emiten_Code": "ABMM", "File_ID": "3e2ebdd6-53d2-42d8-bba2-29bf61fc1e52", "File_Modified": "2020-07-28T09:33:56.37", "File_Name": "ABMM_Annual Report 2019.pdf", "File_Path": "http://www.idx.co.id/Portals/0/StaticData/ListedCompanies/Corporate_Actions/New_Info_JSX/Jenis_Informasi/01_Laporan_Keuangan/04_Annual Report//2019/ABMM/ABMM_Annual Report 2019.pdf", "File_Size": 9231076, "File_Type": ".pdf", "Report_Period": null, "Report_Type": "rda", "Report_Year": "2019", "NamaEmiten": "ABM Investama Tbk"}]}, {"KodeEmiten": "ACES", "File_Modified": "2020-07-28T09:34:05.733", "Report_Period": null, "Report_Year": "2019", "NamaEmiten": "Ace Hardware Indonesia Tbk", "Attachments": [{"Emiten_Code": "ACES", "File_ID": "e7ab91d9-db2e-4832-90cc-438321ff46bd", "File_Modified": "2020-07-28T09:34:05.733", "File_Name": "ACES_Annual Report 2019_lamp_03.pdf", "File_Path": "http://www.idx.co.id/Portals/0/StaticData/ListedCompanies/Corporate_Actions/New_Info_JSX/Jenis_Informasi/01_Laporan_Keuangan/04_Annual Report//2019/ACES/ACES_Annual Report 2019_lamp_03.pdf", "File_Size": 9264565, "File_Type": ".pdf", "Report_Period": null, "Report_Type": "rda", "Report_Year": "2019", "NamaEmiten": "Ace Hardware Indonesia Tbk"}, {"Emiten_Code": "ACES", "File_ID": "f267a10e-6b18-4d62-a92f-5f42c0ac4064", "File_Modified": "2020-07-28T09:34:05.06", "File_Name": "ACES_Annual Report 2019_lamp_04.pdf", "File_Path": "http://www.idx.co.id/Portals/0/StaticData/ListedCompanies/Corporate_Actions/New_Info_JSX/Jenis_Informasi/01_Laporan_Keuangan/04_Annual Report//2019/ACES/ACES_Annual Report 2019_lamp_04.pdf", "File_Size": 5020661, "File_Type": ".pdf", "Report_Period": null, "Report_Type": "rda", "Report_Year": "2019", "NamaEmiten": "Ace Hardware Indonesia Tbk"}, {"Emiten_Code": "ACES", "File_ID": "61305b4e-2754-4f91-ace0-a4925e54b21c", "File_Modified": "2020-07-28T09:33:59.973", "File_Name": "ACES_Annual Report 2019.pdf", "File_Path": "http://www.idx.co.id/Portals/0/StaticData/ListedCompanies/Corporate_Actions/New_Info_JSX/Jenis_Informasi/01_Laporan_Keuangan/04_Annual Report//2019/ACES/ACES_Annual Report 2019.pdf", "File_Size": 6840439, "File_Type": ".pdf", "Report_Period": null, "Report_Type": "rda", "Report_Year": "2019", "NamaEmiten": "Ace Hardware Indonesia Tbk"}, {"Emiten_Code": "ACES", "File_ID": "cdf09705-6783-4a9d-a7ec-d35da3430fb1", "File_Modified": "2020-07-28T09:34:01.323", "File_Name": "ACES_Annual Report 2019_lamp_01.pdf", "File_Path": "http://www.idx.co.id/Portals/0/StaticData/ListedCompanies/Corporate_Actions/New_Info_JSX/Jenis_Informasi/01_Laporan_Keuangan/04_Annual Report//2019/ACES/ACES_Annual Report 2019_lamp_01.pdf", "File_Size": 9984090, "File_Type": ".pdf", "Report_Period": null, "Report_Type": "rda", "Report_Year": "2019", "NamaEmiten": "Ace Hardware Indonesia Tbk"}, {"Emiten_Code": "ACES", "File_ID": "88d74da3-a999-48eb-b3c1-efc2099acddd", "File_Modified": "2020-07-28T09:34:03.017", "File_Name": "ACES_Annual Report 2019_lamp_02.pdf", "File_Path": "http://www.idx.co.id/Portals/0/StaticData/ListedCompanies/Corporate_Actions/New_Info_JSX/Jenis_Informasi/01_Laporan_Keuangan/04_Annual Report//2019/ACES/ACES_Annual Report 2019_lamp_02.pdf", "File_Size": 4370395, "File_Type": ".pdf", "Report_Period": null, "Report_Type": "rda", "Report_Year": "2019", "NamaEmiten": "Ace Hardware Indonesia Tbk"}]}, {"KodeEmiten": "ADHI", "File_Modified": "2020-07-28T09:34:10.553", "Report_Period": null, "Report_Year": "2019", "NamaEmiten": "PT Adhi Karya (Persero) Tbk.", "Attachments": [{"Emiten_Code": "ADHI", "File_ID": "030ef1ea-e1f3-44db-9391-b53de8731576", "File_Modified": "2020-07-28T09:34:10.553", "File_Name": "ADHI_Annual Report 2019.pdf", "File_Path": "http://www.idx.co.id/Portals/0/StaticData/ListedCompanies/Corporate_Actions/New_Info_JSX/Jenis_Informasi/01_Laporan_Keuangan/04_Annual Report//2019/ADHI/ADHI_Annual Report 2019.pdf", "File_Size": 9649618, "File_Type": ".pdf", "Report_Period": null, "Report_Type": "rda", "Report_Year": "2019", "NamaEmiten": "PT Adhi Karya (Persero) Tbk."}]}, {"KodeEmiten": "ADRO", "File_Modified": "2020-07-28T09:34:17.037", "Report_Period": null, "Report_Year": "2019", "NamaEmiten": "ADARO ENERGY Tbk", "Attachments": [{"Emiten_Code": "ADRO", "File_ID": "a969fd6b-44ea-4fe8-adb5-ae19308c89d2", "File_Modified": "2020-07-28T09:34:17.037", "File_Name": "ADRO_Annual Report_2019_lamp.pdf", "File_Path": "http://www.idx.co.id/Portals/0/StaticData/ListedCompanies/Corporate_Actions/New_Info_JSX/Jenis_Informasi/01_Laporan_Keuangan/04_Annual Report//2019/ADRO/ADRO_Annual Report_2019_lamp.pdf", "File_Size": 5114026, "File_Type": ".pdf", "Report_Period": null, "Report_Type": "rda", "Report_Year": "2019", "NamaEmiten": "ADARO ENERGY Tbk"}]}]}

And this is my code:

json_data = pd.read_json("idx.json", lines=True)
        for i in json_data["Results"]:
            for row in i["Attachments"]:
                try:
                   # rest of code

I am able to get the values for Results column but getting issues for Attachments. Please help me out!

ANSWER

Answered 2021-Jun-02 at 13:15

I've modified the code a little and have used dictionary for easier access and it is working great.

import json

# Opening JSON file
f = open('data.json',)

# returns JSON object as
# a dictionary
data = json.load(f)

# Iterating through the json
# list
for i in data['Results']:
    for row in i["Attachments"]:
        print("Emiten_Code is ", row["Emiten_Code"], ", File_ID is ",row["File_ID"])

# Closing file
f.close()

"""
OUTPUT -
Emiten_Code is  AALI , File_ID is  8ef70399-e349-4fe6-bf98-b224e11d05a4
Emiten_Code is  ABMM , File_ID is  22d8cfba-7ff3-4aac-8325-a5c0a444a170
Emiten_Code is  ABMM , File_ID is  3e2ebdd6-53d2-42d8-bba2-29bf61fc1e52
Emiten_Code is  ACES , File_ID is  e7ab91d9-db2e-4832-90cc-438321ff46bd
Emiten_Code is  ACES , File_ID is  f267a10e-6b18-4d62-a92f-5f42c0ac4064
Emiten_Code is  ACES , File_ID is  61305b4e-2754-4f91-ace0-a4925e54b21c
Emiten_Code is  ACES , File_ID is  cdf09705-6783-4a9d-a7ec-d35da3430fb1
Emiten_Code is  ACES , File_ID is  88d74da3-a999-48eb-b3c1-efc2099acddd
Emiten_Code is  ADHI , File_ID is  030ef1ea-e1f3-44db-9391-b53de8731576
Emiten_Code is  ADRO , File_ID is  a969fd6b-44ea-4fe8-adb5-ae19308c89d2
"""

Source https://stackoverflow.com/questions/67805598

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install towr

The easiest way to install is through the ROS binaries:.
Option 1: core library and hopper-example with pure CMake.
Option 2 (recommended): core library & GUI & ROS-rviz-visualization built with catkin and ROS.
Install dependencies CMake, Eigen, Ipopt: sudo apt-get install cmake libeigen3-dev coinor-libipopt-dev Install ifopt, by cloning the repo and then: cmake .. && make install on your system.
Build towr: git clone https://github.com/ethz-adrl/towr.git && cd towr/towr mkdir build && cd build cmake .. -DCMAKE_BUILD_TYPE=Release make sudo make install # copies files in this folder to /usr/local/* # sudo xargs rm < install_manifest.txt # in case you want to uninstall the above
Test (hopper_example.cc): Generates a motion for a one-legged hopper using Ipopt ./towr-example # or ./towr-test if gtest was found
Use: You can easily customize and add your own constraints and variables to the optimization problem. Herefore, add the following to your CMakeLists.txt: find_package(towr 1.2 REQUIRED) add_executable(main main.cpp) # Your custom variables, costs and constraints added to TOWR target_link_libraries(main PUBLIC towr::towr) # adds include directories and libraries
Install dependencies CMake, catkin, Eigen, Ipopt, ROS, xpp, ncurses, xterm: sudo apt-get install cmake libeigen3-dev coinor-libipopt-dev libncurses5-dev xterm sudo apt-get install ros-<ros-distro>-desktop-full ros-<ros-distro>-xpp
Build workspace: cd catkin_workspace/src git clone https://github.com/ethz-adrl/ifopt.git git clone https://github.com/ethz-adrl/towr.git cd .. catkin_make_isolated -DCMAKE_BUILD_TYPE=Release # or `catkin build` source ./devel_isolated/setup.bash
Use: Include in your catkin project by adding to your CMakeLists.txt add_compile_options(-std=c++11) find_package(catkin COMPONENTS towr) include_directories(${catkin_INCLUDE_DIRS}) target_link_libraries(foo ${catkin_LIBRARIES}) Add the following to your package.xml: <package> <depend>towr</depend> </package>

Support

We love pull request, whether its new constraint formulations, additional robot models, bug fixes, unit tests or updating the documentation. Please have a look at CONTRIBUTING.md for more information. See here the list of contributors who participated in this project.

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases
Explore Kits

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Reuse Pre-built Kits with towr
Consider Popular Robotics Libraries
Try Top Libraries by ethz-adrl
Compare Robotics Libraries with Highest Support
Compare Robotics Libraries with Highest Quality
Compare Robotics Libraries with Highest Security
Compare Robotics Libraries with Permissive License
Compare Robotics Libraries with Highest Reuse
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases
Explore Kits

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.